Files
impostor/inc/desition/desition.manager.lua
Zsolt Tasnadi 1cf09de1fb
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
remove ai generated comments
2026-02-18 19:29:06 +01:00

32 lines
775 B
Lua

local _desitions = {}
function DesitionManager.register(desition)
if not desition or not desition.id then
PopupWindow.show({"Error: Invalid desition object registered (missing id)!"})
return
end
if not desition.label then
PopupWindow.show({"Error: Invalid desition object registered (missing label)!"})
return
end
if not desition.condition then
desition.condition = function() return true end
end
if not desition.handle then
desition.handle = function() end
end
if _desitions[desition.id] then
trace("Warning: Overwriting desition with id: " .. desition.id)
end
_desitions[desition.id] = desition
end
function DesitionManager.get(id)
return _desitions[id]
end
function DesitionManager.get_all()
return _desitions
end