Skip to content

Commit

Permalink
mesecons compat
Browse files Browse the repository at this point in the history
  • Loading branch information
naturefreshmilk committed Nov 23, 2019
1 parent 807d4ca commit 9b1d5c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
10 changes: 1 addition & 9 deletions form.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)

if fields.toggle_state then
if state == "on" then
state = "mesecons"
timer:stop()

elseif state == "mesecons" then
state = "off"
timer:stop()

Expand Down Expand Up @@ -129,9 +125,5 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end

if state == "on" then
timer:start(0)
end


timer:start(0)
end)
12 changes: 11 additions & 1 deletion soundblock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,19 @@ minetest.register_node("soundblock:block", {
mesecons = {
effector = {
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,
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)
end
}
Expand Down

0 comments on commit 9b1d5c3

Please sign in to comment.