mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#SPAWN
* Fix for InitCleanup()
This commit is contained in:
commit
34dd864c8b
@ -1418,7 +1418,7 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth )
|
|||||||
end
|
end
|
||||||
-- TODO: Need to fix this by putting an "R" in the name of the group when the group repeats.
|
-- TODO: Need to fix this by putting an "R" in the name of the group when the group repeats.
|
||||||
-- if self.Repeat then
|
-- if self.Repeat then
|
||||||
-- _DATABASE:SetStatusGroup( SpawnTemplate.name, "ReSpawn" )
|
-- _DATABASE:SetStatusGroup( SpawnTemplate.name, "ReSpawn" )
|
||||||
-- end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2971,9 +2971,9 @@ end
|
|||||||
function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
|
||||||
self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix } )
|
self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix } )
|
||||||
|
|
||||||
-- if not self.SpawnTemplate then
|
-- if not self.SpawnTemplate then
|
||||||
-- self.SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix )
|
-- self.SpawnTemplate = self:_GetTemplate( SpawnTemplatePrefix )
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
local SpawnTemplate
|
local SpawnTemplate
|
||||||
if self.TweakedTemplate ~= nil and self.TweakedTemplate == true then
|
if self.TweakedTemplate ~= nil and self.TweakedTemplate == true then
|
||||||
@ -3254,19 +3254,19 @@ function SPAWN:_OnDeadOrCrash( EventData )
|
|||||||
|
|
||||||
local unit=UNIT:FindByName(EventData.IniUnitName)
|
local unit=UNIT:FindByName(EventData.IniUnitName)
|
||||||
|
|
||||||
if unit then
|
if unit then
|
||||||
|
|
||||||
local EventPrefix = self:_GetPrefixFromGroupName(unit.GroupName)
|
local EventPrefix = self:_GetPrefixFromGroupName(unit.GroupName)
|
||||||
|
|
||||||
if EventPrefix then -- EventPrefix can be nil if no # is found, which means, no spawnable group!
|
if EventPrefix then -- EventPrefix can be nil if no # is found, which means, no spawnable group!
|
||||||
self:T( { "Dead event: " .. EventPrefix } )
|
self:T( { "Dead event: " .. EventPrefix } )
|
||||||
|
|
||||||
if EventPrefix == self.SpawnTemplatePrefix or ( self.SpawnAliasPrefix and EventPrefix == self.SpawnAliasPrefix ) then
|
if EventPrefix == self.SpawnTemplatePrefix or ( self.SpawnAliasPrefix and EventPrefix == self.SpawnAliasPrefix ) then
|
||||||
|
|
||||||
self.AliveUnits = self.AliveUnits - 1
|
self.AliveUnits = self.AliveUnits - 1
|
||||||
|
|
||||||
self:T( "Alive Units: " .. self.AliveUnits )
|
self:T( "Alive Units: " .. self.AliveUnits )
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -3369,8 +3369,12 @@ function SPAWN:_SpawnCleanUpScheduler()
|
|||||||
local SpawnGroup, SpawnCursor = self:GetFirstAliveGroup()
|
local SpawnGroup, SpawnCursor = self:GetFirstAliveGroup()
|
||||||
self:T( { "CleanUp Scheduler:", SpawnGroup, SpawnCursor } )
|
self:T( { "CleanUp Scheduler:", SpawnGroup, SpawnCursor } )
|
||||||
|
|
||||||
|
local IsHelo = false
|
||||||
|
|
||||||
while SpawnGroup do
|
while SpawnGroup do
|
||||||
|
|
||||||
|
IsHelo = SpawnGroup:IsHelicopter()
|
||||||
|
|
||||||
local SpawnUnits = SpawnGroup:GetUnits()
|
local SpawnUnits = SpawnGroup:GetUnits()
|
||||||
|
|
||||||
for UnitID, UnitData in pairs( SpawnUnits ) do
|
for UnitID, UnitData in pairs( SpawnUnits ) do
|
||||||
@ -3383,8 +3387,8 @@ function SPAWN:_SpawnCleanUpScheduler()
|
|||||||
self:T( { SpawnUnitName, Stamp } )
|
self:T( { SpawnUnitName, Stamp } )
|
||||||
|
|
||||||
if Stamp.Vec2 then
|
if Stamp.Vec2 then
|
||||||
if SpawnUnit:InAir() == false and SpawnUnit:GetVelocityKMH() < 1 then
|
if (SpawnUnit:InAir() == false and SpawnUnit:GetVelocityKMH() < 1) or IsHelo then
|
||||||
local NewVec2 = SpawnUnit:GetVec2()
|
local NewVec2 = SpawnUnit:GetVec2() or {x=0, y=0}
|
||||||
if (Stamp.Vec2.x == NewVec2.x and Stamp.Vec2.y == NewVec2.y) or (SpawnUnit:GetLife() <= 1) then
|
if (Stamp.Vec2.x == NewVec2.x and Stamp.Vec2.y == NewVec2.y) or (SpawnUnit:GetLife() <= 1) then
|
||||||
-- If the plane is not moving or dead , and is on the ground, assign it with a timestamp...
|
-- If the plane is not moving or dead , and is on the ground, assign it with a timestamp...
|
||||||
if Stamp.Time + self.SpawnCleanUpInterval < timer.getTime() then
|
if Stamp.Time + self.SpawnCleanUpInterval < timer.getTime() then
|
||||||
@ -3402,8 +3406,8 @@ function SPAWN:_SpawnCleanUpScheduler()
|
|||||||
Stamp.Time = nil
|
Stamp.Time = nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if SpawnUnit:InAir() == false then
|
if SpawnUnit:InAir() == false or (IsHelo and SpawnUnit:GetLife() <= 1) then
|
||||||
Stamp.Vec2 = SpawnUnit:GetVec2()
|
Stamp.Vec2 = SpawnUnit:GetVec2() or {x=0, y=0}
|
||||||
if (SpawnUnit:GetVelocityKMH() < 1) then
|
if (SpawnUnit:GetVelocityKMH() < 1) then
|
||||||
Stamp.Time = timer.getTime()
|
Stamp.Time = timer.getTime()
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user