added possibility for debug tooling
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -144,17 +144,6 @@ local stageConfig = {
|
||||
Spearhead.internal.GlobalCapManager.start(databaseManager, capConfig, stageConfig)
|
||||
Spearhead.internal.GlobalStageManager.start(databaseManager)
|
||||
|
||||
local activateStage = function (number)
|
||||
local succ, err = pcall( function ()
|
||||
Spearhead.Events.PublishStageNumberChanged(number)
|
||||
end)
|
||||
env.error(err)
|
||||
end
|
||||
|
||||
missionCommands.addCommand("stage1", {}, activateStage, 1)
|
||||
missionCommands.addCommand("stage2", {}, activateStage, 2)
|
||||
missionCommands.addCommand("stage3", {}, activateStage, 3)
|
||||
missionCommands.addCommand("stage4", {}, activateStage, 4)
|
||||
|
||||
Spearhead.LoadingDone()
|
||||
--Check lines of code in directory per file:
|
||||
|
||||
+27
-4
@@ -1516,18 +1516,41 @@ do
|
||||
end
|
||||
|
||||
SpearheadEvents.AddCommandsToGroup = function(groupId)
|
||||
|
||||
local base = "MISSIONS"
|
||||
if groupId then
|
||||
missionCommands.addCommandForGroup(groupId, "Stage Status", {}, triggerStatusRequestReceived, groupId)
|
||||
missionCommands.addCommandForGroup(groupId, "Stage Status", nil, triggerStatusRequestReceived, groupId)
|
||||
end
|
||||
end
|
||||
|
||||
--Single player purpose
|
||||
for i = 1, 2 do
|
||||
for _, unit in pairs(coalition.getPlayers(i)) do
|
||||
local id = net.get_my_player_id()
|
||||
if id == 0 then
|
||||
SpearheadLogger:info("Single Player detected")
|
||||
|
||||
local unit = world.getPlayer()
|
||||
if unit then
|
||||
local groupId = unit:getGroup():getID()
|
||||
SpearheadEvents.AddCommandsToGroup(groupId)
|
||||
|
||||
--DEBUG COMMANDS
|
||||
do
|
||||
local activateStage = function (number)
|
||||
SpearheadEvents.PublishStageNumberChanged(number)
|
||||
end
|
||||
|
||||
missionCommands.addSubMenuForGroup(groupId , "debug" , nil)
|
||||
missionCommands.addSubMenuForGroup(groupId , "Set Stage" , {"debug"})
|
||||
|
||||
for i = 0, 9 do
|
||||
local menuName = tostring(i) .. ".."
|
||||
missionCommands.addSubMenuForGroup(groupId , menuName, {"debug", "Set Stage"})
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -230,11 +230,13 @@ do --init STAGE DIRECTOR
|
||||
-- end
|
||||
end
|
||||
|
||||
o.ManageStage = function(self)
|
||||
o.OnStatusRequestReceived = function(self, groupId)
|
||||
if self.activeStage ~= self.stageNumber then
|
||||
return
|
||||
end
|
||||
|
||||
o.OnStatusRequestReceived = function(self, groupId)
|
||||
trigger.action.outTextForGroup("Status Update incoming... ")
|
||||
trigger.action.outTextForGroup(groupId, "Status Update incoming... ", 3)
|
||||
trigger.action.outTextForGroup(groupId, " " .. self.zoneName, 3)
|
||||
end
|
||||
|
||||
o.OnStageNumberChanged = function (self, number)
|
||||
@@ -258,6 +260,7 @@ do --init STAGE DIRECTOR
|
||||
end
|
||||
end
|
||||
|
||||
Spearhead.Events.AddOnStatusRequestReceivedListener(o)
|
||||
Spearhead.Events.AddStageNumberChangedListener(o)
|
||||
return o
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user