From 739c38dd71a12a3d6c2827afbffcc69d6b62e554 Mon Sep 17 00:00:00 2001 From: sys4-fr Date: Fri, 7 Sep 2018 20:35:46 +0200 Subject: [PATCH] =?UTF-8?q?Remplissage=20du=20d=C3=A9p=C3=B4t.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 +++ depends.txt | 1 + init.lua | 85 ++++++++++++++++++ textures/eventobjects_spleef_shovel.png | Bin 0 -> 295 bytes textures/eventobjects_surprise_node.png | Bin 0 -> 173 bytes .../eventobjects_surprise_node_animated.png | Bin 0 -> 622 bytes textures/eventobjects_surprise_node_top.png | Bin 0 -> 137 bytes 7 files changed, 97 insertions(+) create mode 100755 README.md create mode 100755 depends.txt create mode 100755 init.lua create mode 100644 textures/eventobjects_spleef_shovel.png create mode 100644 textures/eventobjects_surprise_node.png create mode 100644 textures/eventobjects_surprise_node_animated.png create mode 100644 textures/eventobjects_surprise_node_top.png diff --git a/README.md b/README.md new file mode 100755 index 0000000..2ca7e46 --- /dev/null +++ b/README.md @@ -0,0 +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) diff --git a/depends.txt b/depends.txt new file mode 100755 index 0000000..331d858 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/init.lua b/init.lua new file mode 100755 index 0000000..b46e604 --- /dev/null +++ b/init.lua @@ -0,0 +1,85 @@ +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}, + }, +}) + +minetest.register_node("eventobjects:surprise_node", { + description = "'?' block", + 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 = "eventobjects_surprise_node_animated.png", + backface_culling=false, + animation={type = "vertical_frames", aspect_w= 16, aspect_h = 16, length = 0.6} + }, + { + image = "eventobjects_surprise_node_animated.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) + 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 + end + end + minetest.remove_node(pos) + end, +}) diff --git a/textures/eventobjects_spleef_shovel.png b/textures/eventobjects_spleef_shovel.png new file mode 100644 index 0000000000000000000000000000000000000000..b680bc1170e773979235af0d7a42c1baf977eb54 GIT binary patch literal 295 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyegQrqu0R?H*qE6l1O-%OY&4CW z^fbjx?L#fJqHL{`?YvW*Z1`M)a$W5dy)7#I;~RogT4REBVj`xdM2V(XFUhK3RULDz zy6jkMg>2`N+Y9&IehD;=u_VYZn8D%MjWi&q-P6S}q=ND2S>JUn3IeVVvt#QgurG=@ z_WYmuEwyFo0XvfVxl-~FG>z_YEH*ZuTI<^Jl^i(fvT m|Fr0LhD8*g;onM*xHrtKT^v6JbiTa-`Pb9c&t;ucLK6TQ`Ef`9 literal 0 HcmV?d00001 diff --git a/textures/eventobjects_surprise_node.png b/textures/eventobjects_surprise_node.png new file mode 100644 index 0000000000000000000000000000000000000000..66b65c496091e6420470c70e7830c87c5a40f3df GIT binary patch literal 173 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!M1W6-E0FecV(@oj2ykWya%Bkf zWSCaZuzwLl)Y_L9fN}wzE{-7;jIG_?Vl0XrM;;x2^v_%_z-{;460_7#Ek%xw{2vsI zIo&_ba#XQ$^qV4i=9P3E805!ZQnX|n!080zke4cH5AeV^y(O1urTct S<8lO=&EV;`MGhY=ngA<@D#&R$Sf-quGN+#yH;<(%4LGRO?eBJT>mf60$ZxvH~(nezgysY z3&k1QZ_$!l@@LW7PptY=J5~Ptosa*_0}!_W2q8gQ;QW)o7C?;04N%#G@kkInn83r* zHxEFZ0T4ohw7~f%fh~Y={2QP`Xh6%pC4ts{V%a{XSS30O7yA z0V*b#`>_>sKbUCu0}#b)4?qA?E<%EE?)<$C00Ba%zk$jzIPV7_4z1$^9+tj%01|l? zKnT|$j!6Ir5Kj9OsB|Gc0KtO^JZ$NU2Oye(grYm{RnQpDAe`kIXbina#e<2?!!JFg z8A$XXq44pzmqA15Kmf{h14QUODjrNU4?x~{%t6A(@bLYiA#@-B<+=eP#NctB(032b zLBbu#v-gKJgd+$*xgG!o9zQ1rk9g}LK;jG%?m?ctKde4OoG`02p%^;1a}_Q#)Anw0J-q^2X!z)k#O#cvj6}907*qo IM6N<$f<&|Z%m4rY literal 0 HcmV?d00001 diff --git a/textures/eventobjects_surprise_node_top.png b/textures/eventobjects_surprise_node_top.png new file mode 100644 index 0000000000000000000000000000000000000000..f9e39c06bbd7ed88087f075097884d6d5b148afe GIT binary patch literal 137 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPGa2=EDU1=4;_4E|0G0nQ9Tt_)$G z4Abfv_Ag?HTKn<>P)^6w#W92pde1sE@(Z)z4*}Q$iB}MBXC% literal 0 HcmV?d00001