From 1e6566d5d26bffba56e53ae990119d6bf2b3eab4 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 27 Jul 2017 06:14:42 +0200 Subject: [PATCH] Add white banner --- mods/ITEMS/mcl_banners/README.txt | 7 + mods/ITEMS/mcl_banners/depends.txt | 3 + mods/ITEMS/mcl_banners/description.txt | 1 + mods/ITEMS/mcl_banners/init.lua | 124 ++++++++++++++++++ mods/ITEMS/mcl_banners/mod.conf | 1 + mods/ITEMS/mcl_banners/models/amc_banner.b3d | Bin 0 -> 3815 bytes .../textures/mcl_banners_banner_base.png | Bin 0 -> 814 bytes .../mcl_banners/textures/mcl_banners_base.png | Bin 0 -> 442 bytes .../textures/mcl_banners_item_base.png | Bin 0 -> 163 bytes .../textures/mcl_banners_item_overlay.png | Bin 0 -> 164 bytes tools/Texture_Conversion_Table.csv | 2 + 11 files changed, 138 insertions(+) create mode 100644 mods/ITEMS/mcl_banners/README.txt create mode 100644 mods/ITEMS/mcl_banners/depends.txt create mode 100644 mods/ITEMS/mcl_banners/description.txt create mode 100644 mods/ITEMS/mcl_banners/init.lua create mode 100644 mods/ITEMS/mcl_banners/mod.conf create mode 100644 mods/ITEMS/mcl_banners/models/amc_banner.b3d create mode 100644 mods/ITEMS/mcl_banners/textures/mcl_banners_banner_base.png create mode 100644 mods/ITEMS/mcl_banners/textures/mcl_banners_base.png create mode 100644 mods/ITEMS/mcl_banners/textures/mcl_banners_item_base.png create mode 100644 mods/ITEMS/mcl_banners/textures/mcl_banners_item_overlay.png diff --git a/mods/ITEMS/mcl_banners/README.txt b/mods/ITEMS/mcl_banners/README.txt new file mode 100644 index 000000000..330f46d62 --- /dev/null +++ b/mods/ITEMS/mcl_banners/README.txt @@ -0,0 +1,7 @@ +License of code: WTFPL + +License of textures: See README.me in top directory of MineClone 2. + +License of models: GPLv3 (https://www.gnu.org/licenses/gpl-3.0.html) +Models author: 22i. +Source: https://github.com/22i/amc diff --git a/mods/ITEMS/mcl_banners/depends.txt b/mods/ITEMS/mcl_banners/depends.txt new file mode 100644 index 000000000..4fe444389 --- /dev/null +++ b/mods/ITEMS/mcl_banners/depends.txt @@ -0,0 +1,3 @@ +mcl_sounds? +mcl_core? +mcl_wool? diff --git a/mods/ITEMS/mcl_banners/description.txt b/mods/ITEMS/mcl_banners/description.txt new file mode 100644 index 000000000..fd303145a --- /dev/null +++ b/mods/ITEMS/mcl_banners/description.txt @@ -0,0 +1 @@ +Adds decorative banners. diff --git a/mods/ITEMS/mcl_banners/init.lua b/mods/ITEMS/mcl_banners/init.lua new file mode 100644 index 000000000..827085e3a --- /dev/null +++ b/mods/ITEMS/mcl_banners/init.lua @@ -0,0 +1,124 @@ +local node_sounds +if minetest.get_modpath("mcl_sounds") then + node_sounds = mcl_sounds.node_sound_wood_defaults() +end + +-- Helper function +local function round(num, idp) + local mult = 10^(idp or 0) + return math.floor(num * mult + 0.5) / mult +end + +-- Banner node +minetest.register_node("mcl_banners:standing_banner_white", { + description = "White Banner", + _doc_items_longdesc = "Banners are tall decorative blocks which can be placed on the floor.", + walkable = false, + is_ground_content = false, + paramtype = "light", + sunlight_propagates = true, + drawtype = "airlike", + inventory_image = "mcl_banners_item_base.png^mcl_banners_item_overlay.png", + wield_image = "mcl_banners_item_base.png^mcl_banners_item_overlay.png", + selection_box = {type = "fixed", fixed= {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2} }, + tiles = {"mcl_banners_banner_base.png"}, + groups = { deco_block = 1, attached_node = 1 }, + stack_max = 16, + sounds = node_sounds, + + on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under + + -- Use pointed node's on_rightclick function first, if present + local node_under = minetest.get_node(under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack + end + end + + -- Place the node! + local _, success = minetest.item_place_node(itemstack, placer, pointed_thing) + if not success then + return itemstack + end + + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end + place_pos.y = place_pos.y - 0.5 + + local banner = minetest.add_entity(place_pos, "mcl_banners:banner") + + -- Determine the rotation based on player's yaw + local yaw = placer:get_look_horizontal() + -- Select one of 16 possible rotations (0-15) + local rotation_level = round((yaw / (math.pi*2)) * 16) + local final_yaw = (rotation_level * (math.pi/8)) + math.pi + banner:set_yaw(final_yaw) + + if not minetest.settings:get_bool("creative_mode") then + itemstack:take_item() + end + minetest.sound_play({name="default_place_node_hard", gain=1.0}, {pos = place_pos}) + + return itemstack + end, + on_destruct = function(pos) + local objects = minetest.get_objects_inside_radius(pos, 0.5) + for _, v in ipairs(objects) do + if v:get_entity_name() == "mcl_banners:banner" then + v:remove() + end + end + end, + _mcl_hardness = 1, + _mcl_blast_resistance = 5, +}) + +minetest.register_entity("mcl_banners:banner", { + physical = false, + collide_with_objects = false, + visual = "mesh", + mesh = "amc_banner.b3d", + visual_size = { x=2.5, y=2.5 }, + textures = { "mcl_banners_banner_base.png" }, + collisionbox = { 0, 0, 0, 0, 0, 0 }, + + _base_color = nil, + + get_staticdata = function(self) + local out = { _base_color = self._base_color } + return minetest.serialize(out) + end, + on_activate = function(self, staticdata) + if staticdata and staticdata ~= "" then + local inp = minetest.deserialize(staticdata) + self._base_color = inp._base_color + end + self.object:set_armor_groups({immortal=1}) + end, +}) + +if minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_wool") then + minetest.register_craft({ + output = "mcl_banners:standing_banner_white", + recipe = { + { "mcl_wool:white", "mcl_wool:white", "mcl_wool:white" }, + { "mcl_wool:white", "mcl_wool:white", "mcl_wool:white" }, + { "", "mcl_core:stick", "" }, + } + }) + +end + +minetest.register_craft({ + type = "fuel", + recipe = "mcl_banners:standing_banner_white", + burntime = 15, +}) + diff --git a/mods/ITEMS/mcl_banners/mod.conf b/mods/ITEMS/mcl_banners/mod.conf new file mode 100644 index 000000000..211266581 --- /dev/null +++ b/mods/ITEMS/mcl_banners/mod.conf @@ -0,0 +1 @@ +name = mcl_banners diff --git a/mods/ITEMS/mcl_banners/models/amc_banner.b3d b/mods/ITEMS/mcl_banners/models/amc_banner.b3d new file mode 100644 index 0000000000000000000000000000000000000000..f726fc1adb89accc731eee60431c5b81803b41ab GIT binary patch literal 3815 zcmai1M{-k95PalhFko^H223&nlR-#0U>lsUY-5tCqJUz<1`4+50vv%oD~bzH-wT#- z1d1bY1k*h;Pk+An(pOcNX4HD!GxL7z@9!J@vnhmSA%y*vq%*x%lZN>DI_@uAwt3oN9_-1JPX zqeF#hzg+%UPv(cmZhcz%xY+Zns}cddn;~?wDB<@kEhUk|cY>w$$bb0JQFT23XFN6P z33;b4I;yWc{oQ)jfb~7_7XOOlV-4WH-HN>P7jIopKJ|C{@*mX~zEI!IC;FqdFByO9 zFZvs=`UUlgzgu5H{a#<@@8)MbwRL|A=38-mUVWnP=0knVm)iWaIzGgk``f1ecJt-@ zL|^JN|5zXVv%H%R|6}tJ{leqR&0l)c{0!L;=kr{f@sI0GpSt8tbkyC$_zef+fezfb4 z*Ds>p;`rkAN%$7~*WhD+^pE{Pm-VZ@n@{8uqL+lUtjPI|${=VksM-8m! z-jpijYi}~=hpi_c%8qZUkKW3ge&ney+EG8BpKA7x>*)`Uyy%y$KJvmTKhofxzSN%b z(qFlVFVc7OiT(*r$7cUUt1rQ~@frV?e1U%9{#bw17jN}X_t*6wdDJfR3w)+1C6Bi3iU?hnt;ru#el!~W#n zU#0hyPwzkO{zZMvhu44Qo1R}pLwUV_=kq+b)BF4X`s77lt{+YJZ*Yz0AGtp}-u%gn zej(56i(7B~rTXNXo=+0Je`|eizFbRx<5PdP{y)AzU#^et`9M5uHuC)G{6#z6zjpH{ z$B#bWxc;dDE`2_6`r@7Tm+rr-PinB)%kxwId>i`GpZSZo`cqr#E9zg44>w<_G49XI z^k{8RUj*cRfbRwTtN`riup03yU?s2yV9t0wunt%YY_Oa$UN^!<0IwRM({jdJfi1vh zpv!W`JAm!LHejdajQ0S$fnC5}%NZX4_5=HXgO)Qs0vrYo0Y?GmjE@7yfNtP~<%~}O zCxIT|wB?L@fwRCF;GE@*F93X1D*=21W6t<8a0%dx*A>edUk7+&y$am0oH0&3-n;`h zkOvua#{Ix;pb88C%o*PShJZm}*mA~qfl*)txMw-z31A!;112qJJPq6jrhuB|jOTz^ cUqfY~XL`t)=h5&}N}9YM?iz+O^+ z2M+`9KyhiMR=hzV<%PM}+YY93NV!VwIzn9M%PlIHu)fH((M~f^0DOxI7UC980HkMb zfxNK&cHY4$a?>&{4SGV)z9YWH_Oyc*S0J2pXjC8oMI*p1{Wt&wjv*ZY1d-DsJ=qFm zM1TM~%JEuk$zEy?QwED{v@SrQ>Z_@M3K-f3ci@a%)Xmf;C#pq_VK2(`709VAI{>(_ z7q#{21K>Sm2E2#+6Py;}0jE_e(t(dip8ySVI1vN%q}Av}I$l$js)sm8t{Umkq&b@p zKmy1DFv2siXH2M7FKvE{0adH~7O47~cF@W47V9whuDr#pg?&tqJ6IwI$OQldh{3gj zQZ=nE=u&lHU@KS;Fjru12Z$N06Tnz@AO_}K0mU2w2xSC7|4*>pD!3nFa)IUoMzI~> zA?6WauA?$y2Dof}1z5|V;hr*ZB7Fe7${;qHN&-Ot2~Y)N2B`vy_Z}J@?mc+^;#_vn zPGtZ!YAyptkE$!^TDr&id5^HybQXV$xu(8;PTRL%-+vmD(q_yvJ|=^I+FJ!SF|cW~ zDW&J%yR~*()-vQ$&e_Cx)tV=EhpiSnn=E#5v3a%bunEwC2w-C3;=Jau-KkYB&d#e= s8QVNwcf`fYnSosJ9|~|tkAhJE0Kx9sYvgKaiU0rr07*qoM6N<$g5Ird`~Uy| literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_banners/textures/mcl_banners_base.png b/mods/ITEMS/mcl_banners/textures/mcl_banners_base.png new file mode 100644 index 0000000000000000000000000000000000000000..4a912ade6990116e5cd239e72ca0fa46cf0e3ef4 GIT binary patch literal 442 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!Yyx~jT!Hle|NldsHCi$qoD3zi z6CJ7w1N+-EO0vB=8WN-2b&6u`3S(^Jy!9)Sos;|wDpOoyJaw111vO-O@?DMB1L_wk z3GxeO_zz^Efd~40oD2+%lAbP(Ar*{oudhB^E zKOAqbox8`#_h8b_obtsxuXA%p9LU-lw|aBq*Q(8d>CCs^<}E+R#$@ZB$?%1tfs>o# z9rIHLOGTRnvl({(mYu@hAUp9X!%Id-#=Fc1emb}q9r)$M5bI#xaEjqF>nX++QTG|$ z_VZbY3cR!KC}~hS^jnncU><{x%Tm^!cl(7-G!^SSV0yvlz|Aqi!RmUe(jhjhv+olY z{nVcE-XXV``3+~tJ$XLX*P?D;1x|geaNgqU@rLdg{Z_MMUsq^}M9t*a&uv$} zIrVIxp_N?d$BKkr_sd&uruGFslQ{b=;#iQ@(z8*1Mw-)3rG+mITKv}j|IhRF`%2F- XC^kxH>F;uo1BIKXtDnm{r-UW|W!9=A literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_banners/textures/mcl_banners_item_base.png b/mods/ITEMS/mcl_banners/textures/mcl_banners_item_base.png new file mode 100644 index 0000000000000000000000000000000000000000..47f4348996dda60a0fea8c083846f150ab296ad6 GIT binary patch literal 163 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|Y$ZW{!9W@a@|Lkr1X2;6E{-7; zjL8c)R4g;aE2Kl&qs4yAxY8DNP%v?BKSLZ>!VbHDFeXs@iqqxu+3AlJHv8S#xIP!}`0-4Rr|j!f-CGQA zA5M