#SPAWN - fix SpawnOnRunway if definitely requested (SP only!)

This commit is contained in:
Applevangelist
2026-05-24 13:00:53 +02:00
parent 9cda1b88ea
commit 3d1dcd78a3
3 changed files with 32 additions and 23 deletions
+1 -1
View File
@@ -855,7 +855,7 @@ end
-- @param DCS#Time EventTime The time stamp of the event. -- @param DCS#Time EventTime The time stamp of the event.
-- @param DCS#Object Initiator The initiating object of the event. -- @param DCS#Object Initiator The initiating object of the event.
function BASE:CreateEventTakeoff( EventTime, Initiator ) function BASE:CreateEventTakeoff( EventTime, Initiator )
self:F( { EventTime, Initiator } ) --self:F( { EventTime, Initiator } )
local Event = { local Event = {
id = world.event.S_EVENT_TAKEOFF, id = world.event.S_EVENT_TAKEOFF,
+8 -2
View File
@@ -2331,9 +2331,15 @@ function SPAWN:SpawnAtAirbase( SpawnAirbase, Takeoff, TakeoffAltitude, TerminalT
Takeoff = GROUP.Takeoff.Air Takeoff = GROUP.Takeoff.Air
spawnonground = false spawnonground = false
else else
if not Takeoff == GROUP.Takeoff.Runway then
self:E( string.format( "WARNING: Group %s has no parking spots at %s ==> No emergency air start or uncontrolled spawning ==> No spawn!", self.SpawnTemplatePrefix, SpawnAirbase:GetName() ) ) self:E( string.format( "WARNING: Group %s has no parking spots at %s ==> No emergency air start or uncontrolled spawning ==> No spawn!", self.SpawnTemplatePrefix, SpawnAirbase:GetName() ) )
return nil return nil
else
Takeoff = GROUP.Takeoff.Runway
spawnonground = false
self:E( string.format( "WARNING: Group %s set to runway spawning at %s, this only works in Single Player!", self.SpawnTemplatePrefix, SpawnAirbase:GetName() ) )
end
end end
end end
@@ -2392,7 +2398,7 @@ function SPAWN:SpawnAtAirbase( SpawnAirbase, Takeoff, TakeoffAltitude, TerminalT
else else
-- Spawn in air as requested initially. Original template orientation is perserved, altitude is already correctly set. -- Spawn in air as requested initially. Original template orientation is preserved, altitude is already correctly set.
SpawnTemplate.units[UnitID].x = TX SpawnTemplate.units[UnitID].x = TX
SpawnTemplate.units[UnitID].y = TY SpawnTemplate.units[UnitID].y = TY
SpawnTemplate.units[UnitID].alt = PointVec3.y SpawnTemplate.units[UnitID].alt = PointVec3.y
+23 -20
View File
@@ -118,21 +118,21 @@ TARS_SESSION.debugunitsearch = false
-- your mission before loading. -- your mission before loading.
-- --
-- ## Player workflow -- ## Player workflow
-- 1. Spawn into a recon-capable slot and open the **F10 Task TARS** radio menu. -- 1. Spawn into a recon-capable slot and open the **F10 Task TARS** radio menu.
-- 2. Select **TARS validation** on the ground. The system checks your loadout and -- 2. Select **TARS validation** on the ground. The system checks your loadout and
-- reports the platform's altitude band, FOV, and available film. -- reports the platform's altitude band, FOV, and available film.
-- The validation item then disappears once approved. -- The validation item then disappears once approved.
-- 3. Take off. **Start filming / STB & Resume / Stop filming** appear in the menu. -- 3. Take off. **Start filming / STB & Resume / Stop filming** appear in the menu.
-- 4. Select **TARS mode : Start filming** to begin recording. -- 4. Select **TARS mode : Start filming** to begin recording.
-- 5. Fly over enemy units within the sensor's altitude/attitude envelope. -- 5. Fly over enemy units within the sensor's altitude/attitude envelope.
-- Each detected unit is confirmed in the HUD (`+1 Captured target`). -- Each detected unit is confirmed in the HUD (`+1 Captured target`).
-- 6. Use **TARS mode : STB & Resume** to pause (e.g. to refuel). -- 6. Use **TARS mode : STB & Resume** to pause (e.g. to refuel).
-- Film resumes automatically on the next takeoff if the loadout is still valid. -- Film resumes automatically on the next takeoff if the loadout is still valid.
-- 7. Select **TARS mode : Stop filming** or let the film timer expire. -- 7. Select **TARS mode : Stop filming** or let the film timer expire.
-- 8. Land at an allied airbase or FARP within `TARS.landingDistance` metres. -- 8. Land at an allied airbase or FARP within `TARS.landingDistance` metres.
-- The film controls disappear. After `landingDelay + debriefDelay` seconds the -- The film controls disappear. After `landingDelay + debriefDelay` seconds the
-- intel marks appear on the F10 map and scoring credits are awarded. -- intel marks appear on the F10 map and scoring credits are awarded.
-- After the debrief the **TARS validation** item reappears for the next sortie. -- After the debrief the **TARS validation** item reappears for the next sortie.
-- --
-- ## Localization -- ## Localization
-- --
@@ -274,7 +274,7 @@ TARS = {}
-- @field #string playerName Player display name. -- @field #string playerName Player display name.
--- Frozen target snapshot. --- Frozen target snapshot.
-- @type TARS.Snapshot -- @type TARS.Snapshot #TARS.Snapshot
-- @field Wrapper.Unit#UNIT unit MOOSE UNIT wrapper or STATIC wrapper. -- @field Wrapper.Unit#UNIT unit MOOSE UNIT wrapper or STATIC wrapper.
-- @field DCS#Object dcsObj Raw DCS object reference. -- @field DCS#Object dcsObj Raw DCS object reference.
-- @field #number category `Object.Category.*` of the detected object. -- @field #number category `Object.Category.*` of the detected object.
@@ -294,7 +294,7 @@ TARS = {}
------------------------------------------------- -------------------------------------------------
--- @field #string version --- @field #string version
TARS.version = "v2.3.1" TARS.version = "v2.3.2"
--- Active locale. --- Active locale.
-- @field #string locale -- @field #string locale
@@ -1804,7 +1804,7 @@ function TARS:_OnEventBirth(EventData)
if not unit then return end if not unit then return end
local instance = self:GetInstance(unit:GetName()) local instance = self:GetInstance(unit:GetName())
if instance then instance:Delete() end if instance then instance:Delete() end
local playerName = unit:GetPlayerName() local playerName = EventData.IniPlayerName --unit:GetPlayerName()
if not playerName then return end if not playerName then return end
local pName = playerName local pName = playerName
timer.scheduleFunction(function() timer.scheduleFunction(function()
@@ -1818,6 +1818,7 @@ end
-- @param #TARS self -- @param #TARS self
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
function TARS:_OnEventEngineStartup(EventData) function TARS:_OnEventEngineStartup(EventData)
if EventData.IniPlayerName == nil then return end
local unit = EventData.IniUnit local unit = EventData.IniUnit
if not unit or not unit:GetPlayerName() then return end if not unit or not unit:GetPlayerName() then return end
local pName = unit:GetPlayerName() local pName = unit:GetPlayerName()
@@ -1835,7 +1836,7 @@ function TARS:_OnEventDead(EventData)
local unit = EventData.IniUnit local unit = EventData.IniUnit
if not unit then return end if not unit then return end
local name = unit:GetName() local name = unit:GetName()
local playerName = unit:GetPlayerName() or unit:GetName() local playerName = EventData.IniPlayerName --unit:GetPlayerName() or unit:GetName()
if TARS.groundMenus[playerName] then self:RemoveGroundMenu(playerName) end if TARS.groundMenus[playerName] then self:RemoveGroundMenu(playerName) end
if self.detectedTargets[name] then if self.detectedTargets[name] then
local markID = self.marks.blue[name] or self.marks.red[name] local markID = self.marks.blue[name] or self.marks.red[name]
@@ -1852,7 +1853,7 @@ end
function TARS:_OnEventPlayerLeaveUnit(EventData) function TARS:_OnEventPlayerLeaveUnit(EventData)
local unit = EventData.IniUnit local unit = EventData.IniUnit
if not unit then return end if not unit then return end
local playerName = unit:GetPlayerName() or unit:GetName() local playerName = EventData.IniPlayerName --unit:GetPlayerName() or unit:GetName()
if TARS.groundMenus[playerName] then self:RemoveGroundMenu(playerName) end if TARS.groundMenus[playerName] then self:RemoveGroundMenu(playerName) end
end end
@@ -1863,11 +1864,12 @@ end
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
function TARS:_OnEventTakeOff(EventData) function TARS:_OnEventTakeOff(EventData)
self:T(self.lid.."_OnEventTakeOff") self:T(self.lid.."_OnEventTakeOff")
if EventData.IniPlayerName == nil then return end
local unit = EventData.IniUnit local unit = EventData.IniUnit
if not unit then return end if not unit then return end
local instance = self:GetInstance(unit:GetName()) local instance = self:GetInstance(unit:GetName())
local now = timer.getTime() local now = timer.getTime()
-- Branch 1: auto-resume after ground STB -- Branch 1: auto-resume after ground STB
if instance and instance.capturing then if instance and instance.capturing then
if instance.lastTakeoffTime and (now - instance.lastTakeoffTime) < 5 then return end if instance.lastTakeoffTime and (now - instance.lastTakeoffTime) < 5 then return end
@@ -1903,7 +1905,8 @@ function TARS:_OnEventTakeOff(EventData)
if instance and instance.lastTakeoffTime and (now - instance.lastTakeoffTime) < 5 then if instance and instance.lastTakeoffTime and (now - instance.lastTakeoffTime) < 5 then
return return
end end
local playerName = unit:GetPlayerName() or unit:GetName() local playerName = EventData.IniPlayerName --unit:GetPlayerName() or unit:GetName()
if playerName == nil then return end
local groundData = TARS.groundMenus[playerName] local groundData = TARS.groundMenus[playerName]
if not (groundData and groundData.approved) then return end if not (groundData and groundData.approved) then return end