From db1e677a45c39fe11167c79f857e0fad51ba5923 Mon Sep 17 00:00:00 2001 From: sys4-fr Date: Sat, 8 Sep 2018 16:48:11 +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 --- init.lua | 132 +++++++++++++++++++++++++++++++++++++++ oldinit.lua | 103 ++++++++++++++++++++++++++++++ textures/iron_sponge.png | Bin 0 -> 942 bytes textures/sponge.png | Bin 0 -> 942 bytes 4 files changed, 235 insertions(+) create mode 100644 init.lua create mode 100644 oldinit.lua create mode 100644 textures/iron_sponge.png create mode 100644 textures/sponge.png diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..f4b7099 --- /dev/null +++ b/init.lua @@ -0,0 +1,132 @@ +minetest.register_node("sponge:sponge", { + description = "Sponge", + drawtype = "normal", + tiles = {"sponge.png"}, + paramtype = 'light', + sunlight_propagates = true, + walkable = true, + pointable = true, + diggable = true, + buildable_to = false, + groups = {snappy=2, flammable=1}, +}) + +minetest.register_node("sponge:iron_sponge", { + description = "Iron Sponge", + drawtype = "normal", + tiles = {"iron_sponge.png"}, + paramtype = 'light', + sunlight_propagates = true, + walkable = true, + pointable = true, + diggable = true, + buildable_to = false, + groups = {cracky=2}, +}) + + +minetest.register_node("sponge:fake_air", { + description = "Fake Air", + drawtype = "airlike", + paramtype = 'light', + sunlight_propagates = true, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + groups = {not_in_creative_inventory=1}, +}) + +minetest.register_abm({ + nodenames = {"default:water_source", "default:water_flowing"}, + neighbors = {"sponge:sponge", "sponge:iron_sponge"}, + interval = 1.0, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + minetest.env:add_node(pos, {name="sponge:fake_air"}) + end +}) + +minetest.register_abm( +{nodenames = {"sponge:sponge"}, +interval = 1.0, +chance = 1, +action = function(pos, node, active_object_count, active_object_count_wider) + for i=-1,1 do + for j=-1,1 do + for k=-1,1 do + p = {x=pos.x+i, y=pos.y+j, z=pos.z+k} + n = minetest.env:get_node(p) + if (n.name=="default:water_flowing") + or (n.name == "default:water_source") then + minetest.env:add_node(p, {name="sponge:fake_air"}) + end + end + end + end +end +}) + +minetest.register_abm( +{nodenames = {"sponge:iron_sponge"}, +interval = 1.0, +chance = 1, +action = function(pos, node, active_object_count, active_object_count_wider) + for i=-2,2 do + for j=-2,2 do + for k=-2,2 do + p = {x=pos.x+i, y=pos.y+j, z=pos.z+k} + n = minetest.env:get_node(p) + if (n.name=="default:water_flowing") + or (n.name == "default:water_source") + or (n.name == "default:lava_source") + or (n.name == "default:lava_flowing") then + minetest.env:add_node(p, {name="sponge:fake_air"}) + end + end + end + end +end +}) + +minetest.register_abm( +{nodenames = {"sponge:fake_air"}, +interval = 1.0, +chance = 1, +action = function(pos, node, active_object_count, active_object_count_wider) + spongecount=0 + for i=-2,2 do + for j=-2,2 do + for k=-2,2 do + p = {x=pos.x+i, y=pos.y+j, z=pos.z+k} + n = minetest.env:get_node(p) + if (n.name=="sponge:iron_sponge") or (n.name == "sponge:sponge") then + spongecount=spongecount+1 + end + end + end + end + if (spongecount==0) then + minetest.env:add_node(pos, {name="air"}) + end +end +}) + +minetest.register_craft({ + output = "sponge:sponge", + recipe = { + {'default:leaves', 'default:leaves', 'default:leaves'}, + {'default:leaves', 'default:mese', 'default:leaves'}, + {'default:leaves', 'default:leaves', 'default:leaves'}, + } +}) + +minetest.register_craft({ + output = "sponge:iron_sponge", + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'sponge:sponge', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } +}) + diff --git a/oldinit.lua b/oldinit.lua new file mode 100644 index 0000000..49c6844 --- /dev/null +++ b/oldinit.lua @@ -0,0 +1,103 @@ +minetest.register_node("sponge:sponge", { + description = "Sponge", + drawtype = "normal", + tiles = {"sponge.png"}, + paramtype = 'light', + sunlight_propagates = true, + walkable = true, + pointable = true, + diggable = true, + buildable_to = false, + groups = {snappy=2, flammable=1}, + after_destruct = function(pos) + for i=-1,1 do + for j=-1,1 do + for k=-1,1 do + p = {x=pos.x+i, y=pos.y+j, z=pos.z+k} + n = minetest.env:get_node(p) + if (n.name=="sponge:fake_air") then + minetest.env:add_node(p, {name="air"}) + end + end + end + end + end, +}) + +minetest.register_node("sponge:iron_sponge", { + description = "Iron Sponge", + drawtype = "normal", + tiles = {"iron_sponge.png"}, + paramtype = 'light', + sunlight_propagates = true, + walkable = true, + pointable = true, + diggable = true, + buildable_to = false, + groups = {cracky=2}, + after_destruct = function(pos) + for i=-1,1 do + for j=-1,1 do + for k=-1,1 do + p = {x=pos.x+i, y=pos.y+j, z=pos.z+k} + n = minetest.env:get_node(p) + if (n.name=="sponge:fake_air") then + minetest.env:add_node(p, {name="air"}) + end + end + end + end + end, +}) + + +minetest.register_node("sponge:fake_air", { + description = "Fake Air", + drawtype = "airlike", + paramtype = 'light', + sunlight_propagates = true, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + groups = {not_in_creative_inventory=1}, +}) + +minetest.register_abm({ + nodenames = {"default:water_source", "default:water_flowing"}, + neighbors = {"sponge:sponge", "sponge:iron_sponge"}, + interval = 1.0, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + minetest.env:add_node(pos, {name="sponge:fake_air"}) + end +}) + +minetest.register_abm({ + nodenames = {"default:lava_source", "default:lava_flowing"}, + neighbors = {"sponge:iron_sponge"}, + interval = 1.0, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + minetest.env:add_node(pos, {name="sponge:fake_air"}) + end +}) + +minetest.register_craft({ + output = "sponge:sponge", + recipe = { + {'default:leaves', 'default:leaves', 'default:leaves'}, + {'default:leaves', 'default:mese', 'default:leaves'}, + {'default:leaves', 'default:leaves', 'default:leaves'}, + } +}) + +minetest.register_craft({ + output = "sponge:iron_sponge", + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'sponge:sponge', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } +}) + diff --git a/textures/iron_sponge.png b/textures/iron_sponge.png new file mode 100644 index 0000000000000000000000000000000000000000..55296b0c002f1a7e8fab2f9d519ab09f7ee015d5 GIT binary patch literal 942 zcmZuwOK%cU6ut-r3QPfqmXPwt$1?svcQxF=`U=0ZWv;4lzE zIAPi!#%`gX{t)z&r%PUJs?~7NN7g^|rEqA!JH5C{h>@qCiadMX4Nw;qW&^qnmD6l; zaEY-SfO?{Vh3M3s<>kmqluX@=T#rU>y6)eOF1doj?A-jr4m%<0UcrCv;$WxBqRvUG z2Wu-de!JGnTascLHWMq~k;@kUoc4EGVN3LStxnhG@pw#}L6W3n$B*J_K785h9cgiB z23&lLZ2$tVUaMEDb=WR<-*!5~c%@PW258Adf@WZB7<;>Au+_h1YcmaA|G)qia|0X5 zen~UI5bDO=#Mq?8%DLTc*k8ZIuvl#@PxH|%2GiXRTQ-xg*QCF}mfg%SG<0Hkc#xr6 z$qZwk_X({Kh{EiqgP4rR6F(Tl3V{9Y(;Mi}%mwINwtxm=QHP1~Gm4~?_o|(CD~_xO zqo>DrG6fu8zIuV2XvV3NbUf6Pfsvj3Hfb~fDYBv{4G1noF^+B_WWTdFpQE1TN)c_O z8Oo&!>wvB6u>Wk()@9LXG{7NReOpr8WHw7k9S{~8rOUGXU5w?jyY3@SAUN_okIYvu z-Qvs!EPw~J73lwh+5p0tW?;j^NSK@!+i29IHhT{yo>KQ8ol2!@H99{KnN%v(pLn|2 wYAO~=R~91gKfaYD8CPfn^uHw`Dr*4sK1fC%f0hsr;$kLNtEe$9(ouJJ@Sq|jt+bM!S3Gs6H*n!@Jg`r?!B9p ztjzy1SXJ#oT`s3*GRJjwPWaUJ_OdP)A$86O!;bz{ns#KhTFc5z@HaLNyk41QS@;fz87u1R>#r0kVP7)CFyQO@nayTe zSs{Y7wc#dAHmggL`9Gzpsn6hz#O!Q(clRWbAbbGD00sE6EOH!sNrzNQbGs!`6aczt z#SY8M`%6n1ny#sFQuOrnR~p&cI>MlSv7oWh(bQBFkrF_kPZ%qO_J