From f0fe1b431df2a23a4d8bef6fa7dbf403658279da Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 31 Jan 2025 14:26:28 +0100 Subject: [PATCH] #SPAWN - Add optional waiting time to InitRepeatOnLanding --- Moose Development/Moose/Core/Spawn.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Core/Spawn.lua b/Moose Development/Moose/Core/Spawn.lua index 89ff4d9fa..42b8bab38 100644 --- a/Moose Development/Moose/Core/Spawn.lua +++ b/Moose Development/Moose/Core/Spawn.lua @@ -1278,6 +1278,7 @@ end --- Respawn group after landing. -- @param #SPAWN self +-- @param #number WaitingTime Wait this many seconds before despawning the alive group after landing. Defaults to 3 . -- @return #SPAWN self -- @usage -- @@ -1285,15 +1286,16 @@ end -- -- Re-SPAWN the Group(s) after each landing and Engine Shut-Down automatically. -- SpawnRU_SU34 = SPAWN:New( 'Su-34' ) -- :InitRandomizeRoute( 1, 1, 3000 ) --- :InitRepeatOnLanding() +-- :InitRepeatOnLanding(20) -- :Spawn() -- -function SPAWN:InitRepeatOnLanding() +function SPAWN:InitRepeatOnLanding(WaitingTime) --self:F( { self.SpawnTemplatePrefix } ) self:InitRepeat() self.RepeatOnEngineShutDown = false self.RepeatOnLanding = true + self.RepeatOnLandingTime = (WaitingTime and WaitingTime > 3) and WaitingTime or 3 return self end @@ -4064,7 +4066,7 @@ function SPAWN:_OnLand( EventData ) -- self:ReSpawn( SpawnGroupIndex ) -- Delay respawn by three seconds due to DCS 2.5.4.26368 OB bug https://github.com/FlightControl-Master/MOOSE/issues/1076 -- Bug was initially only for engine shutdown event but after ED "fixed" it, it now happens on landing events. - SCHEDULER:New( nil, self.ReSpawn, { self, SpawnGroupIndex }, 3 ) + SCHEDULER:New( nil, self.ReSpawn, { self, SpawnGroupIndex }, self.RepeatOnLandingTime or 3 ) end end end