mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-24 03:55:27 +00:00
warehouse
little changes
This commit is contained in:
@@ -164,9 +164,11 @@
|
|||||||
-- * *Prio*: (Optional) A number between 1 (high) and 100 (low) describing the priority of the request. Request with high priority are processed first. Default is 50, i.e. medium priority.
|
-- * *Prio*: (Optional) A number between 1 (high) and 100 (low) describing the priority of the request. Request with high priority are processed first. Default is 50, i.e. medium priority.
|
||||||
-- * *Assignment*: (Optional) A free to choose string describing the assignment. For self requests, this can be used to assign the spawned groups to specific tasks.
|
-- * *Assignment*: (Optional) A free to choose string describing the assignment. For self requests, this can be used to assign the spawned groups to specific tasks.
|
||||||
--
|
--
|
||||||
|
-- ## Requesting by Generalized Attribute
|
||||||
|
--
|
||||||
-- For example:
|
-- For example:
|
||||||
--
|
--
|
||||||
-- warehouseBatumi:AddRequest(warehouseKobuleti, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 5, WAREHOUSE.TransportType.APC, 2, 20)
|
-- warehouseBatumi:AddRequest(warehouseKobuleti, WAREHOUSE.Descriptor.ATTRIBUTE, WAREHOUSE.Attribute.GROUND_INFANTRY, 5, WAREHOUSE.TransportType.APC, 2)
|
||||||
--
|
--
|
||||||
-- Here, warehouse Kobuleti requests 5 infantry groups from warehouse Batumi. These "cargo" assets should be transported from Batumi to Kobuleti by 2 APCS.
|
-- Here, warehouse Kobuleti requests 5 infantry groups from warehouse Batumi. These "cargo" assets should be transported from Batumi to Kobuleti by 2 APCS.
|
||||||
-- Note that the warehouse at Batumi needs to have at least five infantry groups and two APC groups in their stock if the request can be processed.
|
-- Note that the warehouse at Batumi needs to have at least five infantry groups and two APC groups in their stock if the request can be processed.
|
||||||
@@ -184,7 +186,7 @@
|
|||||||
-- Here, Kobuleti requests a specific unit type, in particular two groups of A-10Cs. Note that the spelling is important as it must exacly be the same as
|
-- Here, Kobuleti requests a specific unit type, in particular two groups of A-10Cs. Note that the spelling is important as it must exacly be the same as
|
||||||
-- what one get's when using the DCS unit type.
|
-- what one get's when using the DCS unit type.
|
||||||
--
|
--
|
||||||
-- ## Requesting a Specifc Group
|
-- ## Requesting a Specific Group
|
||||||
--
|
--
|
||||||
-- An even more specific request would be:
|
-- An even more specific request would be:
|
||||||
--
|
--
|
||||||
@@ -192,7 +194,7 @@
|
|||||||
--
|
--
|
||||||
-- In this case three groups named "Group Name as in ME" are requested. So this explicitly request the groups named like that in the Mission Editor.
|
-- In this case three groups named "Group Name as in ME" are requested. So this explicitly request the groups named like that in the Mission Editor.
|
||||||
--
|
--
|
||||||
-- ## Requesting a general category
|
-- ## Requesting a General Category
|
||||||
--
|
--
|
||||||
-- On the other hand, very general unspecifc requests can be made as
|
-- On the other hand, very general unspecifc requests can be made as
|
||||||
--
|
--
|
||||||
@@ -200,6 +202,8 @@
|
|||||||
--
|
--
|
||||||
-- Here, Kubuleti requests 10 ground groups and does not care which ones. This could be a mix of infantry, APCs, trucks etc.
|
-- Here, Kubuleti requests 10 ground groups and does not care which ones. This could be a mix of infantry, APCs, trucks etc.
|
||||||
--
|
--
|
||||||
|
-- **Note** that these general requests should be made with *great care* due to the fact, that depending on what a warehouse has in stock a lot of different unit types can be spawned.
|
||||||
|
--
|
||||||
-- # Employing Assets
|
-- # Employing Assets
|
||||||
--
|
--
|
||||||
-- Assets in the warehouse' stock can used for user defined tasks realtively easily. They can be spawned into the game by a "self request", i.e. the warehouse
|
-- Assets in the warehouse' stock can used for user defined tasks realtively easily. They can be spawned into the game by a "self request", i.e. the warehouse
|
||||||
@@ -1655,8 +1659,13 @@ function WAREHOUSE:AddOffRoadPath(remotewarehouse, group, oneway)
|
|||||||
-- Create new path from template group waypoints.
|
-- Create new path from template group waypoints.
|
||||||
local path=self:_NewLane(group, startcoord, finalcoord)
|
local path=self:_NewLane(group, startcoord, finalcoord)
|
||||||
|
|
||||||
|
if path==nil then
|
||||||
|
self:E(self.wid.."ERROR: Offroad path could not be added. Group present in ME?")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Debug info. Marks along path.
|
-- Debug info. Marks along path.
|
||||||
if self.Debug then
|
if path and self.Debug then
|
||||||
for i=1,#path do
|
for i=1,#path do
|
||||||
local coord=path[i] --Core.Point#COORDINATE
|
local coord=path[i] --Core.Point#COORDINATE
|
||||||
local text=string.format("Off road path from %s to %s. Point %d.", self.alias, remotewarehouse.alias, i)
|
local text=string.format("Off road path from %s to %s. Point %d.", self.alias, remotewarehouse.alias, i)
|
||||||
@@ -1691,40 +1700,46 @@ end
|
|||||||
-- @return #table Table with route points.
|
-- @return #table Table with route points.
|
||||||
function WAREHOUSE:_NewLane(group, startcoord, finalcoord)
|
function WAREHOUSE:_NewLane(group, startcoord, finalcoord)
|
||||||
|
|
||||||
-- Get route from template.
|
local lane=nil
|
||||||
local lanepoints=group:GetTemplateRoutePoints()
|
|
||||||
|
if group then
|
||||||
-- First and last waypoints
|
|
||||||
local laneF=lanepoints[1]
|
-- Get route from template.
|
||||||
local laneL=lanepoints[#lanepoints]
|
local lanepoints=group:GetTemplateRoutePoints()
|
||||||
|
|
||||||
-- Get corresponding coordinates.
|
-- First and last waypoints
|
||||||
local coordF=COORDINATE:New(laneF.x, 0, laneF.y)
|
local laneF=lanepoints[1]
|
||||||
local coordL=COORDINATE:New(laneL.x, 0, laneL.y)
|
local laneL=lanepoints[#lanepoints]
|
||||||
|
|
||||||
-- Figure out which point is closer to the port of this warehouse.
|
-- Get corresponding coordinates.
|
||||||
local distF=startcoord:Get2DDistance(coordF)
|
local coordF=COORDINATE:New(laneF.x, 0, laneF.y)
|
||||||
local distL=startcoord:Get2DDistance(coordL)
|
local coordL=COORDINATE:New(laneL.x, 0, laneL.y)
|
||||||
|
|
||||||
-- Add the lane. Need to take care of the wrong "direction".
|
-- Figure out which point is closer to the port of this warehouse.
|
||||||
local lane={}
|
local distF=startcoord:Get2DDistance(coordF)
|
||||||
if distF<distL then
|
local distL=startcoord:Get2DDistance(coordL)
|
||||||
for i=1,#lanepoints do
|
|
||||||
local point=lanepoints[i]
|
-- Add the lane. Need to take care of the wrong "direction".
|
||||||
local coord=COORDINATE:New(point.x,0, point.y)
|
lane={}
|
||||||
table.insert(lane, coord)
|
if distF<distL then
|
||||||
|
for i=1,#lanepoints do
|
||||||
|
local point=lanepoints[i]
|
||||||
|
local coord=COORDINATE:New(point.x,0, point.y)
|
||||||
|
table.insert(lane, coord)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i=#lanepoints,1,-1 do
|
||||||
|
local point=lanepoints[i]
|
||||||
|
local coord=COORDINATE:New(point.x,0, point.y)
|
||||||
|
table.insert(lane, coord)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
for i=#lanepoints,1,-1 do
|
-- Automatically add end point which is a random point inside the final port zone.
|
||||||
local point=lanepoints[i]
|
table.insert(lane, #lane, finalcoord)
|
||||||
local coord=COORDINATE:New(point.x,0, point.y)
|
|
||||||
table.insert(lane, coord)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Automatically add end point which is a random point inside the final port zone.
|
|
||||||
table.insert(lane, #lane, finalcoord)
|
|
||||||
|
|
||||||
return lane
|
return lane
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -6174,7 +6189,7 @@ end
|
|||||||
-- @param #table stock Table holding all assets in stock of the warehouse. Each entry is of type @{#WAREHOUSE.Assetitem}.
|
-- @param #table stock Table holding all assets in stock of the warehouse. Each entry is of type @{#WAREHOUSE.Assetitem}.
|
||||||
function WAREHOUSE:_DisplayStockItems(stock)
|
function WAREHOUSE:_DisplayStockItems(stock)
|
||||||
|
|
||||||
local text=self.wid..string.format("Warehouse %s stock assets:", self.airbase:GetName())
|
local text=self.wid..string.format("Warehouse %s stock assets:", self.alias)
|
||||||
for _i,_stock in pairs(stock) do
|
for _i,_stock in pairs(stock) do
|
||||||
local mystock=_stock --#WAREHOUSE.Assetitem
|
local mystock=_stock --#WAREHOUSE.Assetitem
|
||||||
local name=mystock.templatename
|
local name=mystock.templatename
|
||||||
|
|||||||
Reference in New Issue
Block a user