mesecons compat
parent
807d4ca724
commit
9b1d5c3903
10
form.lua
10
form.lua
|
@ -91,10 +91,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
|
||||||
if fields.toggle_state then
|
if fields.toggle_state then
|
||||||
if state == "on" then
|
if state == "on" then
|
||||||
state = "mesecons"
|
|
||||||
timer:stop()
|
|
||||||
|
|
||||||
elseif state == "mesecons" then
|
|
||||||
state = "off"
|
state = "off"
|
||||||
timer:stop()
|
timer:stop()
|
||||||
|
|
||||||
|
@ -129,9 +125,5 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if state == "on" then
|
timer:start(0)
|
||||||
timer:start(0)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -97,9 +97,19 @@ minetest.register_node("soundblock:block", {
|
||||||
mesecons = {
|
mesecons = {
|
||||||
effector = {
|
effector = {
|
||||||
action_on = function (pos)
|
action_on = function (pos)
|
||||||
execute(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("state", "on")
|
||||||
|
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
timer:start(0)
|
||||||
end,
|
end,
|
||||||
action_off = function(pos)
|
action_off = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("state", "off")
|
||||||
|
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
timer:stop()
|
||||||
|
|
||||||
stop_sound(pos)
|
stop_sound(pos)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue