1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-18 16:20:38 +01:00

Added support for trapdoor_cherry in mesecons

- Added support in mesecons_doors for doors:trapdoor_cherry
This commit is contained in:
LeMagnesium 2015-04-20 18:13:54 +02:00
parent 8ce6bc7d01
commit f89c6de1af

View File

@ -56,12 +56,22 @@ meseconify_door("doors:door_obsidian_glass")
local function trapdoor_switch(pos, node) local function trapdoor_switch(pos, node)
local state = minetest.get_meta(pos):get_int("state") local state = minetest.get_meta(pos):get_int("state")
if state == 1 then if node.name:split(":")[2] == "trapdoor" or node.name:split(":")[2] == "trapdoor_open" then
minetest.sound_play("doors_door_close", {pos = pos, gain = 0.3, max_hear_distance = 10}) if state == 1 then
minetest.set_node(pos, {name="doors:trapdoor", param2 = node.param2}) minetest.sound_play("doors_door_close", {pos = pos, gain = 0.3, max_hear_distance = 10})
minetest.set_node(pos, {name="doors:trapdoor", param2 = node.param2})
else
minetest.sound_play("doors_door_open", {pos = pos, gain = 0.3, max_hear_distance = 10})
minetest.set_node(pos, {name="doors:trapdoor_open", param2 = node.param2})
end
else else
minetest.sound_play("doors_door_open", {pos = pos, gain = 0.3, max_hear_distance = 10}) if state == 1 then
minetest.set_node(pos, {name="doors:trapdoor_open", param2 = node.param2}) minetest.sound_play("doors_door_close", {pos = pos, gain = 0.3, max_hear_distance = 10})
minetest.set_node(pos, {name="doors:trapdoor_cherry", param2 = node.param2})
else
minetest.sound_play("doors_door_open", {pos = pos, gain = 0.3, max_hear_distance = 10})
minetest.set_node(pos, {name="doors:trapdoor_cherry_open", param2 = node.param2})
end
end end
minetest.get_meta(pos):set_int("state", state == 1 and 0 or 1) minetest.get_meta(pos):set_int("state", state == 1 and 0 or 1)
@ -82,3 +92,19 @@ if minetest.registered_nodes["doors:trapdoor"] then
}}, }},
}) })
end end
if minetest.registered_nodes["doors:trapdoor_cherry"] then
minetest.override_item("doors:trapdoor_cherry", {
mesecons = {effector = {
action_on = trapdoor_switch,
action_off = trapdoor_switch
}},
})
minetest.override_item("doors:trapdoor_cherry_open", {
mesecons = {effector = {
action_on = trapdoor_switch,
action_off = trapdoor_switch
}},
})
end