end window WIP
This commit is contained in:
7
inc/decision/decision.go_to_end.lua
Normal file
7
inc/decision/decision.go_to_end.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
Decision.register({
|
||||
id = "go_to_end",
|
||||
label = "Break the cycle",
|
||||
handle = function()
|
||||
Window.set_current("end")
|
||||
end,
|
||||
})
|
||||
@@ -10,11 +10,11 @@ local _decisions = {}
|
||||
--- @param[opt] decision.handle function Called when the decision is selected. Defaults to noop.
|
||||
function Decision.register(decision)
|
||||
if not decision or not decision.id then
|
||||
PopupWindow.show({"Error: Invalid decision object registered (missing id)!"})
|
||||
trace("Error: Invalid decision object registered (missing id)!")
|
||||
return
|
||||
end
|
||||
if not decision.label then
|
||||
PopupWindow.show({"Error: Invalid decision object registered (missing label)!"})
|
||||
trace("Error: Invalid decision object registered (missing label)!")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -92,7 +92,7 @@ end
|
||||
function Decision.filter_available(decisions_list)
|
||||
local available = {}
|
||||
for _, decision in ipairs(decisions_list) do
|
||||
if decision and decision.condition() then
|
||||
if decision and (not decision.condition or decision.condition()) then
|
||||
table.insert(available, decision)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user