mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/master' into develop
# Conflicts: # Moose Development/Moose/Core/Event.lua # Moose Development/Moose/Ops/CTLD.lua # Moose Development/Moose/Wrapper/DynamicCargo.lua
This commit is contained in:
commit
36bf2436b6
@ -180,15 +180,19 @@ end
|
|||||||
-- @return Wrapper.Unit#UNIT The added unit.
|
-- @return Wrapper.Unit#UNIT The added unit.
|
||||||
function DATABASE:AddUnit( DCSUnitName, force )
|
function DATABASE:AddUnit( DCSUnitName, force )
|
||||||
|
|
||||||
if not self.UNITS[DCSUnitName] or force == true then
|
local DCSunitName = DCSUnitName
|
||||||
|
|
||||||
|
if type(DCSunitName) == "number" then DCSunitName = string.format("%d",DCSUnitName) end
|
||||||
|
|
||||||
|
if not self.UNITS[DCSunitName] or force == true then
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T( { "Add UNIT:", DCSUnitName } )
|
self:T( { "Add UNIT:", DCSunitName } )
|
||||||
|
|
||||||
-- Register unit
|
-- Register unit
|
||||||
self.UNITS[DCSUnitName]=UNIT:Register(DCSUnitName)
|
self.UNITS[DCSunitName]=UNIT:Register(DCSunitName)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.UNITS[DCSUnitName]
|
return self.UNITS[DCSunitName]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -853,11 +857,15 @@ end
|
|||||||
-- @return Wrapper.Client#CLIENT The client object.
|
-- @return Wrapper.Client#CLIENT The client object.
|
||||||
function DATABASE:AddClient( ClientName, Force )
|
function DATABASE:AddClient( ClientName, Force )
|
||||||
|
|
||||||
if not self.CLIENTS[ClientName] or Force == true then
|
local DCSUnitName = ClientName
|
||||||
self.CLIENTS[ClientName] = CLIENT:Register( ClientName )
|
|
||||||
|
if type(DCSUnitName) == "number" then DCSUnitName = string.format("%d",ClientName) end
|
||||||
|
|
||||||
|
if not self.CLIENTS[DCSUnitName] or Force == true then
|
||||||
|
self.CLIENTS[DCSUnitName] = CLIENT:Register( DCSUnitName )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.CLIENTS[ClientName]
|
return self.CLIENTS[DCSUnitName]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -898,8 +906,10 @@ end
|
|||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
function DATABASE:AddPlayer( UnitName, PlayerName )
|
function DATABASE:AddPlayer( UnitName, PlayerName )
|
||||||
|
|
||||||
|
if type(UnitName) == "number" then UnitName = string.format("%d",UnitName) end
|
||||||
|
|
||||||
if PlayerName then
|
if PlayerName then
|
||||||
self:T( { "Add player for unit:", UnitName, PlayerName } )
|
self:I( { "Add player for unit:", UnitName, PlayerName } )
|
||||||
self.PLAYERS[PlayerName] = UnitName
|
self.PLAYERS[PlayerName] = UnitName
|
||||||
self.PLAYERUNITS[PlayerName] = self:FindUnit( UnitName )
|
self.PLAYERUNITS[PlayerName] = self:FindUnit( UnitName )
|
||||||
self.PLAYERSJOINED[PlayerName] = PlayerName
|
self.PLAYERSJOINED[PlayerName] = PlayerName
|
||||||
@ -907,6 +917,21 @@ function DATABASE:AddPlayer( UnitName, PlayerName )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get a PlayerName by UnitName from PLAYERS in DATABASE.
|
||||||
|
-- @param #DATABASE self
|
||||||
|
-- @return #string PlayerName
|
||||||
|
-- @return Wrapper.Unit#UNIT PlayerUnit
|
||||||
|
function DATABASE:_FindPlayerNameByUnitName(UnitName)
|
||||||
|
if UnitName then
|
||||||
|
for playername,unitname in pairs(self.PLAYERS) do
|
||||||
|
if unitname == UnitName and self.PLAYERUNITS[playername] and self.PLAYERUNITS[playername]:IsAlive() then
|
||||||
|
return playername, self.PLAYERUNITS[playername]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
--- Deletes a player from the DATABASE based on the Player Name.
|
--- Deletes a player from the DATABASE based on the Player Name.
|
||||||
-- @param #DATABASE self
|
-- @param #DATABASE self
|
||||||
function DATABASE:DeletePlayer( UnitName, PlayerName )
|
function DATABASE:DeletePlayer( UnitName, PlayerName )
|
||||||
@ -1451,7 +1476,7 @@ function DATABASE:_RegisterDynamicGroup(Groupname)
|
|||||||
|
|
||||||
-- Add unit.
|
-- Add unit.
|
||||||
self:I(string.format("Register Unit: %s", tostring(DCSUnitName)))
|
self:I(string.format("Register Unit: %s", tostring(DCSUnitName)))
|
||||||
self:AddUnit( DCSUnitName, true )
|
self:AddUnit( tostring(DCSUnitName), true )
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1482,7 +1482,7 @@ function EVENT:onEvent( Event )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Weapon.
|
-- Weapon.
|
||||||
if Event.weapon and type(Event.weapon) == "table" then
|
if Event.weapon and type(Event.weapon) == "table" and Event.weapon.isExist and Event.weapon:isExist() then
|
||||||
Event.Weapon = Event.weapon
|
Event.Weapon = Event.weapon
|
||||||
Event.WeaponName = Event.weapon:isExist() and Event.weapon:getTypeName() or "Unknown Weapon"
|
Event.WeaponName = Event.weapon:isExist() and Event.weapon:getTypeName() or "Unknown Weapon"
|
||||||
Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit!
|
Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit!
|
||||||
@ -1530,6 +1530,7 @@ function EVENT:onEvent( Event )
|
|||||||
if Event.dynamiccargo then
|
if Event.dynamiccargo then
|
||||||
Event.IniDynamicCargo = Event.dynamiccargo
|
Event.IniDynamicCargo = Event.dynamiccargo
|
||||||
Event.IniDynamicCargoName = Event.IniDynamicCargo.StaticName
|
Event.IniDynamicCargoName = Event.IniDynamicCargo.StaticName
|
||||||
|
Event.IniPlayerName = Event.IniDynamicCargo.Owner or string.match(Event.IniUnitName,"^(.+)|%d%d:%d%d|PKG%d+")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Zone object.
|
-- Zone object.
|
||||||
|
|||||||
@ -1811,7 +1811,7 @@ function RANGE:OnEventBirth( EventData )
|
|||||||
if not EventData.IniPlayerName then return end
|
if not EventData.IniPlayerName then return end
|
||||||
|
|
||||||
local _unitName = EventData.IniUnitName
|
local _unitName = EventData.IniUnitName
|
||||||
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName )
|
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName, EventData.IniPlayerName )
|
||||||
|
|
||||||
self:T3( self.lid .. "BIRTH: unit = " .. tostring( EventData.IniUnitName ) )
|
self:T3( self.lid .. "BIRTH: unit = " .. tostring( EventData.IniUnitName ) )
|
||||||
self:T3( self.lid .. "BIRTH: group = " .. tostring( EventData.IniGroupName ) )
|
self:T3( self.lid .. "BIRTH: group = " .. tostring( EventData.IniGroupName ) )
|
||||||
@ -1968,6 +1968,8 @@ end
|
|||||||
-- @param #number attackVel Attack velocity.
|
-- @param #number attackVel Attack velocity.
|
||||||
function RANGE._OnImpact(weapon, self, playerData, attackHdg, attackAlt, attackVel)
|
function RANGE._OnImpact(weapon, self, playerData, attackHdg, attackAlt, attackVel)
|
||||||
|
|
||||||
|
if not playerData then return end
|
||||||
|
|
||||||
-- Get closet target to last position.
|
-- Get closet target to last position.
|
||||||
local _closetTarget = nil -- #RANGE.BombTarget
|
local _closetTarget = nil -- #RANGE.BombTarget
|
||||||
local _distance = nil
|
local _distance = nil
|
||||||
@ -1984,13 +1986,13 @@ function RANGE._OnImpact(weapon, self, playerData, attackHdg, attackAlt, attackV
|
|||||||
-- Coordinate of impact point.
|
-- Coordinate of impact point.
|
||||||
local impactcoord = weapon:GetImpactCoordinate()
|
local impactcoord = weapon:GetImpactCoordinate()
|
||||||
|
|
||||||
-- Check if impact happened in range zone.
|
-- Check if impact happened in range zone.+
|
||||||
local insidezone = self.rangezone:IsCoordinateInZone( impactcoord )
|
local insidezone = self.rangezone:IsCoordinateInZone( impactcoord )
|
||||||
|
|
||||||
|
|
||||||
-- Smoke impact point of bomb.
|
-- Smoke impact point of bomb.
|
||||||
if playerData.smokebombimpact and insidezone then
|
if playerData and playerData.smokebombimpact and insidezone then
|
||||||
if playerData.delaysmoke then
|
if playerData and playerData.delaysmoke then
|
||||||
timer.scheduleFunction( self._DelayedSmoke, { coord = impactcoord, color = playerData.smokecolor }, timer.getTime() + self.TdelaySmoke )
|
timer.scheduleFunction( self._DelayedSmoke, { coord = impactcoord, color = playerData.smokecolor }, timer.getTime() + self.TdelaySmoke )
|
||||||
else
|
else
|
||||||
impactcoord:Smoke( playerData.smokecolor )
|
impactcoord:Smoke( playerData.smokecolor )
|
||||||
@ -2115,7 +2117,7 @@ function RANGE:OnEventShot( EventData )
|
|||||||
local _unitName = EventData.IniUnitName
|
local _unitName = EventData.IniUnitName
|
||||||
|
|
||||||
-- Get player unit and name.
|
-- Get player unit and name.
|
||||||
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName )
|
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName, EventData.IniPlayerName )
|
||||||
|
|
||||||
-- Distance Player-to-Range. Set this to larger value than the threshold.
|
-- Distance Player-to-Range. Set this to larger value than the threshold.
|
||||||
local dPR = self.BombtrackThreshold * 2
|
local dPR = self.BombtrackThreshold * 2
|
||||||
@ -2127,11 +2129,13 @@ function RANGE:OnEventShot( EventData )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Only track if distance player to range is < 25 km. Also check that a player shot. No need to track AI weapons.
|
-- Only track if distance player to range is < 25 km. Also check that a player shot. No need to track AI weapons.
|
||||||
if _track and dPR <= self.BombtrackThreshold and _unit and _playername then
|
if _track and dPR <= self.BombtrackThreshold and _unit and _playername and self.PlayerSettings[_playername] then
|
||||||
|
|
||||||
-- Player data.
|
-- Player data.
|
||||||
local playerData = self.PlayerSettings[_playername] -- #RANGE.PlayerData
|
local playerData = self.PlayerSettings[_playername] -- #RANGE.PlayerData
|
||||||
|
|
||||||
|
if not playerData then return end
|
||||||
|
|
||||||
-- Attack parameters.
|
-- Attack parameters.
|
||||||
local attackHdg=_unit:GetHeading()
|
local attackHdg=_unit:GetHeading()
|
||||||
local attackAlt=_unit:GetHeight()
|
local attackAlt=_unit:GetHeight()
|
||||||
@ -4099,8 +4103,8 @@ end
|
|||||||
-- @return Wrapper.Unit#UNIT Unit of player.
|
-- @return Wrapper.Unit#UNIT Unit of player.
|
||||||
-- @return #string Name of the player.
|
-- @return #string Name of the player.
|
||||||
-- @return #boolean If true, group has > 1 player in it
|
-- @return #boolean If true, group has > 1 player in it
|
||||||
function RANGE:_GetPlayerUnitAndName( _unitName )
|
function RANGE:_GetPlayerUnitAndName( _unitName, PlayerName )
|
||||||
self:F2( _unitName )
|
self:I( _unitName )
|
||||||
|
|
||||||
if _unitName ~= nil then
|
if _unitName ~= nil then
|
||||||
|
|
||||||
@ -4111,7 +4115,7 @@ function RANGE:_GetPlayerUnitAndName( _unitName )
|
|||||||
|
|
||||||
if DCSunit and DCSunit.getPlayerName then
|
if DCSunit and DCSunit.getPlayerName then
|
||||||
|
|
||||||
local playername = DCSunit:getPlayerName()
|
local playername = DCSunit:getPlayerName() or PlayerName or "None"
|
||||||
local unit = UNIT:Find( DCSunit )
|
local unit = UNIT:Find( DCSunit )
|
||||||
|
|
||||||
self:T2( { DCSunit = DCSunit, unit = unit, playername = playername } )
|
self:T2( { DCSunit = DCSunit, unit = unit, playername = playername } )
|
||||||
|
|||||||
@ -49,6 +49,7 @@ __Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Marker.lua' )
|
|||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Weapon.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Weapon.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Net.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Net.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Storage.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/Storage.lua' )
|
||||||
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Wrapper/DynamicCargo.lua' )
|
||||||
|
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/Cargo.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/Cargo.lua' )
|
||||||
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoUnit.lua' )
|
__Moose.Include( MOOSE_DEVELOPMENT_FOLDER..'/Moose/Cargo/CargoUnit.lua' )
|
||||||
|
|||||||
@ -78,6 +78,7 @@ CTLD_CARGO = {
|
|||||||
-- @field #string REPAIR
|
-- @field #string REPAIR
|
||||||
-- @field #string ENGINEERS
|
-- @field #string ENGINEERS
|
||||||
-- @field #string STATIC
|
-- @field #string STATIC
|
||||||
|
-- @field #string GCLOADABLE
|
||||||
CTLD_CARGO.Enum = {
|
CTLD_CARGO.Enum = {
|
||||||
VEHICLE = "Vehicle", -- #string vehicles
|
VEHICLE = "Vehicle", -- #string vehicles
|
||||||
TROOPS = "Troops", -- #string troops
|
TROOPS = "Troops", -- #string troops
|
||||||
@ -86,6 +87,7 @@ CTLD_CARGO = {
|
|||||||
REPAIR = "Repair", -- #string repair
|
REPAIR = "Repair", -- #string repair
|
||||||
ENGINEERS = "Engineers", -- #string engineers
|
ENGINEERS = "Engineers", -- #string engineers
|
||||||
STATIC = "Static", -- #string statics
|
STATIC = "Static", -- #string statics
|
||||||
|
GCLOADABLE = "GC_Loadable", -- #string dynamiccargo
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Function to create new CTLD_CARGO object.
|
--- Function to create new CTLD_CARGO object.
|
||||||
@ -770,7 +772,7 @@ do
|
|||||||
-- my_ctld.nobuildmenu = false -- if set to true effectively enforces to have engineers build/repair stuff for you.
|
-- my_ctld.nobuildmenu = false -- if set to true effectively enforces to have engineers build/repair stuff for you.
|
||||||
-- my_ctld.RadioSound = "beacon.ogg" -- -- this sound will be hearable if you tune in the beacon frequency. Add the sound file to your miz.
|
-- my_ctld.RadioSound = "beacon.ogg" -- -- this sound will be hearable if you tune in the beacon frequency. Add the sound file to your miz.
|
||||||
-- my_ctld.RadioSoundFC3 = "beacon.ogg" -- this sound will be hearable by FC3 users (actually all UHF radios); change to something like "beaconsilent.ogg" and add the sound file to your miz if you don't want to annoy FC3 pilots.
|
-- my_ctld.RadioSoundFC3 = "beacon.ogg" -- this sound will be hearable by FC3 users (actually all UHF radios); change to something like "beaconsilent.ogg" and add the sound file to your miz if you don't want to annoy FC3 pilots.
|
||||||
-- my_ctld.enableChinookGCLoading = true -- this will effectively suppress the crate load and drop menus for CTLD for the Chinook
|
-- my_ctld.enableChinookGCLoading = true -- this will effectively suppress the crate load and drop for CTLD_CARGO.Enum.STATIc types for CTLD for the Chinook
|
||||||
--
|
--
|
||||||
-- ## 2.1 CH-47 Chinook support
|
-- ## 2.1 CH-47 Chinook support
|
||||||
--
|
--
|
||||||
@ -780,7 +782,7 @@ do
|
|||||||
--
|
--
|
||||||
-- ## 2.1.1 Moose CTLD created crate cargo
|
-- ## 2.1.1 Moose CTLD created crate cargo
|
||||||
--
|
--
|
||||||
-- Given the correct shape, Moose created cargo can be either loaded with the ground crew or via the F10 CTLD menu. **It is strongly recommend to either use the ground crew or CTLD to load/unload cargo**. Mix and match will not work here.
|
-- Given the correct shape, Moose created cargo can be either loaded with the ground crew or via the F10 CTLD menu. **It is strongly recommend to either use the ground crew or CTLD to load/unload Moose created cargo**. Mix and match will not work here.
|
||||||
-- Static shapes loadable *into* the Chinook are at the time of writing:
|
-- Static shapes loadable *into* the Chinook are at the time of writing:
|
||||||
--
|
--
|
||||||
-- * Ammo crate (type "ammo_cargo")
|
-- * Ammo crate (type "ammo_cargo")
|
||||||
@ -1203,6 +1205,7 @@ CTLD = {
|
|||||||
wpZones = {},
|
wpZones = {},
|
||||||
dropOffZones = {},
|
dropOffZones = {},
|
||||||
pickupZones = {},
|
pickupZones = {},
|
||||||
|
DynamicCargo = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
------------------------------
|
------------------------------
|
||||||
@ -1307,7 +1310,7 @@ CTLD.UnitTypeCapabilities = {
|
|||||||
|
|
||||||
--- CTLD class version.
|
--- CTLD class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CTLD.version="1.0.58"
|
CTLD.version="1.1.12"
|
||||||
|
|
||||||
--- Instantiate a new CTLD.
|
--- Instantiate a new CTLD.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@ -1590,7 +1593,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
-- @param #string To State.
|
-- @param #string To State.
|
||||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||||
-- @param #CTLD_CARGO Cargo Cargo crate.
|
-- @param #CTLD_CARGO Cargo Cargo crate. Can be a Wrapper.DynamicCargo#DYNAMICCARGO object, if ground crew loaded!
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
|
|
||||||
--- FSM Function OnBeforeTroopsDeployed.
|
--- FSM Function OnBeforeTroopsDeployed.
|
||||||
@ -1612,7 +1615,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
-- @param #string To State.
|
-- @param #string To State.
|
||||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||||
-- @param #table Cargotable Table of #CTLD_CARGO objects dropped.
|
-- @param #table Cargotable Table of #CTLD_CARGO objects dropped. Can be a Wrapper.DynamicCargo#DYNAMICCARGO object, if ground crew unloaded!
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
|
|
||||||
--- FSM Function OnBeforeCratesBuild.
|
--- FSM Function OnBeforeCratesBuild.
|
||||||
@ -1678,7 +1681,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
-- @param #string To State.
|
-- @param #string To State.
|
||||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||||
-- @param #CTLD_CARGO Cargo Cargo crate.
|
-- @param #CTLD_CARGO Cargo Cargo crate. Can be a Wrapper.DynamicCargo#DYNAMICCARGO object, if ground crew loaded!
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
|
|
||||||
--- FSM Function OnAfterTroopsDeployed.
|
--- FSM Function OnAfterTroopsDeployed.
|
||||||
@ -1700,7 +1703,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
-- @param #string To State.
|
-- @param #string To State.
|
||||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||||
-- @param #table Cargotable Table of #CTLD_CARGO objects dropped.
|
-- @param #table Cargotable Table of #CTLD_CARGO objects dropped. Can be a Wrapper.DynamicCargo#DYNAMICCARGO object, if ground crew unloaded!
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
|
|
||||||
--- FSM Function OnAfterCratesBuild.
|
--- FSM Function OnAfterCratesBuild.
|
||||||
@ -1909,26 +1912,43 @@ function CTLD:_EventHandler(EventData)
|
|||||||
self.CtldUnits[unitname] = nil
|
self.CtldUnits[unitname] = nil
|
||||||
self.Loaded_Cargo[unitname] = nil
|
self.Loaded_Cargo[unitname] = nil
|
||||||
self.MenusDone[unitname] = nil
|
self.MenusDone[unitname] = nil
|
||||||
elseif event.id == EVENTS.Birth and event.IniObjectCategory == 6 and string.match(event.IniUnitName,".+|%d%d:%d%d|PKG%d+") then
|
--elseif event.id == EVENTS.NewDynamicCargo and event.IniObjectCategory == 6 and string.match(event.IniUnitName,".+|%d%d:%d%d|PKG%d+") then
|
||||||
--UTILS.PrintTableToLog(event)
|
elseif event.id == EVENTS.NewDynamicCargo then
|
||||||
|
self:T(self.lid.."GC New Event "..event.IniDynamicCargoName)
|
||||||
---------------
|
---------------
|
||||||
-- New dynamic cargo system Handling
|
-- New dynamic cargo system Handling NEW
|
||||||
--------------
|
--------------
|
||||||
local function RegisterDynamicCargo()
|
self.DynamicCargo[event.IniDynamicCargoName] = event.IniDynamicCargo
|
||||||
local static = _DATABASE:AddStatic(event.IniUnitName)
|
---------------
|
||||||
if static then
|
-- End new dynamic cargo system Handling
|
||||||
static.DCSCargoObject = event.IniDCSUnit
|
--------------
|
||||||
local Mass = event.IniDCSUnit:getCargoWeight()
|
elseif event.id == EVENTS.DynamicCargoLoaded then
|
||||||
local country = event.IniDCSUnit:getCountry()
|
self:T(self.lid.."GC Loaded Event "..event.IniDynamicCargoName)
|
||||||
local template = _DATABASE:_GetGenericStaticCargoGroupTemplate(event.IniUnitName,event.IniTypeName,Mass,event.IniCoalition,country)
|
---------------
|
||||||
_DATABASE:_RegisterStaticTemplate(template,event.IniCoalition,"static",country)
|
-- New dynamic cargo system Handling LOADING
|
||||||
self:I("**** Ground crew created static cargo added: "..event.IniUnitName .." | Weight in kgs: "..Mass)
|
--------------
|
||||||
local cargotype = self:AddStaticsCargo(event.IniUnitName,Mass,1,nil,true)
|
local dcargo = event.IniDynamicCargo -- Wrapper.DynamicCargo#DYNAMICCARGO
|
||||||
self.CrateCounter = self.CrateCounter + 1
|
-- get client/unit object
|
||||||
self.Spawned_Crates[self.CrateCounter] = static
|
local client = CLIENT:FindByPlayerName(dcargo.Owner)
|
||||||
cargotype.Positionable = static
|
if client and client:IsAlive() then
|
||||||
table.insert(self.Spawned_Cargo, cargotype)
|
-- add to unit load list
|
||||||
|
local unitname = client:GetName() or "none"
|
||||||
|
local loaded = {}
|
||||||
|
if self.Loaded_Cargo[unitname] then
|
||||||
|
loaded = self.Loaded_Cargo[unitname] -- #CTLD.LoadedCargo
|
||||||
|
else
|
||||||
|
loaded = {} -- #CTLD.LoadedCargo
|
||||||
|
loaded.Troopsloaded = 0
|
||||||
|
loaded.Cratesloaded = 0
|
||||||
|
loaded.Cargo = {}
|
||||||
end
|
end
|
||||||
|
loaded.Cratesloaded = loaded.Cratesloaded+1
|
||||||
|
table.insert(loaded.Cargo,dcargo)
|
||||||
|
self.Loaded_Cargo[unitname] = nil
|
||||||
|
self.Loaded_Cargo[unitname] = loaded
|
||||||
|
local Group = client:GetGroup()
|
||||||
|
self:_SendMessage(string.format("Crate %s loaded by ground crew!",event.IniDynamicCargoName), 10, false, Group)
|
||||||
|
self:__CratesPickedUp(1, Group, client, dcargo)
|
||||||
end
|
end
|
||||||
--self:ScheduleOnce(0.5,RegisterDynamicCargo)
|
--self:ScheduleOnce(0.5,RegisterDynamicCargo)
|
||||||
---------------
|
---------------
|
||||||
@ -2173,7 +2193,7 @@ end
|
|||||||
|
|
||||||
function CTLD:_FindRepairNearby(Group, Unit, Repairtype)
|
function CTLD:_FindRepairNearby(Group, Unit, Repairtype)
|
||||||
self:T(self.lid .. " _FindRepairNearby")
|
self:T(self.lid .. " _FindRepairNearby")
|
||||||
--self:I({Group:GetName(),Unit:GetName(),Repairtype})
|
--self:T({Group:GetName(),Unit:GetName(),Repairtype})
|
||||||
local unitcoord = Unit:GetCoordinate()
|
local unitcoord = Unit:GetCoordinate()
|
||||||
|
|
||||||
-- find nearest group of deployed groups
|
-- find nearest group of deployed groups
|
||||||
@ -2191,7 +2211,7 @@ function CTLD:_FindRepairNearby(Group, Unit, Repairtype)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--self:I("Distance: ".. nearestDistance)
|
--self:T("Distance: ".. nearestDistance)
|
||||||
|
|
||||||
-- found one and matching distance?
|
-- found one and matching distance?
|
||||||
if nearestGroup == nil or nearestDistance > self.EngineerSearch then
|
if nearestGroup == nil or nearestDistance > self.EngineerSearch then
|
||||||
@ -2225,7 +2245,7 @@ function CTLD:_FindRepairNearby(Group, Unit, Repairtype)
|
|||||||
-- walk through generics and find matching type
|
-- walk through generics and find matching type
|
||||||
local Cargotype = nil
|
local Cargotype = nil
|
||||||
for k,v in pairs(self.Cargo_Crates) do
|
for k,v in pairs(self.Cargo_Crates) do
|
||||||
--self:I({groupname,v.Templates,Repairtype})
|
--self:T({groupname,v.Templates,Repairtype})
|
||||||
if matchstring(groupname,v.Templates) and matchstring(groupname,Repairtype) then
|
if matchstring(groupname,v.Templates) and matchstring(groupname,Repairtype) then
|
||||||
Cargotype = v -- #CTLD_CARGO
|
Cargotype = v -- #CTLD_CARGO
|
||||||
break
|
break
|
||||||
@ -2235,7 +2255,7 @@ function CTLD:_FindRepairNearby(Group, Unit, Repairtype)
|
|||||||
if Cargotype == nil then
|
if Cargotype == nil then
|
||||||
return nil, nil
|
return nil, nil
|
||||||
else
|
else
|
||||||
--self:I({groupname,Cargotype})
|
--self:T({groupname,Cargotype})
|
||||||
return nearestGroup, Cargotype
|
return nearestGroup, Cargotype
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2713,7 +2733,7 @@ function CTLD:_ListCratesNearby( _group, _unit)
|
|||||||
end
|
end
|
||||||
text:Add("------------------------------------------------------------")
|
text:Add("------------------------------------------------------------")
|
||||||
if indexgc > 0 then
|
if indexgc > 0 then
|
||||||
text:Add("Probably ground crew loaded (F8)")
|
text:Add("Probably ground crew loadable (F8)")
|
||||||
for _,_entry in pairs (loadedbygc) do
|
for _,_entry in pairs (loadedbygc) do
|
||||||
local entry = _entry -- #CTLD_CARGO
|
local entry = _entry -- #CTLD_CARGO
|
||||||
local name = entry:GetName() --#string
|
local name = entry:GetName() --#string
|
||||||
@ -2817,7 +2837,7 @@ function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight)
|
|||||||
local capabilities = {}
|
local capabilities = {}
|
||||||
local maxmass = 2000
|
local maxmass = 2000
|
||||||
local maxloadable = 2000
|
local maxloadable = 2000
|
||||||
local IsNoHook = not self:IsHook(_unit)
|
local IsHook = self:IsHook(_unit)
|
||||||
if not _ignoreweight then
|
if not _ignoreweight then
|
||||||
maxloadable = self:_GetMaxLoadableMass(_unit)
|
maxloadable = self:_GetMaxLoadableMass(_unit)
|
||||||
end
|
end
|
||||||
@ -2828,9 +2848,10 @@ function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight)
|
|||||||
local weight = cargo:GetMass() -- weight in kgs of this cargo
|
local weight = cargo:GetMass() -- weight in kgs of this cargo
|
||||||
local staticid = cargo:GetID()
|
local staticid = cargo:GetID()
|
||||||
self:T(self.lid .. " Found cargo mass: " .. weight)
|
self:T(self.lid .. " Found cargo mass: " .. weight)
|
||||||
local cargoalive = false -- TODO dyn cargo spawn workaround
|
--local cargoalive = false -- TODO dyn cargo spawn workaround
|
||||||
local dcsunit = nil
|
--local dcsunit = nil
|
||||||
local dcsunitpos = nil
|
--local dcsunitpos = nil
|
||||||
|
--[[
|
||||||
if static and static.DCSCargoObject then
|
if static and static.DCSCargoObject then
|
||||||
dcsunit = Unit.getByName(static.StaticName)
|
dcsunit = Unit.getByName(static.StaticName)
|
||||||
if dcsunit then
|
if dcsunit then
|
||||||
@ -2844,26 +2865,37 @@ function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if static and (static:IsAlive() or cargoalive) then
|
--]]
|
||||||
local staticpos = static:GetCoordinate() or dcsunitpos
|
if static and static:IsAlive() then --or cargoalive) then
|
||||||
|
local restricthooktononstatics = self.enableChinookGCLoading and IsHook
|
||||||
|
self:T(self.lid .. " restricthooktononstatics: " .. tostring(restricthooktononstatics))
|
||||||
|
local cargoisstatic = cargo:GetType() == CTLD_CARGO.Enum.STATIC and true or false
|
||||||
|
self:T(self.lid .. " Cargo is static: " .. tostring(cargoisstatic))
|
||||||
|
local restricted = cargoisstatic and restricthooktononstatics
|
||||||
|
self:T(self.lid .. " Loading restricted: " .. tostring(restricted))
|
||||||
|
local staticpos = static:GetCoordinate() --or dcsunitpos
|
||||||
|
--[[
|
||||||
--- Testing
|
--- Testing
|
||||||
local landheight = staticpos:GetLandHeight()
|
local landheight = staticpos:GetLandHeight()
|
||||||
local agl = staticpos.y-landheight
|
local agl = staticpos.y-landheight
|
||||||
agl = UTILS.Round(agl,2)
|
agl = UTILS.Round(agl,2)
|
||||||
local GCloaded = agl > 0 and true or false
|
local GCloaded = agl > 0 and true or false
|
||||||
if IsNoHook == true then GCloaded = false end
|
if IsNoHook == true then GCloaded = false end
|
||||||
|
--]]
|
||||||
--- Testing
|
--- Testing
|
||||||
local distance = self:_GetDistance(location,staticpos)
|
local distance = self:_GetDistance(location,staticpos)
|
||||||
self:T({name=static:GetName(),IsNoHook=IsNoHook,agl=agl,GCloaded=GCloaded,distance=string.format("%.2f",distance or 0)})
|
--self:T({name=static:GetName(),IsHook=IsHook,agl=agl,GCloaded=GCloaded,distance=string.format("%.2f",distance or 0)})
|
||||||
if (not GCloaded) and distance <= finddist and static and (weight <= maxloadable or _ignoreweight) then
|
--if (not restricthooktononstatics) and distance <= finddist and static and (weight <= maxloadable or _ignoreweight) then
|
||||||
|
self:T(self.lid .. string.format("Dist %dm/%dm | weight %dkg | maxloadable %dkg",distance,finddist,weight,maxloadable))
|
||||||
|
if distance <= finddist and (weight <= maxloadable or _ignoreweight) and restricted == false then
|
||||||
index = index + 1
|
index = index + 1
|
||||||
table.insert(found, staticid, cargo)
|
table.insert(found, staticid, cargo)
|
||||||
maxloadable = maxloadable - weight
|
maxloadable = maxloadable - weight
|
||||||
|
--elseif restricthooktononstatics and distance < 10 and static then
|
||||||
|
--indexg = indexg + 1
|
||||||
|
--table.insert(LoadedbyGC,staticid, cargo)
|
||||||
end
|
end
|
||||||
if GCloaded == true and distance < 10 and static then
|
|
||||||
indexg = indexg + 1
|
|
||||||
table.insert(LoadedbyGC,staticid, cargo)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return found, index, LoadedbyGC, indexg
|
return found, index, LoadedbyGC, indexg
|
||||||
@ -2929,10 +2961,10 @@ function CTLD:_LoadCratesNearby(Group, Unit)
|
|||||||
if number == 0 and self.hoverautoloading then
|
if number == 0 and self.hoverautoloading then
|
||||||
return self -- exit
|
return self -- exit
|
||||||
elseif number == 0 then
|
elseif number == 0 then
|
||||||
self:_SendMessage("Sorry no loadable crates nearby or max cargo weight reached!", 10, false, Group)
|
self:_SendMessage("Sorry, no loadable crates nearby or max cargo weight reached!", 10, false, Group)
|
||||||
return self -- exit
|
return self -- exit
|
||||||
elseif numberonboard == cratelimit then
|
elseif numberonboard == cratelimit then
|
||||||
self:_SendMessage("Sorry no fully loaded!", 10, false, Group)
|
self:_SendMessage("Sorry, we are fully loaded!", 10, false, Group)
|
||||||
return self -- exit
|
return self -- exit
|
||||||
else
|
else
|
||||||
-- go through crates and load
|
-- go through crates and load
|
||||||
@ -3024,9 +3056,13 @@ function CTLD:_GetUnitCargoMass(Unit)
|
|||||||
if (type == CTLD_CARGO.Enum.TROOPS or type == CTLD_CARGO.Enum.ENGINEERS) and not cargo:WasDropped() then
|
if (type == CTLD_CARGO.Enum.TROOPS or type == CTLD_CARGO.Enum.ENGINEERS) and not cargo:WasDropped() then
|
||||||
loadedmass = loadedmass + (cargo.PerCrateMass * cargo:GetCratesNeeded())
|
loadedmass = loadedmass + (cargo.PerCrateMass * cargo:GetCratesNeeded())
|
||||||
end
|
end
|
||||||
if type ~= CTLD_CARGO.Enum.TROOPS and type ~= CTLD_CARGO.Enum.ENGINEERS and not cargo:WasDropped() then
|
if type ~= CTLD_CARGO.Enum.TROOPS and type ~= CTLD_CARGO.Enum.ENGINEERS and type ~= CTLD_CARGO.Enum.GCLOADABLE and not cargo:WasDropped() then
|
||||||
loadedmass = loadedmass + cargo.PerCrateMass
|
loadedmass = loadedmass + cargo.PerCrateMass
|
||||||
end
|
end
|
||||||
|
if type == CTLD_CARGO.Enum.GCLOADABLE then
|
||||||
|
local mass = cargo:GetCargoWeight()
|
||||||
|
loadedmass = loadedmass+mass
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return loadedmass
|
return loadedmass
|
||||||
@ -3073,8 +3109,8 @@ function CTLD:_ListCargo(Group, Unit)
|
|||||||
local loadedmass = self:_GetUnitCargoMass(Unit) -- #number
|
local loadedmass = self:_GetUnitCargoMass(Unit) -- #number
|
||||||
local maxloadable = self:_GetMaxLoadableMass(Unit)
|
local maxloadable = self:_GetMaxLoadableMass(Unit)
|
||||||
local finddist = self.CrateDistance or 35
|
local finddist = self.CrateDistance or 35
|
||||||
local _,_,loadedgc,loadedno = self:_FindCratesNearby(Group,Unit,finddist,true)
|
--local _,_,loadedgc,loadedno = self:_FindCratesNearby(Group,Unit,finddist,true)
|
||||||
if self.Loaded_Cargo[unitname] or loadedno > 0 then
|
if self.Loaded_Cargo[unitname] then
|
||||||
local no_troops = loadedcargo.Troopsloaded or 0
|
local no_troops = loadedcargo.Troopsloaded or 0
|
||||||
local no_crates = loadedcargo.Cratesloaded or 0
|
local no_crates = loadedcargo.Cratesloaded or 0
|
||||||
local cargotable = loadedcargo.Cargo or {} -- #table
|
local cargotable = loadedcargo.Cargo or {} -- #table
|
||||||
@ -3099,17 +3135,22 @@ function CTLD:_ListCargo(Group, Unit)
|
|||||||
for _,_cargo in pairs(cargotable or {}) do
|
for _,_cargo in pairs(cargotable or {}) do
|
||||||
local cargo = _cargo -- #CTLD_CARGO
|
local cargo = _cargo -- #CTLD_CARGO
|
||||||
local type = cargo:GetType() -- #CTLD_CARGO.Enum
|
local type = cargo:GetType() -- #CTLD_CARGO.Enum
|
||||||
if (type ~= CTLD_CARGO.Enum.TROOPS and type ~= CTLD_CARGO.Enum.ENGINEERS) and (not cargo:WasDropped() or self.allowcratepickupagain) then
|
if (type ~= CTLD_CARGO.Enum.TROOPS and type ~= CTLD_CARGO.Enum.ENGINEERS and type ~= CTLD_CARGO.Enum.GCLOADABLE) and (not cargo:WasDropped() or self.allowcratepickupagain) then
|
||||||
report:Add(string.format("Crate: %s size 1",cargo:GetName()))
|
report:Add(string.format("Crate: %s size 1",cargo:GetName()))
|
||||||
cratecount = cratecount + 1
|
cratecount = cratecount + 1
|
||||||
end
|
end
|
||||||
|
if type == CTLD_CARGO.Enum.GCLOADABLE and not cargo:WasDropped() then
|
||||||
|
report:Add(string.format("GC loaded Crate: %s size 1",cargo:GetName()))
|
||||||
|
cratecount = cratecount + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if cratecount == 0 then
|
if cratecount == 0 then
|
||||||
report:Add(" N O N E")
|
report:Add(" N O N E")
|
||||||
end
|
end
|
||||||
|
--[[
|
||||||
if loadedno > 0 then
|
if loadedno > 0 then
|
||||||
report:Add("------------------------------------------------------------")
|
report:Add("------------------------------------------------------------")
|
||||||
report:Add(" -- CRATES loaded via F8 --")
|
report:Add(" -- CRATES loaded via Ground Crew --")
|
||||||
for _,_cargo in pairs(loadedgc or {}) do
|
for _,_cargo in pairs(loadedgc or {}) do
|
||||||
local cargo = _cargo -- #CTLD_CARGO
|
local cargo = _cargo -- #CTLD_CARGO
|
||||||
local type = cargo:GetType() -- #CTLD_CARGO.Enum
|
local type = cargo:GetType() -- #CTLD_CARGO.Enum
|
||||||
@ -3119,6 +3160,7 @@ function CTLD:_ListCargo(Group, Unit)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--]]
|
||||||
report:Add("------------------------------------------------------------")
|
report:Add("------------------------------------------------------------")
|
||||||
report:Add("Total Mass: ".. loadedmass .. " kg. Loadable: "..maxloadable.." kg.")
|
report:Add("Total Mass: ".. loadedmass .. " kg. Loadable: "..maxloadable.." kg.")
|
||||||
local text = report:Text()
|
local text = report:Text()
|
||||||
@ -3453,7 +3495,7 @@ function CTLD:_UnloadCrates(Group, Unit)
|
|||||||
for _,_cargo in pairs (cargotable) do
|
for _,_cargo in pairs (cargotable) do
|
||||||
local cargo = _cargo -- #CTLD_CARGO
|
local cargo = _cargo -- #CTLD_CARGO
|
||||||
local type = cargo:GetType() -- #CTLD_CARGO.Enum
|
local type = cargo:GetType() -- #CTLD_CARGO.Enum
|
||||||
if type ~= CTLD_CARGO.Enum.TROOPS and type ~= CTLD_CARGO.Enum.ENGINEERS and (not cargo:WasDropped() or self.allowcratepickupagain) then
|
if type ~= CTLD_CARGO.Enum.TROOPS and type ~= CTLD_CARGO.Enum.ENGINEERS and type ~= CTLD_CARGO.Enum.GCLOADABLE and (not cargo:WasDropped() or self.allowcratepickupagain) then
|
||||||
-- unload crates
|
-- unload crates
|
||||||
self:_GetCrates(Group, Unit, cargo, 1, true)
|
self:_GetCrates(Group, Unit, cargo, 1, true)
|
||||||
cargo:SetWasDropped(true)
|
cargo:SetWasDropped(true)
|
||||||
@ -3474,6 +3516,10 @@ function CTLD:_UnloadCrates(Group, Unit)
|
|||||||
table.insert(loaded.Cargo,_cargo)
|
table.insert(loaded.Cargo,_cargo)
|
||||||
loaded.Troopsloaded = loaded.Troopsloaded + size
|
loaded.Troopsloaded = loaded.Troopsloaded + size
|
||||||
end
|
end
|
||||||
|
if type == CTLD_CARGO.Enum.GCLOADABLE and not cargo:WasDropped() then
|
||||||
|
table.insert(loaded.Cargo,_cargo)
|
||||||
|
loaded.Cratesloaded = loaded.Cratesloaded + size
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self.Loaded_Cargo[unitname] = nil
|
self.Loaded_Cargo[unitname] = nil
|
||||||
self.Loaded_Cargo[unitname] = loaded
|
self.Loaded_Cargo[unitname] = loaded
|
||||||
@ -3906,7 +3952,8 @@ function CTLD:_RefreshF10Menus()
|
|||||||
local cantroops = capabilities.troops
|
local cantroops = capabilities.troops
|
||||||
local cancrates = capabilities.crates
|
local cancrates = capabilities.crates
|
||||||
local isHook = self:IsHook(_unit)
|
local isHook = self:IsHook(_unit)
|
||||||
local nohookswitch = not (isHook and self.enableChinookGCLoading)
|
--local nohookswitch = not (isHook and self.enableChinookGCLoading)
|
||||||
|
local nohookswitch = true
|
||||||
-- top menu
|
-- top menu
|
||||||
local topmenu = MENU_GROUP:New(_group,"CTLD",nil)
|
local topmenu = MENU_GROUP:New(_group,"CTLD",nil)
|
||||||
local toptroops = nil
|
local toptroops = nil
|
||||||
@ -5537,7 +5584,11 @@ end
|
|||||||
self:HandleEvent(EVENTS.PlayerEnterUnit, self._EventHandler)
|
self:HandleEvent(EVENTS.PlayerEnterUnit, self._EventHandler)
|
||||||
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._EventHandler)
|
self:HandleEvent(EVENTS.PlayerLeaveUnit, self._EventHandler)
|
||||||
self:HandleEvent(EVENTS.UnitLost, self._EventHandler)
|
self:HandleEvent(EVENTS.UnitLost, self._EventHandler)
|
||||||
self:HandleEvent(EVENTS.Birth, self._EventHandler)
|
--self:HandleEvent(EVENTS.Birth, self._EventHandler)
|
||||||
|
self:HandleEvent(EVENTS.NewDynamicCargo, self._EventHandler)
|
||||||
|
self:HandleEvent(EVENTS.DynamicCargoLoaded, self._EventHandler)
|
||||||
|
self:HandleEvent(EVENTS.DynamicCargoUnloaded, self._EventHandler)
|
||||||
|
self:HandleEvent(EVENTS.DynamicCargoRemoved, self._EventHandler)
|
||||||
self:__Status(-5)
|
self:__Status(-5)
|
||||||
|
|
||||||
-- AutoSave
|
-- AutoSave
|
||||||
@ -5625,9 +5676,11 @@ end
|
|||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
function CTLD:onafterStop(From, Event, To)
|
function CTLD:onafterStop(From, Event, To)
|
||||||
self:T({From, Event, To})
|
self:T({From, Event, To})
|
||||||
self:UnhandleEvent(EVENTS.PlayerEnterAircraft)
|
self:UnHandleEvent(EVENTS.PlayerEnterAircraft)
|
||||||
self:UnhandleEvent(EVENTS.PlayerEnterUnit)
|
self:UnHandleEvent(EVENTS.PlayerEnterUnit)
|
||||||
self:UnhandleEvent(EVENTS.PlayerLeaveUnit)
|
self:UnHandleEvent(EVENTS.PlayerLeaveUnit)
|
||||||
|
self:UnHandleEvent(EVENTS.UnitLost)
|
||||||
|
self:UnHandleEvent(EVENTS.Shot)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -5652,7 +5705,7 @@ end
|
|||||||
-- @param #string To State.
|
-- @param #string To State.
|
||||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||||
-- @param #CTLD_CARGO Cargo Cargo crate.
|
-- @param #CTLD_CARGO Cargo Cargo crate. Can be a Wrapper.DynamicCargo#DYNAMICCARGO object, if ground crew loaded!
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
function CTLD:onbeforeCratesPickedUp(From, Event, To, Group, Unit, Cargo)
|
function CTLD:onbeforeCratesPickedUp(From, Event, To, Group, Unit, Cargo)
|
||||||
self:T({From, Event, To})
|
self:T({From, Event, To})
|
||||||
@ -5734,7 +5787,7 @@ end
|
|||||||
-- @param #string To State.
|
-- @param #string To State.
|
||||||
-- @param Wrapper.Group#GROUP Group Group Object.
|
-- @param Wrapper.Group#GROUP Group Group Object.
|
||||||
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
-- @param Wrapper.Unit#UNIT Unit Unit Object.
|
||||||
-- @param #table Cargotable Table of #CTLD_CARGO objects dropped.
|
-- @param #table Cargotable Table of #CTLD_CARGO objects dropped. Can be a Wrapper.DynamicCargo#DYNAMICCARGO object, if ground crew unloaded!
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
function CTLD:onbeforeCratesDropped(From, Event, To, Group, Unit, Cargotable)
|
function CTLD:onbeforeCratesDropped(From, Event, To, Group, Unit, Cargotable)
|
||||||
self:T({From, Event, To})
|
self:T({From, Event, To})
|
||||||
|
|||||||
@ -528,6 +528,7 @@ function NET:SendChatToPlayer(Message, ToPlayer, FromPlayer)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ not in 2.97 MSE any longer
|
||||||
--- Load a specific mission.
|
--- Load a specific mission.
|
||||||
-- @param #NET self
|
-- @param #NET self
|
||||||
-- @param #string Path and Mission
|
-- @param #string Path and Mission
|
||||||
@ -550,6 +551,7 @@ function NET:LoadNextMission()
|
|||||||
outcome = net.load_next_mission()
|
outcome = net.load_next_mission()
|
||||||
return outcome
|
return outcome
|
||||||
end
|
end
|
||||||
|
--]]
|
||||||
|
|
||||||
--- Return a table of players currently connected to the server.
|
--- Return a table of players currently connected to the server.
|
||||||
-- @param #NET self
|
-- @param #NET self
|
||||||
|
|||||||
@ -1500,7 +1500,7 @@ function UNIT:InAir(NoHeloCheck)
|
|||||||
local UnitCategory = DCSUnit:getDesc().category
|
local UnitCategory = DCSUnit:getDesc().category
|
||||||
|
|
||||||
-- If DCS says that it is in air, check if this is really the case, since we might have landed on a building where inAir()=true but actually is not.
|
-- If DCS says that it is in air, check if this is really the case, since we might have landed on a building where inAir()=true but actually is not.
|
||||||
-- This is a workaround since DCS currently does not acknoledge that helos land on buildings.
|
-- This is a workaround since DCS currently does not acknowledge that helos land on buildings.
|
||||||
-- Note however, that the velocity check will fail if the ground is moving, e.g. on an aircraft carrier!
|
-- Note however, that the velocity check will fail if the ground is moving, e.g. on an aircraft carrier!
|
||||||
if UnitInAir==true and UnitCategory == Unit.Category.HELICOPTER and (not NoHeloCheck) then
|
if UnitInAir==true and UnitCategory == Unit.Category.HELICOPTER and (not NoHeloCheck) then
|
||||||
local VelocityVec3 = DCSUnit:getVelocity()
|
local VelocityVec3 = DCSUnit:getVelocity()
|
||||||
|
|||||||
@ -47,6 +47,7 @@ Wrapper/Marker.lua
|
|||||||
Wrapper/Weapon.lua
|
Wrapper/Weapon.lua
|
||||||
Wrapper/Net.lua
|
Wrapper/Net.lua
|
||||||
Wrapper/Storage.lua
|
Wrapper/Storage.lua
|
||||||
|
Wrapper/DynamicCargo.lua
|
||||||
|
|
||||||
Functional/Scoring.lua
|
Functional/Scoring.lua
|
||||||
Functional/CleanUp.lua
|
Functional/CleanUp.lua
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user