From 927ed7d1572735bf982d3914aa948fc6cbfa2e11 Mon Sep 17 00:00:00 2001 From: Maciej Kasatkin Date: Sun, 2 Sep 2012 16:10:39 +0200 Subject: [PATCH] New machine: water mill --- electric.lua | 2 + init.lua | 1 + textures/technic_water_mill_side.png | Bin 0 -> 907 bytes textures/technic_water_mill_top.png | Bin 0 -> 828 bytes textures/technic_water_mill_top_active.png | Bin 0 -> 819 bytes water_mill.lua | 128 +++++++++++++++++++++ 6 files changed, 131 insertions(+) create mode 100644 textures/technic_water_mill_side.png create mode 100644 textures/technic_water_mill_top.png create mode 100644 textures/technic_water_mill_top_active.png create mode 100644 water_mill.lua diff --git a/electric.lua b/electric.lua index 172e73e..10e1e6c 100644 --- a/electric.lua +++ b/electric.lua @@ -513,6 +513,8 @@ if minetest.env:get_node(pos1).name == "technic:generator" then new_node_added= if minetest.env:get_node(pos1).name == "technic:generator_active" then new_node_added=add_new_cable_node(PR_nodes,pos1) end if minetest.env:get_node(pos1).name == "technic:geothermal" then new_node_added=add_new_cable_node(PR_nodes,pos1) end if minetest.env:get_node(pos1).name == "technic:geothermal_active" then new_node_added=add_new_cable_node(PR_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:water_mill" then new_node_added=add_new_cable_node(PR_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:water_mill_active" then new_node_added=add_new_cable_node(PR_nodes,pos1) end if minetest.env:get_node(pos1).name == "technic:electric_furnace" then new_node_added=add_new_cable_node(RE_nodes,pos1) end if minetest.env:get_node(pos1).name == "technic:electric_furnace_active" then new_node_added=add_new_cable_node(RE_nodes,pos1) end if minetest.env:get_node(pos1).name == "technic:tool_workshop" then new_node_added=add_new_cable_node(RE_nodes,pos1) end diff --git a/init.lua b/init.lua index a286350..fb7b8f6 100644 --- a/init.lua +++ b/init.lua @@ -34,6 +34,7 @@ dofile(minetest.get_modpath("technic").."/mining_laser_mk1.lua") dofile(minetest.get_modpath("technic").."/generator.lua") dofile(minetest.get_modpath("technic").."/solar_panel.lua") dofile(minetest.get_modpath("technic").."/geothermal.lua") +dofile(minetest.get_modpath("technic").."/water_mill.lua") function has_locked_chest_privilege(meta, player) diff --git a/textures/technic_water_mill_side.png b/textures/technic_water_mill_side.png new file mode 100644 index 0000000000000000000000000000000000000000..f4bdb167e6013f09e14ff8fad585d6d0d895fa16 GIT binary patch literal 907 zcmV;619bd}P)I%}X}c*NLMEMXm5$8%-B1 zW((4yBui7IE-=hCy>1sF1h1lqvM3NmrRW9$lW>gEG!74s$@83|D0zA?;>Ghn=yiK6 zcl#V2JtvyRG`famS-2e+?T7EbYcyR_*CnITF`*x@I-4SdhN=}U!(cw2lO!o=zt3u( zG5m0w*=&mIdPt+)#%LKle*7zE(;0eM^D>T+j)N)+8l}*L0HC?LBD`^f!_g5NH#hKo z4^dYYRb6pw^L^g!bus&W^mZE~2vB)W%lGNsy^FoJh9(4WrwcZ2zJu#JOs7+1Q5Ixb zMoUWSsvq`SJ_m*Aesig3s6AVtHqWYOx^CbM~JdVj2?Hwvc&IaX32WEPMq*ptswUaZDp5 zo*$sM4D!4neDZ{1GT~%tiT270^7lX4-TesRdmW_IX}_{|%y)tmGL@qZkec z2%#b7NlIQ+>s z8lu@8)ie}QguS+g^nD&Z8&QNI_Vw%JVTirHj=q>vRu!J-Q5FT#^F02!xZvckzxmg8 zY1EkH{G8()ojpEMWHs#X;>eW@O@fh2- za9#J!FuFiFHdh^wUK}wPY_doanz}-?bd7GXjOTY4Y~5xhOSymlGd|hx$uU zz;J7mejG8}9v~XfgJ(Q8+g?f8*6&ZE(QrbV}A-5MdWN9++lfe`-_lB4>nC_v~9=X@Jy0KOlLEU85svduLt7L=W=Zr`W`7I*&-td z0_v(lDkTxFLs=GBM%ub2j$&RfuY{9;#eBvwKT%ySy!qlS){dBQi6-H$49S z8xIc;6vc_%en;I_guWz>Vye0!TVzapkGi^0lm*gtk)B7IrpWzvgHnF$NO3yhV)*j@4y}7m<(YT4cPJ&0XoC$TEAx2<(z04+ zNU1pH1mScq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step>0 then + charge=charge+load_step + meta:set_float("internal_EU_buffer",charge) + end + end + + local load = math.floor((charge/max_charge)*100) + meta:set_string("formspec", + "invsize[8,4;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "label[0,0;Water Mill]".. + "label[1,3;Power level]".. + "label[4,0;Production at "..tostring(production_level).."%]" + ) + + if production_level>0 and minetest.env:get_node(pos).name=="technic:water_mill" then + hacky_swap_node (pos,"technic:water_mill_active") + return + end + if production_level==0 then hacky_swap_node (pos,"technic:water_mill") end +end +}) + +function check_node_around (pos) +local node=minetest.env:get_node(pos) +if node.name=="default:water_flowing" then return 1 end +return 0 +end \ No newline at end of file