mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
OPS
FLIGHTGROUP - Improved homebase for spawned units - Enabled helo inAir check due to DCS bug that inAir returns true when spawned at airbase or farp SET_ZONE - Added DrawZone() function ARMYGROUP - Improved EngageTarget() function AUFTRAG - ARMORATTACK is not falling back to GROUNDATTACK
This commit is contained in:
@@ -1668,8 +1668,8 @@ function UTILS.GetOSTime()
|
||||
end
|
||||
|
||||
--- Shuffle a table accoring to Fisher Yeates algorithm
|
||||
--@param #table t Table to be shuffled
|
||||
--@return #table
|
||||
--@param #table t Table to be shuffled.
|
||||
--@return #table Shuffled table.
|
||||
function UTILS.ShuffleTable(t)
|
||||
if t == nil or type(t) ~= "table" then
|
||||
BASE:I("Error in ShuffleTable: Missing or wrong type of Argument")
|
||||
@@ -1687,6 +1687,32 @@ function UTILS.ShuffleTable(t)
|
||||
return TempTable
|
||||
end
|
||||
|
||||
--- Get a random element of a table.
|
||||
--@param #table t Table.
|
||||
--@param #boolean replace If `true`, the drawn element is replaced, i.e. not deleted.
|
||||
--@return #number Table element.
|
||||
function UTILS.GetRandomTableElement(t, replace)
|
||||
|
||||
if t == nil or type(t) ~= "table" then
|
||||
BASE:I("Error in ShuffleTable: Missing or wrong type of Argument")
|
||||
return
|
||||
end
|
||||
|
||||
math.random()
|
||||
math.random()
|
||||
math.random()
|
||||
|
||||
local r=math.random(#t)
|
||||
|
||||
local element=t[r]
|
||||
|
||||
if not replace then
|
||||
table.remove(t, r)
|
||||
end
|
||||
|
||||
return element
|
||||
end
|
||||
|
||||
--- (Helicopter) Check if one loading door is open.
|
||||
--@param #string unit_name Unit name to be checked
|
||||
--@return #boolean Outcome - true if a (loading door) is open, false if not, nil if none exists.
|
||||
|
||||
Reference in New Issue
Block a user