From a550e170bf6f55d866fbcf6e12591d352d1fa7d6 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Mon, 20 Apr 2015 20:12:11 +0200 Subject: [PATCH 1/7] Added basic files for new mod --- mods/eventobjects/README.md | 2 ++ mods/eventobjects/init.lua | 0 2 files changed, 2 insertions(+) create mode 100644 mods/eventobjects/README.md create mode 100644 mods/eventobjects/init.lua diff --git a/mods/eventobjects/README.md b/mods/eventobjects/README.md new file mode 100644 index 00000000..7bf186cc --- /dev/null +++ b/mods/eventobjects/README.md @@ -0,0 +1,2 @@ +Events' Objects mod by Ataron and Mg +#################################### diff --git a/mods/eventobjects/init.lua b/mods/eventobjects/init.lua new file mode 100644 index 00000000..e69de29b From c92f1facb26d30d520bd9fc3b895ce35440dab2a Mon Sep 17 00:00:00 2001 From: Ataron Date: Mon, 20 Apr 2015 20:33:44 +0200 Subject: [PATCH 2/7] Add EventObjects --- mods/eventobjects/depends.txt | 1 + mods/eventobjects/init.lua | 14 ++++++++++++++ .../textures/eventobjects_spleef_shovel.png.png | Bin 0 -> 558 bytes 3 files changed, 15 insertions(+) create mode 100644 mods/eventobjects/depends.txt create mode 100644 mods/eventobjects/textures/eventobjects_spleef_shovel.png.png diff --git a/mods/eventobjects/depends.txt b/mods/eventobjects/depends.txt new file mode 100644 index 00000000..331d858c --- /dev/null +++ b/mods/eventobjects/depends.txt @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/mods/eventobjects/init.lua b/mods/eventobjects/init.lua index e69de29b..31ed3641 100644 --- a/mods/eventobjects/init.lua +++ b/mods/eventobjects/init.lua @@ -0,0 +1,14 @@ +minetest.register_tool("eventobjects:spleef_shovel", { + description = "Golden Spleef Shovel", + inventory_image = "eventobjects_spleef_shovel.png", + wield_image = "eventobjects_spleef_shovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + unbreakable={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3}, + crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.40}, uses=0, maxlevel=3}, + }, + damage_groups = {fleshy=4}, + }, +}) \ No newline at end of file diff --git a/mods/eventobjects/textures/eventobjects_spleef_shovel.png.png b/mods/eventobjects/textures/eventobjects_spleef_shovel.png.png new file mode 100644 index 0000000000000000000000000000000000000000..735ee35d18ede41bdc7344c33da056ca7de33f05 GIT binary patch literal 558 zcmV+}0@3}6P)WFU8GbZ8()Nlj2>E@cM*00ELoL_t(o!|jznPr^VL zho4@Gk~5gNKrpfx7Z#U(1V0e*lMud%qaVQa92{g)2aN^>q7u(aNb68qde9=!KQ6p$ zulGFf@4d^xt_rMXx92yzJ%802t0*wQUb~Hu5?86{+uLQwDoh{__O%WGQX-^eIvn7A zX}rRSlDiw_(a{_5_Ativ3MwmprL{zOQE0_dd>^_$f0K8x0SB^lPcZ?+BaFH^S%nA56_#A@U zf*%+3JvevsB$7^kZV7~N&Y-#vm2Wt{2%3s_J{=BH_Yir&0r-G}(|Mxd?U)V+OdcK+ zyWe^QNpP!a?iGIp)8JbPtOMVqtp9{>Bv1r=ZGocTYY7wy|5Ko7_)38?;Hd&-!4n0_ wgf9t{4L1b-1D^gEl>}cF_ylgtgYOF97qDdaYLs&`5&!@I07*qoM6N<$f-4r?A^-pY literal 0 HcmV?d00001 From bcd117140494779fad595f69bd120414814f6218 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Tue, 21 Apr 2015 16:28:10 +0200 Subject: [PATCH 3/7] Added '?' block texture --- ...vel.png.png => eventobjects_spleef_shovel.png} | Bin .../textures/eventobjects_unkown_node.png | Bin 0 -> 256 bytes 2 files changed, 0 insertions(+), 0 deletions(-) rename mods/eventobjects/textures/{eventobjects_spleef_shovel.png.png => eventobjects_spleef_shovel.png} (100%) create mode 100644 mods/eventobjects/textures/eventobjects_unkown_node.png diff --git a/mods/eventobjects/textures/eventobjects_spleef_shovel.png.png b/mods/eventobjects/textures/eventobjects_spleef_shovel.png similarity index 100% rename from mods/eventobjects/textures/eventobjects_spleef_shovel.png.png rename to mods/eventobjects/textures/eventobjects_spleef_shovel.png diff --git a/mods/eventobjects/textures/eventobjects_unkown_node.png b/mods/eventobjects/textures/eventobjects_unkown_node.png new file mode 100644 index 0000000000000000000000000000000000000000..b670afe6be9bbd82f36ab03a5ab3a1ffbcb02fb8 GIT binary patch literal 256 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP~izu(WsOXX!L7 zI^&TOGZVw{lfv@nI%FyWFCTGqF{|yI=za3Uzwc8!7IeOpU$o|>$g1A;N77q8{2M#J u)_3MC-1ItO`?I$kFAZzMXWA{(%3JCv|9JM Date: Tue, 21 Apr 2015 23:30:34 +0200 Subject: [PATCH 4/7] Added basic code of '?' block --- mods/eventobjects/init.lua | 36 +++++++++++++++++- ...ode.png => eventobjects_surprise_node.png} | Bin 2 files changed, 35 insertions(+), 1 deletion(-) rename mods/eventobjects/textures/{eventobjects_unkown_node.png => eventobjects_surprise_node.png} (100%) diff --git a/mods/eventobjects/init.lua b/mods/eventobjects/init.lua index 31ed3641..3af6cbfb 100644 --- a/mods/eventobjects/init.lua +++ b/mods/eventobjects/init.lua @@ -11,4 +11,38 @@ minetest.register_tool("eventobjects:spleef_shovel", { }, damage_groups = {fleshy=4}, }, -}) \ No newline at end of file +}) + +minetest.register_node("eventobjects:surprise_node", { + description = "'?' block", + tiles = {"eventobjects_surprise_node.png"}, + inventory_image = "eventobjects_surprise_node.png", + wield_image = "eventobjects_surprise_node.png", +}) + +minetest.after(1,function() + minetest.override_item("eventobjects:surprise_node", { + on_punch = function(pos, node, puncher, pointed_things) + -- Spawn betweek 5 and 20 random nodes + for cnt = 1,math.random(5,20) do + local item = "" + local random_num = math.random(1,#minetest.registered_items)+math.random(-cnt,cnt) + if random_num <= 0 then random_num = 1 end + local random_count = 1 + for key, value in pairs(minetest.registered_items) do + if random_count == random_num then + item = key + break + end + random_count = random_count + 1 + end + print(table.getn(minetest.registered_items)) + local s_count = math.random(1,minetest.registered_items[item].max_count or 99) + local obj = minetest.spawn_item({x=pos.x, y = pos.y + 1,z=pos.z},{name = item, count = s_count}) + if not obj then return end + obj:setvelocity({x = 0, y = math.random(2,9), z = 0}) + end + minetest.remove_node(pos) + end, + }) +end) diff --git a/mods/eventobjects/textures/eventobjects_unkown_node.png b/mods/eventobjects/textures/eventobjects_surprise_node.png similarity index 100% rename from mods/eventobjects/textures/eventobjects_unkown_node.png rename to mods/eventobjects/textures/eventobjects_surprise_node.png From e0febced46569239dff051c58c62701896d36091 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Wed, 22 Apr 2015 14:14:35 +0200 Subject: [PATCH 5/7] Changed random selecting to simple 'all dropped' behavior - '?' nodes now drop eveything they have --- mods/eventobjects/init.lua | 76 +++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/mods/eventobjects/init.lua b/mods/eventobjects/init.lua index 3af6cbfb..1bb75b24 100644 --- a/mods/eventobjects/init.lua +++ b/mods/eventobjects/init.lua @@ -18,31 +18,55 @@ minetest.register_node("eventobjects:surprise_node", { tiles = {"eventobjects_surprise_node.png"}, inventory_image = "eventobjects_surprise_node.png", wield_image = "eventobjects_surprise_node.png", -}) - -minetest.after(1,function() - minetest.override_item("eventobjects:surprise_node", { - on_punch = function(pos, node, puncher, pointed_things) - -- Spawn betweek 5 and 20 random nodes - for cnt = 1,math.random(5,20) do - local item = "" - local random_num = math.random(1,#minetest.registered_items)+math.random(-cnt,cnt) - if random_num <= 0 then random_num = 1 end - local random_count = 1 - for key, value in pairs(minetest.registered_items) do - if random_count == random_num then - item = key - break - end - random_count = random_count + 1 + groups = {oddly_breakable_by_hand = 2}, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + meta:set_string("infotext","?") + meta:set_string("formspec", + "size[11,12]" .. + "list[current_name;main;0.45,0.45;10,7;]" .. + "list[current_player;main;1.45,8;8,4;]" + ) + inv:set_size("main",70) + end, + allow_metadata_inventory_put = function(pos, to_list, to_index, stack, player) + if player and minetest.check_player_privs(player:get_player_name(),{server=true}) then + return stack:get_count() + else + return 0 + end + end, + allow_metadata_inventory_take = function(pos, from_list, from_index, stack, player) + print(from_list) + print(from_index) + if player and minetest.check_player_privs(player:get_player_name(),{server=true}) then + return stack:get_count() + else + return 0 + end + end, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + + end, + on_punch = function(pos, node, puncher, pointed_things) + -- Spawn betweek 5 and 20 random nodes + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + if inv:is_empty("main") then + minetest.chat_send_player(puncher:get_player_name(),"Cannot spread items, inventory empty") + return + end + for cnt = 1,70 do + local stack = inv:get_stack("main",cnt) + if stack:get_name() ~= "" then + local obj = minetest.spawn_item({x=pos.x, y = pos.y + 1,z=pos.z},stack) + inv:remove_item("main",stack) + if obj then + obj:setvelocity({x = math.random(-0.4,0.4), y = math.random(2,9), z = math.random(-0.4,0.4)}) end - print(table.getn(minetest.registered_items)) - local s_count = math.random(1,minetest.registered_items[item].max_count or 99) - local obj = minetest.spawn_item({x=pos.x, y = pos.y + 1,z=pos.z},{name = item, count = s_count}) - if not obj then return end - obj:setvelocity({x = 0, y = math.random(2,9), z = 0}) end - minetest.remove_node(pos) - end, - }) -end) + end + minetest.remove_node(pos) + end, +}) From 9e3dbe86e8d87fce50801a7c9ae697d12a4eea04 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Wed, 22 Apr 2015 21:34:56 +0200 Subject: [PATCH 6/7] Added animated texture for '?' nodes - Added eventobjects_surprise_node_animated.jpg by @Ataron - Added eventobjects_surprise_node_top.jpg - Added animation code into init.lua --- mods/eventobjects/init.lua | 19 +++++++++++++++--- .../eventobjects_surprise_node_animated.png | Bin 0 -> 857 bytes .../eventobjects_surprise_node_top.png | Bin 0 -> 194 bytes 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 mods/eventobjects/textures/eventobjects_surprise_node_animated.png create mode 100644 mods/eventobjects/textures/eventobjects_surprise_node_top.png diff --git a/mods/eventobjects/init.lua b/mods/eventobjects/init.lua index 1bb75b24..9c57b131 100644 --- a/mods/eventobjects/init.lua +++ b/mods/eventobjects/init.lua @@ -15,9 +15,22 @@ minetest.register_tool("eventobjects:spleef_shovel", { minetest.register_node("eventobjects:surprise_node", { description = "'?' block", - tiles = {"eventobjects_surprise_node.png"}, - inventory_image = "eventobjects_surprise_node.png", - wield_image = "eventobjects_surprise_node.png", + inventory_image = minetest.inventorycube("eventobjects_surprise_node.png"), + tiles = { + "eventobjects_surprise_node_top.png", "eventobjects_surprise_node_top.png", {name = "eventobjects_surprise_node_animated.png", animation={type = "vertical_frames", aspect_w= 16, aspect_h = 16, length = 1.5}} + }, + special_tiles = { + { + image = "blocmario.png", + backface_culling=false, + animation={type = "vertical_frames", aspect_w= 16, aspect_h = 16, length = 0.6} + }, + { + image = "blocmario.png", + backface_culling=true, + animation={type = "vertical_frames", aspect_w= 16, aspect_h = 16, length = 0.6} + } + }, groups = {oddly_breakable_by_hand = 2}, on_construct = function(pos) local meta = minetest.get_meta(pos) diff --git a/mods/eventobjects/textures/eventobjects_surprise_node_animated.png b/mods/eventobjects/textures/eventobjects_surprise_node_animated.png new file mode 100644 index 0000000000000000000000000000000000000000..bfb4d5bb024f9921fc67f34a0109a97c25b52c78 GIT binary patch literal 857 zcmV-f1E&0mP)EK|00009a7bBm000XU z000XU0RWnu7ytkO2XskIMF-ym77Yk0wDfvZ0000TX;fHrLvL+uWo~o;00000Lvm$d zbY)~9cWHEJAV*0}P-HG;2LJ#9&q+ixE_LF zSK_ZYe$0$8657vef^Uy|cm~HMA%yVt%?G|>ZrTjeK_B$BhBFf$^=3BpO!Pj zgg&jzFhSU=r-Mf{kX{8et-d@!3MxnqO0C{sOd1oe!UKc}g7!ZxXOs#3S{Y@6SSo)W zJTigwDj;d~=Rp&PQewgwG3A(WB_7n6AWZ+$az>c2xYb3{ifkag3bnMx@Sur9(U>q! zOeqsK;z2}vUSk6N?o7+M#)N-hb!%xwOCY@prL@NJpov4tF=4Eja;MCYWn5wuns~O3H-sVtTdm)!r9MOc3VoIVRjf_?FoX4yKlmSqZ2I+b@0H$1WE7CGGQUBYh{9K6|zMf?+?5V#ci_M@WA6xcH@C%H6+~+ zV3{E3ImB*0(QS1F+2*Lu06B*UHIfS`t|Gb}3UUsyub8aQ#Z7n+b9(|vJ=E<$Ru6Ah zmu14d=Yr}`*czBuL2aZiN3Nk1+>duF6WWQXbT)Z+fAC5H{a&Fs1B*{keIhEV`BoP` zat%2Y3ljv{<`~0+CJx2IgtlU0n6T^rjTRaWNZ@ eFf*HpF(bo=c+OovJ*TFE%=UEkb6Mw<&;$Upw>1C& literal 0 HcmV?d00001 From 73ef7f0f38942b4968a391e1a87fd1c19d290ceb Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Wed, 22 Apr 2015 21:38:41 +0200 Subject: [PATCH 7/7] Updated README.md --- mods/eventobjects/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mods/eventobjects/README.md b/mods/eventobjects/README.md index 7bf186cc..2ca7e46f 100644 --- a/mods/eventobjects/README.md +++ b/mods/eventobjects/README.md @@ -1,2 +1,11 @@ Events' Objects mod by Ataron and Mg #################################### + +# Contributors + - Mg (@LeMagnesium) + - Ataron (@Ataron) + +# Medias +eventobjects_surprise_node.jpg by Mg (WTFPL) +eventobjects_surprise_node_top.jpg by Mg (WTFPL) +eventobjects_surprise_node_animated.jpg by Ataron (CC-BY-NC-SA)