mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-21 11:53:30 +00:00
Warehosue v0.3.4
Fixed some bugs. Helos on ships are now not spawned in uncontrolled state due to DCS bug. Self requests are not deleted from the pending queue any more in case they return to their warehouse.
This commit is contained in:
@@ -650,7 +650,7 @@ function AI_FORMATION:onafterFormationLine( FollowGroupSet, From , Event , To, X
|
|||||||
|
|
||||||
local FollowSet = FollowGroupSet:GetSet()
|
local FollowSet = FollowGroupSet:GetSet()
|
||||||
|
|
||||||
local i = 0
|
local i = 1 --FF i=0 caused first unit to have no XSpace! Probably needs further adjustments. This is just a quick work around.
|
||||||
|
|
||||||
for FollowID, FollowGroup in pairs( FollowSet ) do
|
for FollowID, FollowGroup in pairs( FollowSet ) do
|
||||||
|
|
||||||
|
|||||||
@@ -1118,7 +1118,8 @@ function ZONE_UNIT:GetRandomVec2()
|
|||||||
self:F( self.ZoneName )
|
self:F( self.ZoneName )
|
||||||
|
|
||||||
local RandomVec2 = {}
|
local RandomVec2 = {}
|
||||||
local Vec2 = self.ZoneUNIT:GetVec2()
|
--local Vec2 = self.ZoneUNIT:GetVec2() -- FF: This does not take care of the new offset feature!
|
||||||
|
local Vec2 = self:GetVec2()
|
||||||
|
|
||||||
if not Vec2 then
|
if not Vec2 then
|
||||||
Vec2 = self.LastVec2
|
Vec2 = self.LastVec2
|
||||||
|
|||||||
@@ -458,7 +458,7 @@ WAREHOUSE.Attribute = {
|
|||||||
NAVAL_ARMEDSHIP="Naval_ArmedShip",
|
NAVAL_ARMEDSHIP="Naval_ArmedShip",
|
||||||
NAVAL_UNARMEDSHIP="Naval_UnarmedShip",
|
NAVAL_UNARMEDSHIP="Naval_UnarmedShip",
|
||||||
NAVAL_OTHER="Naval_OtherNaval",
|
NAVAL_OTHER="Naval_OtherNaval",
|
||||||
UNKNOWN="Unknown",
|
UNKNOWN="Other_Unknown",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Cargo transport type. Defines how assets are transported to their destination.
|
--- Cargo transport type. Defines how assets are transported to their destination.
|
||||||
@@ -489,7 +489,7 @@ WAREHOUSE.db = {
|
|||||||
|
|
||||||
--- Warehouse class version.
|
--- Warehouse class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
WAREHOUSE.version="0.3.3"
|
WAREHOUSE.version="0.3.4"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO: Warehouse todo list.
|
-- TODO: Warehouse todo list.
|
||||||
@@ -1178,6 +1178,12 @@ function WAREHOUSE:HasConnectionNaval(warehouse, markpath, smokepath)
|
|||||||
|
|
||||||
if warehouse then
|
if warehouse then
|
||||||
|
|
||||||
|
-- Self request
|
||||||
|
if warehouse.warehouse:GetName()==self.warehouse:GetName() then
|
||||||
|
return true,1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get shipping lane.
|
||||||
local shippinglane=self.shippinglanes[warehouse.warehouse:GetName()]
|
local shippinglane=self.shippinglanes[warehouse.warehouse:GetName()]
|
||||||
|
|
||||||
if shippinglane then
|
if shippinglane then
|
||||||
@@ -1354,6 +1360,9 @@ end
|
|||||||
function WAREHOUSE:onafterStatus(From, Event, To)
|
function WAREHOUSE:onafterStatus(From, Event, To)
|
||||||
self:I(self.wid..string.format("Checking status of warehouse %s. Current FSM state %s. Global warehouse assets = %d.", self.alias, self:GetState(), #WAREHOUSE.db.Assets))
|
self:I(self.wid..string.format("Checking status of warehouse %s. Current FSM state %s. Global warehouse assets = %d.", self.alias, self:GetState(), #WAREHOUSE.db.Assets))
|
||||||
|
|
||||||
|
-- Update coordinate in case we have a "moving" warehouse (e.g. on a carrier).
|
||||||
|
self.coordinate=self.warehouse:GetCoordinate()
|
||||||
|
|
||||||
-- Print status.
|
-- Print status.
|
||||||
self:_DisplayStatus()
|
self:_DisplayStatus()
|
||||||
|
|
||||||
@@ -1439,7 +1448,7 @@ function WAREHOUSE:onafterAddAsset(From, Event, To, group, ngroups, forceattribu
|
|||||||
else
|
else
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:_Debugmessage(self.wid..string.format("Adding %d NEW assets of group %s to warehouse %s.", n, tostring(group:GetName()), self.alias), 5)
|
self:_DebugMessage(self.wid..string.format("Adding %d NEW assets of group %s to warehouse %s.", n, tostring(group:GetName()), self.alias), 5)
|
||||||
|
|
||||||
|
|
||||||
-- This is a group that is not in the db yet. Add it n times.
|
-- This is a group that is not in the db yet. Add it n times.
|
||||||
@@ -1641,6 +1650,8 @@ function WAREHOUSE:_SpawnAssetGroundNaval(asset, request, spawnzone, aioff)
|
|||||||
-- Get a random coordinate in the spawn zone.
|
-- Get a random coordinate in the spawn zone.
|
||||||
local coord=spawnzone:GetRandomCoordinate()
|
local coord=spawnzone:GetRandomCoordinate()
|
||||||
|
|
||||||
|
--spawnzone:SmokeZone(1, 30)
|
||||||
|
|
||||||
-- Translate the position of the units.
|
-- Translate the position of the units.
|
||||||
for i=1,#template.units do
|
for i=1,#template.units do
|
||||||
|
|
||||||
@@ -1690,8 +1701,9 @@ end
|
|||||||
-- @param #WAREHOUSE.Queueitem request Request belonging to this asset. Needed for the name/alias.
|
-- @param #WAREHOUSE.Queueitem request Request belonging to this asset. Needed for the name/alias.
|
||||||
-- @param #table parking Parking data for this asset.
|
-- @param #table parking Parking data for this asset.
|
||||||
-- @param #boolean uncontrolled Spawn aircraft in uncontrolled state.
|
-- @param #boolean uncontrolled Spawn aircraft in uncontrolled state.
|
||||||
|
-- @param #boolean hotstart Spawn aircraft with engines already on. Default is a cold start with engines off.
|
||||||
-- @return Wrapper.Group#GROUP The spawned group or nil if the group could not be spawned.
|
-- @return Wrapper.Group#GROUP The spawned group or nil if the group could not be spawned.
|
||||||
function WAREHOUSE:_SpawnAssetAircraft(asset, request, parking, uncontrolled)
|
function WAREHOUSE:_SpawnAssetAircraft(asset, request, parking, uncontrolled, hotstart)
|
||||||
|
|
||||||
if asset and asset.category==Group.Category.AIRPLANE or asset.category==Group.Category.HELICOPTER then
|
if asset and asset.category==Group.Category.AIRPLANE or asset.category==Group.Category.HELICOPTER then
|
||||||
|
|
||||||
@@ -1706,8 +1718,6 @@ function WAREHOUSE:_SpawnAssetAircraft(asset, request, parking, uncontrolled)
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
local hotstart=true
|
|
||||||
|
|
||||||
-- Cold start (default).
|
-- Cold start (default).
|
||||||
local _type=COORDINATE.WaypointType.TakeOffParking
|
local _type=COORDINATE.WaypointType.TakeOffParking
|
||||||
local _action=COORDINATE.WaypointAction.FromParkingArea
|
local _action=COORDINATE.WaypointAction.FromParkingArea
|
||||||
@@ -1782,6 +1792,12 @@ function WAREHOUSE:_SpawnAssetAircraft(asset, request, parking, uncontrolled)
|
|||||||
template.x = template.units[1].x
|
template.x = template.units[1].x
|
||||||
template.y = template.units[1].y
|
template.y = template.units[1].y
|
||||||
|
|
||||||
|
-- DCS bug workaround. Spawning helos in uncontrolled state on carriers causes a big spash!
|
||||||
|
-- See https://forums.eagle.ru/showthread.php?t=219550
|
||||||
|
if AirbaseCategory == Airbase.Category.SHIP and asset.category==Group.Category.HELICOPTER then
|
||||||
|
uncontrolled=false
|
||||||
|
end
|
||||||
|
|
||||||
-- Uncontrolled spawning.
|
-- Uncontrolled spawning.
|
||||||
template.uncontrolled=uncontrolled
|
template.uncontrolled=uncontrolled
|
||||||
|
|
||||||
@@ -2710,7 +2726,7 @@ function WAREHOUSE:onafterSelfRequest(From, Event, To, groupset, request)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Remove pending request.
|
-- Remove pending request.
|
||||||
self:_DeleteQueueItem(request, self.pending)
|
--self:_DeleteQueueItem(request, self.pending)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "Attacked" event. Warehouse is under attack by an another coalition.
|
--- On after "Attacked" event. Warehouse is under attack by an another coalition.
|
||||||
@@ -3468,7 +3484,7 @@ function WAREHOUSE:_CheckRequestConsistancy(queue)
|
|||||||
local request=_request --#WAREHOUSE.Queueitem
|
local request=_request --#WAREHOUSE.Queueitem
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T2(self.wid..string.format("Checking request = %d.", request.uid))
|
self:T2(self.wid..string.format("Checking request id=%d.", request.uid))
|
||||||
|
|
||||||
-- Let's assume everything is fine.
|
-- Let's assume everything is fine.
|
||||||
local valid=true
|
local valid=true
|
||||||
@@ -4632,12 +4648,10 @@ function WAREHOUSE:_GetStockAssetsText(messagetoall)
|
|||||||
-- Get assets in stock.
|
-- Get assets in stock.
|
||||||
local _data=self:GetStockInfo(self.stock)
|
local _data=self:GetStockInfo(self.stock)
|
||||||
|
|
||||||
--[[
|
|
||||||
local function _sort(a,b)
|
local function _sort(a,b)
|
||||||
return a<b
|
return a[1]<b[1]
|
||||||
end
|
end
|
||||||
table.sort(_data, _sort)
|
table.sort(_data, _sort)
|
||||||
]]
|
|
||||||
|
|
||||||
-- Text.
|
-- Text.
|
||||||
local text="Stock:\n"
|
local text="Stock:\n"
|
||||||
@@ -4677,7 +4691,7 @@ function WAREHOUSE:_UpdateWarehouseMarkText()
|
|||||||
local total=0
|
local total=0
|
||||||
for _attribute,_count in pairs(_data) do
|
for _attribute,_count in pairs(_data) do
|
||||||
local attribute=tostring(UTILS.Split(_attribute, "_")[2])
|
local attribute=tostring(UTILS.Split(_attribute, "_")[2])
|
||||||
text=text..string.format("%s=%d", attribute,_count)
|
text=text..string.format("%s=%d, ", attribute,_count)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create/update marker at warehouse in F10 map.
|
-- Create/update marker at warehouse in F10 map.
|
||||||
|
|||||||
Reference in New Issue
Block a user