From cbcdbf8f0b8080f3a10ed508603331da02a0811d Mon Sep 17 00:00:00 2001 From: Maciej Kasatkin Date: Thu, 11 Oct 2012 18:23:30 +0200 Subject: [PATCH] Added Lava Can --- cans.lua | 125 +++++++++++++++++++++++++++++++++ init.lua | 2 +- textures/technic_lava_can.png | Bin 0 -> 1045 bytes textures/technic_water_can.png | Bin 1420 -> 1041 bytes water_can.lua | 62 ---------------- 5 files changed, 126 insertions(+), 63 deletions(-) create mode 100644 cans.lua create mode 100644 textures/technic_lava_can.png delete mode 100644 water_can.lua diff --git a/cans.lua b/cans.lua new file mode 100644 index 0000000..e4a94c1 --- /dev/null +++ b/cans.lua @@ -0,0 +1,125 @@ +water_can_max_load = 16 +lava_can_max_load = 8 + +minetest.register_craft({ + output = 'technic:water_can 1', + recipe = { + {'technic:zinc_ingot', 'technic:rubber','technic:zinc_ingot'}, + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'technic:zinc_ingot', 'default:steel_ingot', 'technic:zinc_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:lava_can 1', + recipe = { + {'technic:zinc_ingot', 'technic:stainless_steel_ingot','technic:zinc_ingot'}, + {'technic:stainless_steel_ingot', '', 'technic:stainless_steel_ingot'}, + {'technic:zinc_ingot', 'technic:stainless_steel_ingot', 'technic:zinc_ingot'}, + } +}) + + +minetest.register_tool("technic:water_can", { + description = "Water Can", + inventory_image = "technic_water_can.png", + stack_max = 1, + liquids_pointable = true, + on_use = function(itemstack, user, pointed_thing) + + if pointed_thing.type ~= "node" then + return end + + n = minetest.env:get_node(pointed_thing.under) + if n.name == "default:water_source" then + item=itemstack:to_table() + local load=tonumber((item["wear"])) + if load==0 then load =65535 end + load=get_RE_item_load(load,water_can_max_load) + if load+1<17 then + minetest.env:add_node(pointed_thing.under, {name="air"}) + load=load+1; + load=set_RE_item_load(load,water_can_max_load) + item["wear"]=tostring(load) + itemstack:replace(item) + end + return itemstack + end + item=itemstack:to_table() + load=tonumber((item["wear"])) + if load==0 then load =65535 end + load=get_RE_item_load(load,water_can_max_load) + if load==0 then return end + + if n.name == "default:water_flowing" then + minetest.env:add_node(pointed_thing.under, {name="default:water_source"}) + load=load-1; + load=set_RE_item_load(load,water_can_max_load) + item["wear"]=tostring(load) + itemstack:replace(item) + return itemstack + end + + n = minetest.env:get_node(pointed_thing.above) + if n.name == "air" then + minetest.env:add_node(pointed_thing.above, {name="default:water_source"}) + load=load-1; + load=set_RE_item_load(load,water_can_max_load) + item["wear"]=tostring(load) + itemstack:replace(item) + return itemstack + end + end, +}) + +minetest.register_tool("technic:lava_can", { + description = "Lava Can", + inventory_image = "technic_lava_can.png", + stack_max = 1, + liquids_pointable = true, + on_use = function(itemstack, user, pointed_thing) + + if pointed_thing.type ~= "node" then + return end + + n = minetest.env:get_node(pointed_thing.under) + if n.name == "default:lava_source" then + item=itemstack:to_table() + local load=tonumber((item["wear"])) + if load==0 then load =65535 end + load=get_RE_item_load(load,lava_can_max_load) + if load+1<9 then + minetest.env:add_node(pointed_thing.under, {name="air"}) + load=load+1; + load=set_RE_item_load(load,water_can_max_load) + item["wear"]=tostring(load) + itemstack:replace(item) + end + return itemstack + end + item=itemstack:to_table() + load=tonumber((item["wear"])) + if load==0 then load =65535 end + load=get_RE_item_load(load,water_can_max_load) + if load==0 then return end + + if n.name == "default:lava_flowing" then + minetest.env:add_node(pointed_thing.under, {name="default:lava_source"}) + load=load-1; + load=set_RE_item_load(load,water_can_max_load) + item["wear"]=tostring(load) + itemstack:replace(item) + return itemstack + end + + n = minetest.env:get_node(pointed_thing.above) + if n.name == "air" then + minetest.env:add_node(pointed_thing.above, {name="default:lava_source"}) + load=load-1; + load=set_RE_item_load(load,water_can_max_load) + item["wear"]=tostring(load) + itemstack:replace(item) + return itemstack + end + end, +}) diff --git a/init.lua b/init.lua index 5504b29..e931bdf 100644 --- a/init.lua +++ b/init.lua @@ -45,7 +45,7 @@ dofile(minetest.get_modpath("technic").."/node_breaker.lua") dofile(minetest.get_modpath("technic").."/deployer.lua") dofile(minetest.get_modpath("technic").."/tree_tap.lua") dofile(minetest.get_modpath("technic").."/flashlight.lua") -dofile(minetest.get_modpath("technic").."/water_can.lua") +dofile(minetest.get_modpath("technic").."/cans.lua") function has_locked_chest_privilege(meta, player) diff --git a/textures/technic_lava_can.png b/textures/technic_lava_can.png new file mode 100644 index 0000000000000000000000000000000000000000..80d15a62375b1eb164cd8d9b161d6abadc83ee98 GIT binary patch literal 1045 zcmV+w1nT>VP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RX3JVYkAi@*Tr2qf}r%6OXR9M5s zmrZCLRTRg6=gz(JX5PF>UtW{&0x?EI0;Zzi$JT`)U8qG66kHXf%Whn_c9E4!U07WB z0Y!A7h)59?bfE|$2;GPw(Do&5Y^vD4qe9SB~+EhPMfdJY|4QcSe_~A(Mv*zu%dMV`1#une)@Xv`O)J?H7o?ESHj3}<>C%W zY6;^Q2z$mh{T5%5BN|^)90e?8UKi1O?svMiv3u*AW+TIehOiJYRw+=PjLA9)%|=eU zX*hmzUWaDjyFx&q0pmG%-KI7lQA`D&djJ+6Ni>WCvbLu>o3Ojnp_n?94tX1(jj?Wc z5!N5Gw6A4ctr%t&#t7GI)PJ=U6J=`7su3t12~ZW**S49SD`8zoS_Wf;Rucm8!vlEW z@kwrMXEb*`?PiDFR*|%b~_&q!18NL zdig?~X2Y|2{yOD}h}v3<`yQ?^R!Q(a$GScG!#E%+f(eA%CGRsG4#36LI#~uTGAM>p z*)enP1X<=Orh+jJ5fEeO)%0Jy-`x{>c0u*-nAQzN^MFdVgmsqjDXi0%z_xyVcW|`-ALl)O5{2Rq5s8_4oduJQW=f z0H9sum3-1-j z$9L{XsAd$sY`oww2ttmI4uI~lK0qA>CxVKO7C`qNxXrL6Ah@ZOTy?Z15Yr!m6WJ3h zik-3q!QeLCw+l=k0M;3@1a?kDh!Ii)t8Z^|?9>dMR(@~>OrLC8XX@xv$-mw$yj11K zH){jwXMhrPpWD6G!9Vd|yY&i7Pfrq9836-bwp|gyec8ZO_OD`C4e_}iY&R5~w9YBhtWEvlm`n(Ct54w*VAk%h`9<4}30@!@eCG4te|qNL^oOjx_rC P00000NkvXXu0mjf`;^}n literal 0 HcmV?d00001 diff --git a/textures/technic_water_can.png b/textures/technic_water_can.png index 411e91fd24d572475cf4aeaeb09e379ad576f804..18e0225b4d3ddd2c78644b528f264d47096fa6f0 100644 GIT binary patch delta 976 zcmV;>126oH3y}zrPk#^Ws(b8oI-y77 zI3^@u6c;`g?j%MA84?LX7OsR*Hwuc2tX;SjK^%N690Zp}V;o|@@v%^{5d@bSn51V+ z%p{O`ch~D47ab>2rytYPGIvu@b?V%|{`$}P&lOc=Czl;Wl7I1ud)0WBBnB}KT*|qr zdFka{>6d|*-a4$t6Mp?^feX{uW#qw}HrG<(&~fOIUDQU3s49)sh;KfBn15g2h-o$w{EQ)!^%$yTDeuXX!~xAlO4Kxry>LML20*w5&OzLS^(80_ zQ7HKYLoMb@Msb1XDF4y7$IzeC$4`04}Txo!`ezhbKMa&W7fk0rLuCZ zzDjMhM0Ge%u3(9pjvQL5zTbeBcvBeKIid=3%{ZX_;ojadmcyay3W&V#ouJ zRv4-TIG195k0f$r@*cSY7*F`OJ;Z3oB7p|rAesX%}jLS_J4B`{EXqp{jYIs_w=CbSWs<&K^48D zsXetk$+y*4n3;VNGCA;l2m{8055e?SB|Rvsvy6|fOhTy)g(BpO5Qke5su@TzyOa$z zZgIZotO4yYpYg!6t*c81$$-++pY-f)CY%ng69O$)>l$=NOl<`3mT(6Gz;pp%eFI_4 zSbz32#0VyavrET$?w+rS!*u&1G+t)_=U1QQ>HL|0+&fnJiqn5Q(-RBbXTlB<>x=Q` zMWHYje~xEm01UKg_9DWC!by&1zu4SKYZ+Xs+jBz^X)8iiZM*s3D<4?Synjjh7NPYG zY3i_TaH{ejH_Qc=)9=pqJgxL}GCKLj0ZEO+lq7P5jg&NX8&)g=`I6=A2lc*2q@Isv y&!0M|D>uUp0NK3d+{bg}4o&%|%m4rd9!W$&R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--- a/water_can.lua +++ /dev/null @@ -1,62 +0,0 @@ -water_can_max_load = 16 - -minetest.register_craft({ - output = 'technic:water_can 1', - recipe = { - {'technic:zinc_ingot', 'technic:rubber','technic:zinc_ingot'}, - {'default:steel_ingot', '', 'default:steel_ingot'}, - {'technic:zinc_ingot', 'default:steel_ingot', 'technic:zinc_ingot'}, - } -}) - -minetest.register_tool("technic:water_can", { - description = "Water Can", - inventory_image = "technic_water_can.png", - stack_max = 1, - liquids_pointable = true, - on_use = function(itemstack, user, pointed_thing) - - if pointed_thing.type ~= "node" then - return end - - n = minetest.env:get_node(pointed_thing.under) - if n.name == "default:water_source" then - item=itemstack:to_table() - local load=tonumber((item["wear"])) - if load==0 then load =65535 end - load=get_RE_item_load(load,water_can_max_load) - if load+1<17 then - minetest.env:add_node(pointed_thing.under, {name="air"}) - load=load+1; - load=set_RE_item_load(load,water_can_max_load) - item["wear"]=tostring(load) - itemstack:replace(item) - end - return itemstack - end - item=itemstack:to_table() - load=tonumber((item["wear"])) - if load==0 then load =65535 end - load=get_RE_item_load(load,water_can_max_load) - if load==0 then return end - - if n.name == "default:water_flowing" then - minetest.env:add_node(pointed_thing.under, {name="default:water_source"}) - load=load-1; - load=set_RE_item_load(load,water_can_max_load) - item["wear"]=tostring(load) - itemstack:replace(item) - return itemstack - end - - n = minetest.env:get_node(pointed_thing.above) - if n.name == "air" then - minetest.env:add_node(pointed_thing.above, {name="default:water_source"}) - load=load-1; - load=set_RE_item_load(load,water_can_max_load) - item["wear"]=tostring(load) - itemstack:replace(item) - return itemstack - end - end, -})