paper poster fix
This commit is contained in:
parent
1975417c27
commit
9c1e67a336
@ -1,4 +1,10 @@
|
||||
|
||||
epic.debug = function(msg)
|
||||
if epic.log_executor then
|
||||
minetest.log("action", "[epic] " .. msg)
|
||||
end
|
||||
end
|
||||
|
||||
-- converts a pos to a relative one in respect to the node_pos
|
||||
epic.to_relative_pos = function(node_pos, remote_abs_pos)
|
||||
if not node_pos or not remote_abs_pos then
|
||||
|
@ -6,22 +6,24 @@ assert(def)
|
||||
local closed_forms = {}
|
||||
|
||||
local old_on_receive_fields = def.on_receive_fields
|
||||
def.on_receive_fields = function(pos, formname, fields, player)
|
||||
closed_forms[player:get_player_name()] = true
|
||||
old_on_receive_fields(pos, formname, fields, player)
|
||||
end
|
||||
|
||||
def.groups.epic = 1
|
||||
def.epic = {
|
||||
on_enter = function(pos, _, player)
|
||||
closed_forms[player:get_player_name()] = nil
|
||||
local node = epic.get_node(pos)
|
||||
def.on_rightclick(pos, node, player)
|
||||
minetest.override_item("signs:paper_poster", {
|
||||
on_receive_fields = function(pos, formname, fields, player)
|
||||
closed_forms[player:get_player_name()] = true
|
||||
old_on_receive_fields(pos, formname, fields, player)
|
||||
end,
|
||||
on_check = function(_, _, player, ctx)
|
||||
if closed_forms[player:get_player_name()] then
|
||||
|
||||
epic = {
|
||||
on_enter = function(pos, _, player)
|
||||
closed_forms[player:get_player_name()] = nil
|
||||
ctx.next()
|
||||
local node = epic.get_node(pos)
|
||||
def.on_rightclick(pos, node, player)
|
||||
end,
|
||||
on_check = function(_, _, player, ctx)
|
||||
if closed_forms[player:get_player_name()] then
|
||||
closed_forms[player:get_player_name()] = nil
|
||||
ctx.next()
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -39,12 +39,16 @@ execute_player_state = function(playername, state)
|
||||
|
||||
if not epic.is_epic(node) then
|
||||
-- no more instructions in this branch
|
||||
epic.debug("[executor] no more instructions in this branch @ " ..
|
||||
minetest.pos_to_string(pos) .. " node: " .. node.name)
|
||||
|
||||
if #state.stack > 0 then
|
||||
-- pop stack
|
||||
state.ip = table.remove(state.stack, #state.stack)
|
||||
state.initialized = false
|
||||
state.step_data = {}
|
||||
epic.debug("[executor] pop stack result: " .. minetest.pos_to_string(state.ip))
|
||||
|
||||
execute_player_state(playername, state)
|
||||
else
|
||||
-- done
|
||||
|
Loading…
x
Reference in New Issue
Block a user