working status

This commit is contained in:
2024-09-25 15:23:13 +02:00
parent 3ab7b7f580
commit 78274bcb84
6 changed files with 189 additions and 41 deletions
+33 -4
View File
@@ -47,7 +47,7 @@ do -- INIT UTIL
return result
end
for str in string.gmatch(input, "([^" .. seperator .. "]+)") do
for str in string.gmatch(input, "[^" .. seperator .. "]+") do
table.insert(result, str)
end
return result
@@ -1493,9 +1493,8 @@ do
do --COMMANDS
do -- status updates
local onStatusRequestReceivedListeners = {}
local onStatusRequestReceivedListeners = {}
---comment
---@param listener table object with OnStatusRequestReceived(self, groupId)
SpearheadEvents.AddOnStatusRequestReceivedListener = function(listener)
@@ -1547,7 +1546,6 @@ do
for ii = 0, 9 do
local number = tonumber(tostring(i) .. tostring(ii))
missionCommands.addCommandForGroup(groupId, "Stage " .. tostring(number), { "debug", "Set Stage", menuName }, activateStage, number)
SpearheadLogger:info("blaat " .. number)
end
end
end
@@ -1556,6 +1554,35 @@ do
end
end
do -- PLAYER ENTER UNIT
local playerEnterUnitListeners = {}
---comment
---@param listener table object with OnPlayerEnterUnit(self, unit)
SpearheadEvents.AddOnPlayerEnterUnitListener = function(listener)
if type(listener) ~= "table" then
SpearheadLogger:warn("Unit lost Event listener not of type table/object")
return
end
table.insert(playerEnterUnitListeners, listener)
end
SpearheadEvents.TriggerPlayerEntersUnit = function(unit)
if unit ~= nil then
if playerEnterUnitListeners then
for _, callable in pairs(playerEnterUnitListeners) do
local succ, err = pcall(function()
callable:OnPlayerEnterUnit(unit)
end)
if err then
SpearheadLogger:error(err)
end
end
end
end
end
end
local e = {}
function e:onEvent(event)
if event.id == world.event.S_EVENT_LAND or event.id == world.event.S_EVENT_RUNWAY_TOUCH then
@@ -1610,6 +1637,8 @@ function Spearhead.AddMissionEditorWarning(warningMessage)
table.insert(Spearhead.MissionEditingWarnings, warningMessage or "skip")
end
missionCommands.addSubMenu("Missions")
local loadDone = false
Spearhead.LoadingDone = function()
if loadDone == true then