mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-13 17:31:41 +00:00
[ADDED] UNIT:IsEWR()
This commit is contained in:
@@ -4462,8 +4462,8 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function CTLD:_UnloadSingleTroopByID(Group, Unit, cargoID)
|
function CTLD:_UnloadSingleTroopByName(Group, Unit, CargoName)
|
||||||
self:T(self.lid .. " _UnloadSingleTroopByID for cargo ID " .. tostring(cargoID))
|
self:T(self.lid .. " _UnloadSingleTroopByID for cargo ID " .. tostring(CargoName))
|
||||||
|
|
||||||
-- check if we are in LOAD zone
|
-- check if we are in LOAD zone
|
||||||
local droppingatbase = false
|
local droppingatbase = false
|
||||||
@@ -4511,7 +4511,7 @@ function CTLD:_UnloadSingleTroopByID(Group, Unit, cargoID)
|
|||||||
for _, cargoObj in ipairs(cargoList) do
|
for _, cargoObj in ipairs(cargoList) do
|
||||||
if (cargoObj:GetType() == CTLD_CARGO.Enum.TROOPS or cargoObj:GetType() == CTLD_CARGO.Enum.ENGINEERS)
|
if (cargoObj:GetType() == CTLD_CARGO.Enum.TROOPS or cargoObj:GetType() == CTLD_CARGO.Enum.ENGINEERS)
|
||||||
and not cargoObj:WasDropped()
|
and not cargoObj:WasDropped()
|
||||||
and (cargoObj:GetID() == cargoID)
|
and (cargoObj:GetName() == CargoName)
|
||||||
then
|
then
|
||||||
foundCargo = cargoObj
|
foundCargo = cargoObj
|
||||||
break
|
break
|
||||||
@@ -4593,7 +4593,7 @@ function CTLD:_UnloadSingleTroopByID(Group, Unit, cargoID)
|
|||||||
local cargoList = loadedCargoData.Cargo or {}
|
local cargoList = loadedCargoData.Cargo or {}
|
||||||
for _, cObj in ipairs(cargoList) do
|
for _, cObj in ipairs(cargoList) do
|
||||||
if (cObj:GetType() == CTLD_CARGO.Enum.TROOPS or cObj:GetType() == CTLD_CARGO.Enum.ENGINEERS)
|
if (cObj:GetType() == CTLD_CARGO.Enum.TROOPS or cObj:GetType() == CTLD_CARGO.Enum.ENGINEERS)
|
||||||
and (cObj:GetID() == cargoID)
|
and (cObj:GetName() == CargoName)
|
||||||
then
|
then
|
||||||
-- Return this one cargo to stock
|
-- Return this one cargo to stock
|
||||||
local cName = cObj:GetName()
|
local cName = cObj:GetName()
|
||||||
@@ -4608,6 +4608,7 @@ function CTLD:_UnloadSingleTroopByID(Group, Unit, cargoID)
|
|||||||
end
|
end
|
||||||
-- Mark it as dropped so we remove it from the loaded cargo
|
-- Mark it as dropped so we remove it from the loaded cargo
|
||||||
cObj:SetWasDropped(true)
|
cObj:SetWasDropped(true)
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -4671,6 +4672,20 @@ function CTLD:_RefreshDropTroopsMenu(Group, Unit)
|
|||||||
MENU_GROUP_COMMAND:New(theGroup,"Drop ALL troops",dropTroopsMenu,self._UnloadTroops,self,theGroup,theUnit)
|
MENU_GROUP_COMMAND:New(theGroup,"Drop ALL troops",dropTroopsMenu,self._UnloadTroops,self,theGroup,theUnit)
|
||||||
local loadedData=self.Loaded_Cargo[theUnit:GetName()]
|
local loadedData=self.Loaded_Cargo[theUnit:GetName()]
|
||||||
if loadedData and loadedData.Cargo then
|
if loadedData and loadedData.Cargo then
|
||||||
|
local loaded = {}
|
||||||
|
for i,cargoObj in ipairs(loadedData.Cargo) do
|
||||||
|
if cargoObj and (cargoObj:GetType()==CTLD_CARGO.Enum.TROOPS or cargoObj:GetType()==CTLD_CARGO.Enum.ENGINEERS)
|
||||||
|
and not cargoObj:WasDropped()
|
||||||
|
then
|
||||||
|
local name=cargoObj:GetName()or"Unknown"
|
||||||
|
loaded[name]=loaded[name] or 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for name,count in pairs(loaded) do
|
||||||
|
local line=string.format("Drop %s (%d)",name,count)
|
||||||
|
MENU_GROUP_COMMAND:New(theGroup,line,dropTroopsMenu,self._UnloadSingleTroopByID,self,theGroup,theUnit,name)
|
||||||
|
end
|
||||||
for i,cargoObj in ipairs(loadedData.Cargo) do
|
for i,cargoObj in ipairs(loadedData.Cargo) do
|
||||||
if cargoObj and (cargoObj:GetType()==CTLD_CARGO.Enum.TROOPS or cargoObj:GetType()==CTLD_CARGO.Enum.ENGINEERS)
|
if cargoObj and (cargoObj:GetType()==CTLD_CARGO.Enum.TROOPS or cargoObj:GetType()==CTLD_CARGO.Enum.ENGINEERS)
|
||||||
and not cargoObj:WasDropped()
|
and not cargoObj:WasDropped()
|
||||||
|
|||||||
Reference in New Issue
Block a user