mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-13 09:16:15 +00:00
Restored old CleanUp and Scoring
This commit is contained in:
@@ -134,7 +134,7 @@ function CLEANUP_AIRBASE:New( AirbaseNames )
|
|||||||
for UnitName, Unit in pairs( _DATABASE.UNITS ) do
|
for UnitName, Unit in pairs( _DATABASE.UNITS ) do
|
||||||
local Unit = Unit -- Wrapper.Unit#UNIT
|
local Unit = Unit -- Wrapper.Unit#UNIT
|
||||||
if Unit:IsAlive() ~= nil then
|
if Unit:IsAlive() ~= nil then
|
||||||
if self.__:IsInAirbase( Unit:GetVec2() ) then
|
if self:IsInAirbase( Unit:GetVec2() ) then
|
||||||
self:F( { UnitName = UnitName } )
|
self:F( { UnitName = UnitName } )
|
||||||
self.CleanUpList[UnitName] = {}
|
self.CleanUpList[UnitName] = {}
|
||||||
self.CleanUpList[UnitName].CleanUpUnit = Unit
|
self.CleanUpList[UnitName].CleanUpUnit = Unit
|
||||||
@@ -187,10 +187,6 @@ function CLEANUP_AIRBASE:SetCleanMissiles( CleanMissiles )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Check whether a Vec2 is in any cleanup airbase.
|
|
||||||
-- @param #CLEANUP_AIRBASE self
|
|
||||||
-- @param DCS#VEC2 Vec2 2D vector.
|
|
||||||
function CLEANUP_AIRBASE.__:IsInAirbase( Vec2 )
|
function CLEANUP_AIRBASE.__:IsInAirbase( Vec2 )
|
||||||
|
|
||||||
local InAirbase = false
|
local InAirbase = false
|
||||||
@@ -198,7 +194,7 @@ function CLEANUP_AIRBASE.__:IsInAirbase( Vec2 )
|
|||||||
local Airbase = Airbase -- Wrapper.Airbase#AIRBASE
|
local Airbase = Airbase -- Wrapper.Airbase#AIRBASE
|
||||||
if Airbase:GetZone():IsVec2InZone( Vec2 ) then
|
if Airbase:GetZone():IsVec2InZone( Vec2 ) then
|
||||||
InAirbase = true
|
InAirbase = true
|
||||||
break
|
break;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -250,7 +246,7 @@ function CLEANUP_AIRBASE.__:OnEventBirth( EventData )
|
|||||||
self:F( { EventData } )
|
self:F( { EventData } )
|
||||||
|
|
||||||
if EventData.IniUnit:IsAlive() ~= nil then
|
if EventData.IniUnit:IsAlive() ~= nil then
|
||||||
if self.__:IsInAirbase( EventData.IniUnit:GetVec2() ) then
|
if self:IsInAirbase( EventData.IniUnit:GetVec2() ) then
|
||||||
self.CleanUpList[EventData.IniDCSUnitName] = {}
|
self.CleanUpList[EventData.IniDCSUnitName] = {}
|
||||||
self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnit = EventData.IniUnit
|
self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnit = EventData.IniUnit
|
||||||
self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroup = EventData.IniGroup
|
self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroup = EventData.IniGroup
|
||||||
@@ -295,7 +291,7 @@ function CLEANUP_AIRBASE.__:OnEventShot( Event )
|
|||||||
self:F( { Event } )
|
self:F( { Event } )
|
||||||
|
|
||||||
-- Test if the missile was fired within one of the CLEANUP_AIRBASE.AirbaseNames.
|
-- Test if the missile was fired within one of the CLEANUP_AIRBASE.AirbaseNames.
|
||||||
if self.__:IsInAirbase( Event.IniUnit:GetVec2() ) then
|
if self:IsInAirbase( Event.IniUnit:GetVec2() ) then
|
||||||
-- Okay, the missile was fired within the CLEANUP_AIRBASE.AirbaseNames, destroy the fired weapon.
|
-- Okay, the missile was fired within the CLEANUP_AIRBASE.AirbaseNames, destroy the fired weapon.
|
||||||
self:DestroyMissile( Event.Weapon )
|
self:DestroyMissile( Event.Weapon )
|
||||||
end
|
end
|
||||||
@@ -308,7 +304,7 @@ function CLEANUP_AIRBASE.__:OnEventHit( Event )
|
|||||||
self:F( { Event } )
|
self:F( { Event } )
|
||||||
|
|
||||||
if Event.IniUnit then
|
if Event.IniUnit then
|
||||||
if self.__:IsInAirbase( Event.IniUnit:GetVec2() ) then
|
if self:IsInAirbase( Event.IniUnit:GetVec2() ) then
|
||||||
self:T( { "Life: ", Event.IniDCSUnitName, ' = ', Event.IniUnit:GetLife(), "/", Event.IniUnit:GetLife0() } )
|
self:T( { "Life: ", Event.IniDCSUnitName, ' = ', Event.IniUnit:GetLife(), "/", Event.IniUnit:GetLife0() } )
|
||||||
if Event.IniUnit:GetLife() < Event.IniUnit:GetLife0() then
|
if Event.IniUnit:GetLife() < Event.IniUnit:GetLife0() then
|
||||||
self:T( "CleanUp: Destroy: " .. Event.IniDCSUnitName )
|
self:T( "CleanUp: Destroy: " .. Event.IniDCSUnitName )
|
||||||
@@ -318,7 +314,7 @@ function CLEANUP_AIRBASE.__:OnEventHit( Event )
|
|||||||
end
|
end
|
||||||
|
|
||||||
if Event.TgtUnit then
|
if Event.TgtUnit then
|
||||||
if self.__:IsInAirbase( Event.TgtUnit:GetVec2() ) then
|
if self:IsInAirbase( Event.TgtUnit:GetVec2() ) then
|
||||||
self:T( { "Life: ", Event.TgtDCSUnitName, ' = ', Event.TgtUnit:GetLife(), "/", Event.TgtUnit:GetLife0() } )
|
self:T( { "Life: ", Event.TgtDCSUnitName, ' = ', Event.TgtUnit:GetLife(), "/", Event.TgtUnit:GetLife0() } )
|
||||||
if Event.TgtUnit:GetLife() < Event.TgtUnit:GetLife0() then
|
if Event.TgtUnit:GetLife() < Event.TgtUnit:GetLife0() then
|
||||||
self:T( "CleanUp: Destroy: " .. Event.TgtDCSUnitName )
|
self:T( "CleanUp: Destroy: " .. Event.TgtDCSUnitName )
|
||||||
@@ -360,7 +356,7 @@ function CLEANUP_AIRBASE.__:EventAddForCleanUp( Event )
|
|||||||
|
|
||||||
if Event.IniDCSUnit and Event.IniCategory == Object.Category.UNIT then
|
if Event.IniDCSUnit and Event.IniCategory == Object.Category.UNIT then
|
||||||
if self.CleanUpList[Event.IniDCSUnitName] == nil then
|
if self.CleanUpList[Event.IniDCSUnitName] == nil then
|
||||||
if self.__:IsInAirbase( Event.IniUnit:GetVec2() ) then
|
if self:IsInAirbase( Event.IniUnit:GetVec2() ) then
|
||||||
self:AddForCleanUp( Event.IniUnit, Event.IniDCSUnitName )
|
self:AddForCleanUp( Event.IniUnit, Event.IniDCSUnitName )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -368,7 +364,7 @@ function CLEANUP_AIRBASE.__:EventAddForCleanUp( Event )
|
|||||||
|
|
||||||
if Event.TgtDCSUnit and Event.TgtCategory == Object.Category.UNIT then
|
if Event.TgtDCSUnit and Event.TgtCategory == Object.Category.UNIT then
|
||||||
if self.CleanUpList[Event.TgtDCSUnitName] == nil then
|
if self.CleanUpList[Event.TgtDCSUnitName] == nil then
|
||||||
if self.__:IsInAirbase( Event.TgtUnit:GetVec2() ) then
|
if self:IsInAirbase( Event.TgtUnit:GetVec2() ) then
|
||||||
self:AddForCleanUp( Event.TgtUnit, Event.TgtDCSUnitName )
|
self:AddForCleanUp( Event.TgtUnit, Event.TgtDCSUnitName )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -390,7 +386,7 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
|
|||||||
|
|
||||||
if CleanUpUnit:IsAlive() ~= nil then
|
if CleanUpUnit:IsAlive() ~= nil then
|
||||||
|
|
||||||
if self.__:IsInAirbase( CleanUpUnit:GetVec2() ) then
|
if self:IsInAirbase( CleanUpUnit:GetVec2() ) then
|
||||||
|
|
||||||
if _DATABASE:GetStatusGroup( CleanUpGroupName ) ~= "ReSpawn" then
|
if _DATABASE:GetStatusGroup( CleanUpGroupName ) ~= "ReSpawn" then
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user