2012-03-05 19:21:26 +01:00
|
|
|
-- HYDRO_TURBINE
|
2012-12-08 22:28:46 +01:00
|
|
|
-- Water turbine:
|
|
|
|
-- Active if flowing >water< above it
|
|
|
|
-- (does not work with other liquids)
|
2012-03-05 19:21:26 +01:00
|
|
|
|
|
|
|
minetest.register_node("mesecons_hydroturbine:hydro_turbine_off", {
|
2012-07-20 15:26:13 +02:00
|
|
|
drawtype = "nodebox",
|
2012-08-15 10:59:16 +02:00
|
|
|
tiles = {"jeija_hydro_turbine_off.png"},
|
2012-12-08 22:28:46 +01:00
|
|
|
groups = {dig_immediate=2},
|
2012-03-05 19:21:26 +01:00
|
|
|
description="Water Turbine",
|
2012-07-20 15:26:13 +02:00
|
|
|
paramtype = "light",
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
|
|
|
{-0.15, 0.5, -0.15, 0.15, 1.45, 0.15},
|
|
|
|
{-0.45, 1.15, -0.1, 0.45, 1.45, 0.1},
|
|
|
|
{-0.1, 1.15, -0.45, 0.1, 1.45, 0.45}},
|
|
|
|
},
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
|
|
|
{-0.15, 0.5, -0.15, 0.15, 1.45, 0.15},
|
|
|
|
{-0.45, 1.15, -0.1, 0.45, 1.45, 0.1},
|
|
|
|
{-0.1, 1.15, -0.45, 0.1, 1.45, 0.45}},
|
|
|
|
},
|
2013-03-07 02:51:57 +01:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
2012-12-08 22:28:46 +01:00
|
|
|
mesecons = {receptor = {
|
|
|
|
state = mesecon.state.off
|
|
|
|
}}
|
2012-03-05 19:21:26 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("mesecons_hydroturbine:hydro_turbine_on", {
|
2012-07-20 15:26:13 +02:00
|
|
|
drawtype = "nodebox",
|
2012-08-15 10:59:16 +02:00
|
|
|
tiles = {"jeija_hydro_turbine_on.png"},
|
2013-04-28 12:40:08 +02:00
|
|
|
drop = "mesecons_hydroturbine:hydro_turbine_off 1",
|
2012-12-08 22:28:46 +01:00
|
|
|
groups = {dig_immediate=2,not_in_creative_inventory=1},
|
2012-08-01 11:58:19 +02:00
|
|
|
description="Water Turbine",
|
2012-07-20 15:26:13 +02:00
|
|
|
paramtype = "light",
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
|
|
|
{-0.15, 0.5, -0.15, 0.15, 1.45, 0.15},
|
|
|
|
{-0.5, 1.15, -0.1, 0.5, 1.45, 0.1},
|
|
|
|
{-0.1, 1.15, -0.5, 0.1, 1.45, 0.5}},
|
|
|
|
},
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
|
|
|
{-0.15, 0.5, -0.15, 0.15, 1.45, 0.15},
|
|
|
|
{-0.5, 1.15, -0.1, 0.5, 1.45, 0.1},
|
|
|
|
{-0.1, 1.15, -0.5, 0.1, 1.45, 0.5}},
|
|
|
|
},
|
2013-03-07 02:51:57 +01:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
2012-12-08 22:28:46 +01:00
|
|
|
mesecons = {receptor = {
|
|
|
|
state = mesecon.state.on
|
|
|
|
}}
|
2012-03-05 19:21:26 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
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}
|
2013-12-01 04:13:00 +01:00
|
|
|
if minetest.get_node(waterpos).name=="default:water_flowing" then
|
|
|
|
minetest.add_node(pos, {name="mesecons_hydroturbine:hydro_turbine_on"})
|
2012-03-05 19:21:26 +01:00
|
|
|
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}
|
2013-12-01 04:13:00 +01:00
|
|
|
if minetest.get_node(waterpos).name~="default:water_flowing" then
|
|
|
|
minetest.add_node(pos, {name="mesecons_hydroturbine:hydro_turbine_off"})
|
2012-03-05 19:21:26 +01:00
|
|
|
nodeupdate(pos)
|
|
|
|
mesecon:receptor_off(pos)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
2013-04-28 12:40:08 +02:00
|
|
|
output = "mesecons_hydroturbine:hydro_turbine_off 2",
|
2012-03-05 19:21:26 +01:00
|
|
|
recipe = {
|
2013-04-28 12:40:08 +02:00
|
|
|
{"","default:stick", ""},
|
|
|
|
{"default:stick", "default:steel_ingot", "default:stick"},
|
|
|
|
{"","default:stick", ""},
|
2012-03-05 19:21:26 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|