ff392e0e7e
* Initial Methods for SpearheadAPI * Added Spearhead API * Added Spearhead API * fixed compile for api * Added notes for API in beta * Added notes for API in beta * Added Menu to all doc pages * Added Menu to all doc pages * added it for real * added it for real * fixed develop * fixed develop * fixed develop * wip * wip * updated * work in progress * work in progress * added empty docs page * wip * removed SAR files from persistence branch * Added Blue Sams as seperate class * added initial persistance * added initial persistance * added initial persistance * added initial persistance * added initial persistance * added menu to persistence markdown * added menu to persistence markdown * added menu to persistence markdown * docs update * wip * wip * Refactor of Stage classes. * wip * wip * wip * reworked bluesam and stagebase * Added waiting stage functionality * updated docs * wip * wip * wip * updated * wip * wip * wip * refactored without issues, needs testing --------- Co-authored-by: Dutchie <54616262+dutchie032@users.noreply.github.com> Co-authored-by: dutchie032 <dutchie032> Co-authored-by: ex61wi <tim.rorije@ing.com>
56 lines
1.6 KiB
Lua
56 lines
1.6 KiB
Lua
|
|
|
|
|
|
|
|
|
|
local SpearheadAPI = {}
|
|
do
|
|
|
|
SpearheadAPI.Stages = {}
|
|
|
|
--- Changes the active stage of spearhead.
|
|
--- All other stages will change based on the normal logic. (CAP, BLUE etc.)
|
|
--- @param stageNumber number the stage number you want changed
|
|
--- @return boolean success indicator of success
|
|
--- @return string message error message
|
|
SpearheadAPI.Stages.changeStage = function(stageNumber)
|
|
if type(stageNumber) ~= "number" then
|
|
return false, "stageNumber " .. stageNumber .. " is not a valid number"
|
|
end
|
|
|
|
Spearhead.Events.PublishStageNumberChanged(stageNumber)
|
|
return true, ""
|
|
end
|
|
|
|
---Returns the current stange number
|
|
---Returns nil when the stagenumber was not set before ever, which means Spearhead was not started.
|
|
---@return number | nil
|
|
SpearheadAPI.Stages.getCurrentStage = function()
|
|
return Spearhead.StageNumber or nil
|
|
end
|
|
|
|
---returns whether a stage (by index) is complete.
|
|
---@param stageNumber number
|
|
---@return boolean | nil
|
|
---@return string
|
|
SpearheadAPI.isStageComplete = function(stageNumber)
|
|
if type(stageNumber) ~= "number" then
|
|
return false, "stageNumber " .. stageNumber .. " is not a valid number"
|
|
end
|
|
|
|
local isComplete = Spearhead.internal.GlobalStageManager.isStageComplete(stageNumber)
|
|
if isComplete == nil then
|
|
return nil, "no stage found with number " .. stageNumber
|
|
end
|
|
|
|
return isComplete, ""
|
|
end
|
|
|
|
end
|
|
|
|
|
|
if Spearhead == nil then Spearhead = {} end
|
|
Spearhead.API = SpearheadAPI
|
|
|
|
|