This commit is contained in:
Frank
2020-04-23 23:19:11 +02:00
parent 62bfdcff8f
commit 4222c4d945
6 changed files with 56 additions and 18095 deletions
@@ -3112,18 +3112,6 @@ function WAREHOUSE:GetAssignment(request)
return tostring(request.assignment) return tostring(request.assignment)
end end
--[[
--- Get warehouse unique ID from static warehouse object. This is the ID under which you find the @{#WAREHOUSE} object in the global data base.
-- @param #WAREHOUSE self
-- @param #string staticname Name of the warehouse static object.
-- @return #number Warehouse unique ID.
function WAREHOUSE:GetWarehouseID(staticname)
local warehouse=STATIC:FindByName(staticname, true)
local uid=tonumber(warehouse:GetID())
return uid
end
]]
--- Find a warehouse in the global warehouse data base. --- Find a warehouse in the global warehouse data base.
-- @param #WAREHOUSE self -- @param #WAREHOUSE self
-- @param #number uid The unique ID of the warehouse. -- @param #number uid The unique ID of the warehouse.
@@ -4729,27 +4717,6 @@ function WAREHOUSE:onafterUnloaded(From, Event, To, group)
end end
end end
--- On before "Arrived" event. Triggered when a group has arrived at its destination warehouse.
-- @param #WAREHOUSE self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param Wrapper.Group#GROUP group The group that was delivered.
function WAREHOUSE:onbeforeArrived(From, Event, To, group)
local asset=self:FindAssetInDB(group)
if asset then
if asset.arrived==true then
-- Asset already arrived (e.g. if multiple units trigger the event via landing).
return false
else
asset.arrived=true --ensure this is not called again from the same asset group.
return true
end
end
end
--- On before "Arrived" event. Triggered when a group has arrived at its destination warehouse. --- On before "Arrived" event. Triggered when a group has arrived at its destination warehouse.
-- @param #WAREHOUSE self -- @param #WAREHOUSE self
@@ -5146,6 +5113,7 @@ end
-- @param #WAREHOUSE.Assetitem asset The asset that is dead. -- @param #WAREHOUSE.Assetitem asset The asset that is dead.
-- @param #WAREHOUSE.Pendingitem request The request of the dead asset. -- @param #WAREHOUSE.Pendingitem request The request of the dead asset.
function WAREHOUSE:onbeforeAssetSpawned(From, Event, To, group, asset, request) function WAREHOUSE:onbeforeAssetSpawned(From, Event, To, group, asset, request)
if asset.spawned then if asset.spawned then
--return false --return false
else else
@@ -5167,9 +5135,6 @@ function WAREHOUSE:onafterAssetSpawned(From, Event, To, group, asset, request)
local text=string.format("Asset %s from request id=%d was spawned!", asset.spawngroupname, request.uid) local text=string.format("Asset %s from request id=%d was spawned!", asset.spawngroupname, request.uid)
self:I(self.lid..text) self:I(self.lid..text)
-- Set asset state to spawned.
asset.spawned=true
-- Check if all assets groups are spawned and trigger events. -- Check if all assets groups are spawned and trigger events.
local n=0 local n=0
for _,_asset in pairs(request.assets) do for _,_asset in pairs(request.assets) do
@@ -6162,9 +6127,8 @@ function WAREHOUSE:_OnEventBirth(EventData)
-- Set warehouse state. -- Set warehouse state.
group:SetState(group, "WAREHOUSE", self) group:SetState(group, "WAREHOUSE", self)
-- Asset spawned FSM function. -- Asset spawned FSM function. We delay this a bit to have all units of the group in the game.
--self:__AssetSpawned(1, group, asset, request) self:__AssetSpawned(1, group, asset, request)
self:AssetSpawned(group, asset, request)
end end
@@ -8546,7 +8510,7 @@ function WAREHOUSE:_DebugMessage(text, duration)
if duration>0 then if duration>0 then
MESSAGE:New(text, duration):ToAllIf(self.Debug) MESSAGE:New(text, duration):ToAllIf(self.Debug)
end end
self:I(self.lid..text) self:T(self.lid..text)
end end
--- Error message. Message send to all (if duration > 0). Text self:E(text) added to DCS.log file. --- Error message. Message send to all (if duration > 0). Text self:E(text) added to DCS.log file.
File diff suppressed because it is too large Load Diff
+21 -14
View File
@@ -1,10 +1,17 @@
--- **Utilities** Enumerators. --- **Utilities** Enumerators.
-- --
-- An enumerator is a variable that holds a constant value. Enumerators are very useful because -- An enumerator is a variable that holds a constant value. Enumerators are very useful because they make the code easier to read and to change in general.
-- --
-- https://wiki.hoggitworld.com/view/Category:Enumerators -- For example, instead of using the same value at multiple different places in your code, you should use a variable set to that value.
-- If, for whatever reason, the value needs to be changed, you only have to change the variable once and do not have to search through you code and reset
-- every value by hand.
-- --
-- See the [Simulator Scripting Engine Documentation](https://wiki.hoggitworld.com/view/Simulator_Scripting_Engine_Documentation) on Hoggit for further explanation and examples. -- Another big advantage is that the LDT intellisense "knows" the enumerators. So you can use the autocompletion feature and do not have to keep all the
-- values in your head or look them up in the docs.
--
-- DCS itself provides a lot of enumerators for various things. See [Enumerators](https://wiki.hoggitworld.com/view/Category:Enumerators) on Hoggit.
--
-- Other Moose classe also have enumerators. For example, the AIRBASE class has enumerators for airbase names.
-- --
-- @module ENUMS -- @module ENUMS
-- @image MOOSE.JPG -- @image MOOSE.JPG
@@ -12,11 +19,10 @@
--- [DCS Enum world](https://wiki.hoggitworld.com/view/DCS_enum_world) --- [DCS Enum world](https://wiki.hoggitworld.com/view/DCS_enum_world)
-- @type ENUMS -- @type ENUMS
--- The world singleton contains functions centered around two different but extremely useful functions. --- Because ENUMS are just better practice.
-- * Events and event handlers are all governed within world.
-- * A number of functions to get information about the game world.
-- --
-- Enumerator -- The ENUMS class adds some handy variables, which help you to make your code better and more general.
--
-- @field #ENUMS -- @field #ENUMS
ENUMS = {} ENUMS = {}
@@ -50,10 +56,10 @@ ENUMS.ROT = {
AllowAbortMission=4, AllowAbortMission=4,
} }
--- Weapon types. See https://wiki.hoggitworld.com/view/DCS_enum_weapon_flag --- Weapon types. See the [Weapon Flag](https://wiki.hoggitworld.com/view/DCS_enum_weapon_flag) enumerotor on hoggit wiki.
-- @type ENUMS.WeaponFlag -- @type ENUMS.WeaponFlag
ENUMS.WeaponFlag={ ENUMS.WeaponFlag={
--- Bombs -- Bombs
LGB = 2, LGB = 2,
TvGB = 4, TvGB = 4,
SNSGB = 8, SNSGB = 8,
@@ -65,12 +71,12 @@ ENUMS.WeaponFlag={
Dispencer = 512, Dispencer = 512,
CandleBomb = 1024, CandleBomb = 1024,
ParachuteBomb = 2147483648, ParachuteBomb = 2147483648,
--- Rockets -- Rockets
LightRocket = 2048, LightRocket = 2048,
MarkerRocket = 4096, MarkerRocket = 4096,
CandleRocket = 8192, CandleRocket = 8192,
HeavyRocket = 16384, HeavyRocket = 16384,
--- Air-To-Surface Missiles -- Air-To-Surface Missiles
AntiRadarMissile = 32768, AntiRadarMissile = 32768,
AntiShipMissile = 65536, AntiShipMissile = 65536,
AntiTankMissile = 131072, AntiTankMissile = 131072,
@@ -79,7 +85,7 @@ ENUMS.WeaponFlag={
TeleASM = 1048576, TeleASM = 1048576,
CruiseMissile = 2097152, CruiseMissile = 2097152,
AntiRadarMissile2 = 1073741824, AntiRadarMissile2 = 1073741824,
--- Air-To-Air Missiles -- Air-To-Air Missiles
SRAM = 4194304, SRAM = 4194304,
MRAAM = 8388608, MRAAM = 8388608,
LRAAM = 16777216, LRAAM = 16777216,
@@ -87,7 +93,7 @@ ENUMS.WeaponFlag={
SAR_AAM = 67108864, SAR_AAM = 67108864,
AR_AAM = 134217728, AR_AAM = 134217728,
--- Guns --- Guns
GUN_POD = 268435456, GunPod = 268435456,
BuiltInCannon = 536870912, BuiltInCannon = 536870912,
--- ---
-- Combinations -- Combinations
@@ -129,10 +135,11 @@ ENUMS.WeaponFlag={
-- @field #string CAS Close Air Support. -- @field #string CAS Close Air Support.
-- @field #string ESCORT Escort another group. -- @field #string ESCORT Escort another group.
-- @field #string FIGHTERSWEEP Fighter sweep. -- @field #string FIGHTERSWEEP Fighter sweep.
-- @field #string GROUNDATTACK Ground attack.
-- @field #string INTERCEPT Intercept. -- @field #string INTERCEPT Intercept.
-- @field #string PINPOINTSTRIKE Pinpoint strike. -- @field #string PINPOINTSTRIKE Pinpoint strike.
-- @field #string RECONNAISSANCE Reconnaissance mission. -- @field #string RECONNAISSANCE Reconnaissance mission.
-- @field #string REFUELLING Refuelling mission. -- @field #string REFUELING Refueling mission.
-- @field #string RUNWAYATTACK Attack the runway of an airdrome. -- @field #string RUNWAYATTACK Attack the runway of an airdrome.
-- @field #string SEAD Suppression of Enemy Air Defenses. -- @field #string SEAD Suppression of Enemy Air Defenses.
-- @field #string TRANSPORT Troop transport. -- @field #string TRANSPORT Troop transport.
+11 -3
View File
@@ -440,9 +440,16 @@ function GROUP:Destroy( GenerateEvent, delay )
end end
--- Returns category of the DCS Group. --- Returns category of the DCS Group. Returns one of
--
-- * Group.Category.AIRPLANE
-- * Group.Category.HELICOPTER
-- * Group.Category.GROUND
-- * Group.Category.SHIP
-- * Group.Category.TRAIN
--
-- @param #GROUP self -- @param #GROUP self
-- @return DCS#Group.Category The category ID -- @return DCS#Group.Category The category ID.
function GROUP:GetCategory() function GROUP:GetCategory()
self:F2( self.GroupName ) self:F2( self.GroupName )
@@ -458,7 +465,7 @@ end
--- Returns the category name of the #GROUP. --- Returns the category name of the #GROUP.
-- @param #GROUP self -- @param #GROUP self
-- @return #string Category name = Helicopter, Airplane, Ground Unit, Ship -- @return #string Category name = Helicopter, Airplane, Ground Unit, Ship, Train.
function GROUP:GetCategoryName() function GROUP:GetCategoryName()
self:F2( self.GroupName ) self:F2( self.GroupName )
@@ -469,6 +476,7 @@ function GROUP:GetCategoryName()
[Group.Category.HELICOPTER] = "Helicopter", [Group.Category.HELICOPTER] = "Helicopter",
[Group.Category.GROUND] = "Ground Unit", [Group.Category.GROUND] = "Ground Unit",
[Group.Category.SHIP] = "Ship", [Group.Category.SHIP] = "Ship",
[Group.Category.TRAIN] = "Train",
} }
local GroupCategory = DCSGroup:getCategory() local GroupCategory = DCSGroup:getCategory()
self:T3( GroupCategory ) self:T3( GroupCategory )
@@ -106,9 +106,17 @@ function IDENTIFIABLE:GetTypeName()
end end
--- Returns category of the DCS Identifiable. --- Returns object category of the DCS Identifiable. One of
--
-- * Object.Category.UNIT = 1
-- * Object.Category.WEAPON = 2
-- * Object.Category.STATIC = 3
-- * Object.Category.BASE = 4
-- * Object.Category.SCENERY = 5
-- * Object.Category.Cargo = 6
--
-- @param #IDENTIFIABLE self -- @param #IDENTIFIABLE self
-- @return DCS#Object.Category The category ID -- @return DCS#Object.Category The category ID, i.e. a number.
function IDENTIFIABLE:GetCategory() function IDENTIFIABLE:GetCategory()
self:F2( self.ObjectName ) self:F2( self.ObjectName )
+10 -3
View File
@@ -814,10 +814,17 @@ function UNIT:GetDamageRelative()
return 1 return 1
end end
--- Returns the category of the #UNIT. --- Returns the category of the #UNIT from descriptor. Returns one of
--
-- * Unit.Category.AIRPLANE
-- * Unit.Category.HELICOPTER
-- * Unit.Category.GROUND_UNIT
-- * Unit.Category.SHIP
-- * Unit.Category.STRUCTURE
--
-- @param #UNIT self -- @param #UNIT self
-- @return #number Unit category. -- @return #number Unit category from `getDesc().category`.
function UNIT:GetCategory() function UNIT:GetUnitCategory()
self:F3( self.UnitName ) self:F3( self.UnitName )
local DCSUnit = self:GetDCSObject() local DCSUnit = self:GetDCSObject()