diff --git a/Moose Development/Moose/Functional/Warehouse.lua b/Moose Development/Moose/Functional/Warehouse.lua index 6c40fdd1c..f38c71d8e 100644 --- a/Moose Development/Moose/Functional/Warehouse.lua +++ b/Moose Development/Moose/Functional/Warehouse.lua @@ -302,8 +302,8 @@ -- -- Initial Spawn states is as follows: -- GROUND: ROE, "Return Fire" Alarm, "Green" --- AIR: ROE, "Return Fire" Reaction to Threat, "Passive Defense" --- NAVAL ROE, "Return Fire" Alarm,"N/A" +-- AIR: ROE, "Return Fire" Reaction to Threat, "Passive Defense" +-- NAVAL ROE, "Return Fire" Alarm,"N/A" -- -- A request can be added by the @{#WAREHOUSE.AddRequest}(*warehouse*, *AssetDescriptor*, *AssetDescriptorValue*, *nAsset*, *TransportType*, *nTransport*, *Prio*, *Assignment*) function. -- The parameters are @@ -1626,7 +1626,6 @@ WAREHOUSE = { -- @field #string spawngroupname Name of the spawned group. -- @field #boolean iscargo If true, asset is cargo. If false asset is transport. Nil if in stock. -- @field #boolean arrived If true, asset arrived at its destination. --- @field Core.Point#COORDINATE spawncoordinate If set, spawn asst here and not in the designated spawn zone. -- -- @field #number damage Damage of asset group in percent. -- @field Ops.AirWing#AIRWING.Payload payload The payload of the asset. @@ -1796,7 +1795,7 @@ _WAREHOUSEDB = { --- Warehouse class version. -- @field #string version -WAREHOUSE.version="1.0.3" +WAREHOUSE.version="1.0.2" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO: Warehouse todo list. @@ -4250,11 +4249,9 @@ end -- @param #number nTransport Number of transport units requested. -- @param #number Prio Priority of the request. Number ranging from 1=high to 100=low. -- @param #string Assignment A keyword or text that later be used to identify this request and postprocess the assets. --- @param Core.Point#COORDINATE SpawnCoordinate Spawn group here instead of the SpawnZone. -- @return #boolean If true, request is okay at first glance. -function WAREHOUSE:onbeforeAddRequest(From, Event, To, warehouse, AssetDescriptor, AssetDescriptorValue, nAsset, TransportType, nTransport, Assignment, Prio, SpawnCoordinate) - -- self:I({From, Event, To}) - --self:I({SpawnCoordinate=SpawnCoordinate}) +function WAREHOUSE:onbeforeAddRequest(From, Event, To, warehouse, AssetDescriptor, AssetDescriptorValue, nAsset, TransportType, nTransport, Assignment, Prio) + -- Request is okay. local okay=true @@ -4347,10 +4344,8 @@ end -- @param #number nTransport Number of transport units requested. -- @param #number Prio Priority of the request. Number ranging from 1=high to 100=low. -- @param #string Assignment A keyword or text that can later be used to identify this request and postprocess the assets. --- @param Core.Point#COORDINATE SpawnCoordinate Spawn group here instead of the SpawnZone. -function WAREHOUSE:onafterAddRequest(From, Event, To, warehouse, AssetDescriptor, AssetDescriptorValue, nAsset, TransportType, nTransport, Prio, Assignment, SpawnCoordinate) - --self:I({From, Event, To}) - --self:I({SpawnCoordinate=SpawnCoordinate}) +function WAREHOUSE:onafterAddRequest(From, Event, To, warehouse, AssetDescriptor, AssetDescriptorValue, nAsset, TransportType, nTransport, Prio, Assignment) + -- Defaults. nAsset=nAsset or 1 TransportType=TransportType or WAREHOUSE.TransportType.SELFPROPELLED @@ -4389,7 +4384,6 @@ function WAREHOUSE:onafterAddRequest(From, Event, To, warehouse, AssetDescriptor ntransporthome=0, assets={}, toself=toself, - spawncoordinate=SpawnCoordinate, } --#WAREHOUSE.Queueitem -- Add request to queue. @@ -5820,8 +5814,7 @@ end -- @param #boolean lateactivated If true, groups are spawned late activated. -- @return Wrapper.Group#GROUP The spawned group or nil if the group could not be spawned. function WAREHOUSE:_SpawnAssetGroundNaval(alias, asset, request, spawnzone, lateactivated) - --self:I("_SpawnAssetGroundNaval - " .. tostring(asset.templatename)) - --self:I({coordinate = request.spawncoordinate}) + if asset and (asset.category==Group.Category.GROUND or asset.category==Group.Category.SHIP or asset.category==Group.Category.TRAIN) then -- Prepare spawn template. @@ -5832,12 +5825,7 @@ function WAREHOUSE:_SpawnAssetGroundNaval(alias, asset, request, spawnzone, late -- Get a random coordinate in the spawn zone. local coord=spawnzone:GetRandomCoordinate() - - -- Is a specific coordinate set? - if request.spawncoordinate then - coord = request.spawncoordinate - end - + -- For trains, we use the rail connection point. if asset.category==Group.Category.TRAIN then coord=self.rail @@ -7654,7 +7642,7 @@ end -- @param #WAREHOUSE self -- @return #WAREHOUSE.Queueitem Chosen request. function WAREHOUSE:_CheckQueue() - --self:T("_CheckQueue()") + -- Sort queue wrt to first prio and then qid. self:_SortQueue() @@ -7692,13 +7680,7 @@ function WAREHOUSE:_CheckQueue() self:_DeleteQueueItem(_request, self.queue) end - --[[ Execute request. - if request and type(request) == "table" then - for _key,_value in pairs(request) do - self:I("Key = ".. tostring(_key)) - end - end - --]] + -- Execute request. return request end diff --git a/Moose Development/Moose/Ops/Auftrag.lua b/Moose Development/Moose/Ops/Auftrag.lua index a9d60ed26..0b45243e1 100644 --- a/Moose Development/Moose/Ops/Auftrag.lua +++ b/Moose Development/Moose/Ops/Auftrag.lua @@ -162,8 +162,6 @@ -- @field #number optionRTBfuel RTB on out-of-fuel. -- @field #number optionECM ECM. -- --- @field Core.Point#COORDINATE specialCoordinate Special point to reload Brigade units in place. --- -- @extends Core.Fsm#FSM --- *A warrior's mission is to foster the success of others.* - Morihei Ueshiba diff --git a/Moose Development/Moose/Ops/Legion.lua b/Moose Development/Moose/Ops/Legion.lua index 18c1422c3..78ad12b77 100644 --- a/Moose Development/Moose/Ops/Legion.lua +++ b/Moose Development/Moose/Ops/Legion.lua @@ -324,7 +324,7 @@ function LEGION:AddMission(Mission) -- Set target for ALERT 5. if Mission.type==AUFTRAG.Type.ALERT5 then - --Mission:_TargetFromObject(self:GetCoordinate()) + Mission:_TargetFromObject(self:GetCoordinate()) end -- Add mission to queue. @@ -694,10 +694,6 @@ function LEGION:onafterMissionRequest(From, Event, To, Mission) asset.flightgroup:MissionCancel(currM) end - -- Cancel the current mission. - if currM and currM.type==AUFTRAG.Type.ONGUARD then - asset.flightgroup:MissionCancel(currM) - end -- Trigger event. self:__OpsOnMission(5, asset.flightgroup, Mission) @@ -725,23 +721,18 @@ function LEGION:onafterMissionRequest(From, Event, To, Mission) asset.requested=true asset.isReserved=false - -- Set mission task so that the group is spawned with the right one. + -- Set missin task so that the group is spawned with the right one. if Mission.missionTask then asset.missionTask=Mission.missionTask end end - - local coordinate = nil - if Mission.specialCoordinate then - coordinate = Mission.specialCoordinate - end - + -- TODO: Get/set functions for assignment string. local assignment=string.format("Mission-%d", Mission.auftragsnummer) -- Add request to legion warehouse. - self:AddRequest(self, WAREHOUSE.Descriptor.ASSETLIST, Assetlist, #Assetlist, nil, nil, Mission.prio, assignment, coordinate) + self:AddRequest(self, WAREHOUSE.Descriptor.ASSETLIST, Assetlist, #Assetlist, nil, nil, Mission.prio, assignment) -- The queueid has been increased in the onafterAddRequest function. So we can simply use it here. Mission.requestID[self.alias]=self.queueid diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index 57fa9cd15..ea55e3357 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -2159,7 +2159,7 @@ function UTILS.LoadSetOfGroups(Path,Filename,Spawn) local posz = tonumber(dataset[6]) local coordinate = COORDINATE:NewFromVec3({x=posx, y=posy, z=posz}) local group=nil - local data = { groupname=groupname, template=template, size=size, coordinate=coordinate } + local data = { groupname=groupname, size=size, coordinate=coordinate } table.insert(datatable,data) if spawn then local group = SPAWN:New(groupname)