summaryrefslogtreecommitdiff
path: root/mesecons_hydroturbine
diff options
context:
space:
mode:
authorJeija <norrepli@gmail.com>2012-03-05 19:21:26 +0100
committerJeija <norrepli@gmail.com>2012-03-05 19:21:26 +0100
commit36ae0cc1a54538742f1d1f3709bb2c1840a33539 (patch)
tree2865e2f7240108c0b82e45ef7c2f8e4a833929ba /mesecons_hydroturbine
parentf8ac52c35073875e2ba1872532577c27f9677c3d (diff)
downloadmesecons-36ae0cc1a54538742f1d1f3709bb2c1840a33539.tar
mesecons-36ae0cc1a54538742f1d1f3709bb2c1840a33539.tar.gz
mesecons-36ae0cc1a54538742f1d1f3709bb2c1840a33539.tar.bz2
mesecons-36ae0cc1a54538742f1d1f3709bb2c1840a33539.tar.xz
mesecons-36ae0cc1a54538742f1d1f3709bb2c1840a33539.zip
Upload after major code reorganization - Version 0.6 DEV - Split mesecons mod into several modules - [BUGGY?]
Diffstat (limited to 'mesecons_hydroturbine')
-rw-r--r--mesecons_hydroturbine/depends.txt1
-rw-r--r--mesecons_hydroturbine/init.lua58
2 files changed, 59 insertions, 0 deletions
diff --git a/mesecons_hydroturbine/depends.txt b/mesecons_hydroturbine/depends.txt
new file mode 100644
index 0000000..acaa924
--- /dev/null
+++ b/mesecons_hydroturbine/depends.txt
@@ -0,0 +1 @@
+mesecons
diff --git a/mesecons_hydroturbine/init.lua b/mesecons_hydroturbine/init.lua
new file mode 100644
index 0000000..ed64d79
--- /dev/null
+++ b/mesecons_hydroturbine/init.lua
@@ -0,0 +1,58 @@
+-- HYDRO_TURBINE
+
+minetest.register_node("mesecons_hydroturbine:hydro_turbine_off", {
+ tile_images = {"jeija_hydro_turbine_off.png", "jeija_hydro_turbine_off.png", "jeija_hydro_turbine_off.png", "jeija_hydro_turbine_off.png", "jeija_hydro_turbine_off.png", "jeija_hydro_turbine_off.png"},
+ material = minetest.digprop_constanttime(0.5),
+ description="Water Turbine",
+})
+
+minetest.register_node("mesecons_hydroturbine:hydro_turbine_on", {
+ tile_images = {"jeija_hydro_turbine_on.png", "jeija_hydro_turbine_on.png", "jeija_hydro_turbine_on.png", "jeija_hydro_turbine_on.png", "jeija_hydro_turbine_on.png", "jeija_hydro_turbine_on.png"},
+ drop = '"mesecons_hydroturbine:hydro_turbine_off" 1',
+ material = minetest.digprop_constanttime(0.5),
+ description="Water Turbine",
+})
+
+
+minetest.register_abm({
+nodenames = {"mesecons_hydroturbine:hydro_turbine_off"},
+ interval = 1,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ local waterpos={x=pos.x, y=pos.y+1, z=pos.z}
+ if minetest.env:get_node(waterpos).name=="default:water_flowing" then
+ --minetest.env:remove_node(pos)
+ minetest.env:add_node(pos, {name="mesecons_hydroturbine:hydro_turbine_on"})
+ nodeupdate(pos)
+ mesecon:receptor_on(pos)
+ end
+ end,
+})
+
+minetest.register_abm({
+nodenames = {"mesecons_hydroturbine:hydro_turbine_on"},
+ interval = 1,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ local waterpos={x=pos.x, y=pos.y+1, z=pos.z}
+ if minetest.env:get_node(waterpos).name~="default:water_flowing" then
+ --minetest.env:remove_node(pos)
+ minetest.env:add_node(pos, {name="mesecons_hydroturbine:hydro_turbine_off"})
+ nodeupdate(pos)
+ mesecon:receptor_off(pos)
+ end
+ end,
+})
+
+mesecon:add_receptor_node("mesecons_hydroturbine:hydro_turbine_on")
+mesecon:add_receptor_node_off("mesecons_hydroturbine:hydro_turbine_off")
+
+minetest.register_craft({
+ output = '"mesecons_hydroturbine:hydro_turbine_off" 2',
+ recipe = {
+ {'','"default:stick"', ''},
+ {'"default:stick"', '"default:steel_ingot"', '"default:stick"'},
+ {'','"default:stick"', ''},
+ }
+})
+