mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Arty v1.2.0
- fixed cargo issue
This commit is contained in:
parent
4869ae4baa
commit
01a5b523da
@ -483,7 +483,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string From
|
-- @param #string From
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Core.Point#POINT_VEC2
|
-- @param Core.Point#POINT_VEC2 ToPointVec2
|
||||||
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
|
function CARGO_GROUP:onafterUnLoad( From, Event, To, ToPointVec2, ... )
|
||||||
--self:F( { From, Event, To, ToPointVec2 } )
|
--self:F( { From, Event, To, ToPointVec2 } )
|
||||||
|
|
||||||
@ -493,7 +493,10 @@ do -- CARGO_GROUP
|
|||||||
self.CargoSet:ForEach(
|
self.CargoSet:ForEach(
|
||||||
function( Cargo )
|
function( Cargo )
|
||||||
--Cargo:UnLoad( ToPointVec2 )
|
--Cargo:UnLoad( ToPointVec2 )
|
||||||
local RandomVec2=ToPointVec2:GetRandomPointVec2InRadius(20, 10)
|
local RandomVec2=nil
|
||||||
|
if ToPointVec2 then
|
||||||
|
RandomVec2=ToPointVec2:GetRandomPointVec2InRadius(20, 10)
|
||||||
|
end
|
||||||
Cargo:UnBoard( RandomVec2 )
|
Cargo:UnBoard( RandomVec2 )
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|||||||
@ -693,7 +693,7 @@ ARTY.db={
|
|||||||
|
|
||||||
--- Arty script version.
|
--- Arty script version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
ARTY.version="1.1.9"
|
ARTY.version="1.2.0"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -2765,38 +2765,32 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
|
|||||||
self:_EventFromTo("onafterStatus", Event, From, To)
|
self:_EventFromTo("onafterStatus", Event, From, To)
|
||||||
|
|
||||||
-- Get ammo.
|
-- Get ammo.
|
||||||
local ntot, nshells, nrockets, nmissiles=self:GetAmmo()
|
local nammo, nshells, nrockets, nmissiles=self:GetAmmo()
|
||||||
|
|
||||||
|
-- We have a cargo group ==> check if group was loaded into a carrier.
|
||||||
|
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))
|
||||||
|
self:Loaded()
|
||||||
|
elseif self.cargogroup:IsUnLoaded() then
|
||||||
|
-- Group has been unloaded and is combat ready again.
|
||||||
|
self:T(self.lid..string.format("Group %s has been unloaded from the carrier.", self.alias))
|
||||||
|
self:UnLoaded()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- FSM state.
|
-- FSM state.
|
||||||
local fsmstate=self:GetState()
|
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))
|
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
|
if self.Controllable and self.Controllable:IsAlive() then
|
||||||
|
|
||||||
-- We have a cargo group ==> check if group was loaded into a carrier.
|
|
||||||
if 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))
|
|
||||||
self:Loaded()
|
|
||||||
elseif self.cargogroup:IsUnLoaded() then
|
|
||||||
-- Group has been unloaded and is combat ready again.
|
|
||||||
self:T(self.lid..string.format("Group %s has been unloaded from the carrier.", self.alias))
|
|
||||||
self:UnLoaded()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Debug current status info.
|
-- Debug current status info.
|
||||||
if self.Debug then
|
if self.Debug then
|
||||||
self:_StatusReport()
|
self:_StatusReport()
|
||||||
end
|
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.
|
-- Group on the move.
|
||||||
if self:is("Moving") then
|
if self:is("Moving") then
|
||||||
self:T2(self.lid..string.format("%s: Moving", Controllable:GetName()))
|
self:T2(self.lid..string.format("%s: Moving", Controllable:GetName()))
|
||||||
@ -2883,7 +2877,7 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Get ammo.
|
-- 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.
|
-- Check if we have a target in the queue for which weapons are still available.
|
||||||
local gotsome=false
|
local gotsome=false
|
||||||
@ -2913,9 +2907,23 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
|
|||||||
-- Call status again in ~10 sec.
|
-- Call status again in ~10 sec.
|
||||||
self:__Status(self.StatusInterval)
|
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
|
else
|
||||||
self:E(self.lid..string.format("Arty group %s is not alive!", self.groupname))
|
self:E(self.lid..string.format("Arty group %s is not alive!", self.groupname))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user