Arty v1.2.0

- fixed cargo issue
This commit is contained in:
Frank 2020-12-27 17:59:39 +01:00
parent 4869ae4baa
commit 01a5b523da
2 changed files with 36 additions and 25 deletions

View File

@ -483,7 +483,7 @@ do -- CARGO_GROUP
-- @param #string Event
-- @param #string From
-- @param #string To
-- @param Core.Point#POINT_VEC2
-- @param Core.Point#POINT_VEC2 ToPointVec2
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
--self:F( { From, Event, To, ToPointVec2 } )
@ -493,7 +493,10 @@ do -- CARGO_GROUP
self.CargoSet:ForEach(
function( Cargo )
--Cargo:UnLoad( ToPointVec2 )
local RandomVec2=ToPointVec2:GetRandomPointVec2InRadius(20, 10)
local RandomVec2=nil
if ToPointVec2 then
RandomVec2=ToPointVec2:GetRandomPointVec2InRadius(20, 10)
end
Cargo:UnBoard( RandomVec2 )
end
)

View File

@ -693,7 +693,7 @@ ARTY.db={
--- Arty script version.
-- @field #string version
ARTY.version="1.1.9"
ARTY.version="1.2.0"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -2765,16 +2765,10 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
self:_EventFromTo("onafterStatus", Event, From, To)
-- Get ammo.
local ntot, nshells, nrockets, nmissiles=self:GetAmmo()
-- FSM state.
local fsmstate=self:GetState()
self:T(self.lid..string.format("Status %s, Ammo total=%d: shells=%d [smoke=%d, illu=%d, nukes=%d*%.3f kT], rockets=%d, missiles=%d", fsmstate, ntot, nshells, self.Nsmoke, self.Nillu, self.Nukes, self.nukewarhead/1000000, nrockets, nmissiles))
if self.Controllable and self.Controllable:IsAlive() then
local nammo, nshells, nrockets, nmissiles=self:GetAmmo()
-- We have a cargo group ==> check if group was loaded into a carrier.
if self.cargogroup then
if self.iscargo and self.cargogroup then
if self.cargogroup:IsLoaded() and not self:is("InTransit") then
-- Group is now InTransit state. Current target is canceled.
self:T(self.lid..string.format("Group %s has been loaded into a carrier and is now transported.", self.alias))
@ -2786,17 +2780,17 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
end
end
-- FSM state.
local fsmstate=self:GetState()
self:T(self.lid..string.format("Status %s, Ammo total=%d: shells=%d [smoke=%d, illu=%d, nukes=%d*%.3f kT], rockets=%d, missiles=%d", fsmstate, nammo, nshells, self.Nsmoke, self.Nillu, self.Nukes, self.nukewarhead/1000000, nrockets, nmissiles))
if self.Controllable and self.Controllable:IsAlive() then
-- Debug current status info.
if self.Debug then
self:_StatusReport()
end
-- Group is being transported as cargo ==> skip everything and check again in 5 seconds.
if self:is("InTransit") then
self:__Status(-5)
return
end
-- Group on the move.
if self:is("Moving") then
self:T2(self.lid..string.format("%s: Moving", Controllable:GetName()))
@ -2883,7 +2877,7 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
end
-- Get ammo.
local nammo, nshells, nrockets, nmissiles=self:GetAmmo()
--local nammo, nshells, nrockets, nmissiles=self:GetAmmo()
-- Check if we have a target in the queue for which weapons are still available.
local gotsome=false
@ -2913,9 +2907,23 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
-- Call status again in ~10 sec.
self:__Status(self.StatusInterval)
elseif self.iscargo then
-- We have a cargo group ==> check if group was loaded into a carrier.
if self.cargogroup and self.cargogroup:IsAlive() then
-- Group is being transported as cargo ==> skip everything and check again in 5 seconds.
if self:is("InTransit") then
self:__Status(-5)
end
end
else
self:E(self.lid..string.format("Arty group %s is not alive!", self.groupname))
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------