From 90e7688cea4174e45f5affcaf18d49b2a1c52226 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Thu, 18 Oct 2018 20:25:21 +0200 Subject: [PATCH] Optimized the boarding and unboarding of cargo. fixed bug when in defence of APC, cargo would not be loaded. The boarding and unboarding has become much more stable now. --- Moose Development/Moose/AI/AI_Cargo_APC.lua | 27 +++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Moose Development/Moose/AI/AI_Cargo_APC.lua b/Moose Development/Moose/AI/AI_Cargo_APC.lua index 4929f2d46..c20475711 100644 --- a/Moose Development/Moose/AI/AI_Cargo_APC.lua +++ b/Moose Development/Moose/AI/AI_Cargo_APC.lua @@ -119,7 +119,6 @@ function AI_CARGO_APC:SetCarrier( CargoCarrier ) self.CargoCarrier:SetState( self.CargoCarrier, "AI_CARGO_APC", self ) CargoCarrier:HandleEvent( EVENTS.Dead ) - CargoCarrier:HandleEvent( EVENTS.Hit ) function CargoCarrier:OnEventDead( EventData ) self:F({"dead"}) @@ -133,18 +132,20 @@ function AI_CARGO_APC:SetCarrier( CargoCarrier ) end end end - - function CargoCarrier:OnEventHit( EventData ) - self:F({"hit"}) - local AICargoTroops = self:GetState( self, "AI_CARGO_APC" ) - if AICargoTroops then - self:F( { OnHitLoaded = AICargoTroops:Is( "Loaded" ) } ) - if AICargoTroops:Is( "Loaded" ) or AICargoTroops:Is( "Boarding" ) then - -- There are enemies within combat radius. Unload the CargoCarrier. - AICargoTroops:Unload( false ) - end - end - end + +-- CargoCarrier:HandleEvent( EVENTS.Hit ) +-- +-- function CargoCarrier:OnEventHit( EventData ) +-- self:F({"hit"}) +-- local AICargoTroops = self:GetState( self, "AI_CARGO_APC" ) +-- if AICargoTroops then +-- self:F( { OnHitLoaded = AICargoTroops:Is( "Loaded" ) } ) +-- if AICargoTroops:Is( "Loaded" ) or AICargoTroops:Is( "Boarding" ) then +-- -- There are enemies within combat radius. Unload the CargoCarrier. +-- AICargoTroops:Unload( false ) +-- end +-- end +-- end self.Zone = ZONE_UNIT:New( self.CargoCarrier:GetName() .. "-Zone", self.CargoCarrier, self.CombatRadius ) self.Coalition = self.CargoCarrier:GetCoalition()