Add more trigger words.

Add Controller:hasTask.
Add function net.load_mission, net.load_next_mission, net.get_stat, net.send_chat, net.send_chat_to
Add id_ field for all object
Add Unit:enableEmission, Unit:getDescentCapacity, Unit:getNearestCargos
This commit is contained in:
omltcat 2024-07-07 16:33:20 -04:00
parent 5f4f565b72
commit 677d9a99aa
5 changed files with 91 additions and 3 deletions

View File

@ -2,9 +2,12 @@
"$schema": "https://raw.githubusercontent.com/LuaLS/LLS-Addons/main/schemas/addon_config.schema.json",
"name": "DCS World",
"words": [
"onEvent",
"world%.addEventHandler",
"Unit%.getByName",
"Group%.getByName",
"trigger%.action%."
"trigger%.action",
"trigger%.misc"
],
"files": [
"mist_.+%.lua",

View File

@ -12,6 +12,10 @@ Controller.Detection = {
DLINK = 32
}
---Returns true if the controller currently has a task.
---@return boolean
function Controller:hasTask() end
---Pushes the specified task to the front of the tasking queue. If no other tasks are currently active it will function effectively the same as `Controller.setTask()`.<br>
---[Available Tasks](https://wiki.hoggitworld.com/view/DCS_func_pushTask)
---@param task table -- The task to be pushed to the front of the queue.

View File

@ -57,6 +57,23 @@ function net.get_player_list() end
---@return netPlayerInfo -- The table of attributes for the player.
function net.get_player_info(playerID, attribute) end
--- Returns a statistic from a given player.<br>
--- Attributes:
---```
--- net.PS_PING -- (0) ping (in ms)
--- net.PS_CRASH -- (1) number of crashes
--- net.PS_CAR -- (2) number of destroyed vehicles
--- net.PS_PLANE -- (3) number of destroyed planes/helicopters
--- net.PS_SHIP -- (4) number of destroyed ships
--- net.PS_SCORE -- (5) total score
--- net.PS_LAND -- (6) number of landings
--- net.PS_EJECT -- (7) number of ejects
---```
--- @param playerID number The ID of the player.
--- @param statID number The ID of the statistic to retrieve.
--- @return number The requested statistic for the specified player.
function net.get_stat(playerID, statID) end
---Converts a lua value to a JSON string.
---@param lua any
---@return string
@ -71,4 +88,29 @@ function net.json2lua(json) end
---@param playerId integer -- The id of the player to be kicked.
---@param message string? -- The message to player received after kicked.
---@return boolean
function net.kick(playerId, message) end
function net.kick(playerId, message) end
---Loads the specified mission.<br>
---Example: Loads a mission from your saved games/missions folder.
---```
---net.load_mission(lfs.writeDir() .. 'Missions\\' .. 'MyTotallyAwesomeMission.miz')
---```
---@param fileName string -- The path and name of the mission file to load.
---@return boolean -- True if the mission was successfully loaded, false otherwise.
function net.load_mission(fileName) end
---Loads the next mission from the server mission list.
---@return boolean -- True if the next mission was successfully loaded, false if at the end of the list.
function net.load_next_mission() end
---Sends a chat message.
---@param message string
---@param all boolean
function net.send_chat(message, all) end
---Sends a chat message to the player with the passed id.<br>
---If the optional fromId is set, then the player will appear to receive a message from that player.
---@param message string
---@param playerId number
---@param fromId number?
function net.send_chat_to(message, playerId, fromId) end

View File

@ -1,6 +1,7 @@
---@meta
---@class Object
---@field id_ integer
Object = {}
---@enum Object.Category

View File

@ -1,7 +1,6 @@
---@meta
---@class Unit: CoalitionObject
---@field id_ integer
Unit = {}
---@enum Unit.Category
Unit.Category = {
@ -12,6 +11,16 @@ Unit.Category = {
STRUCTURE = 4
}
---Sets the radar emitters of the passed group or unit objects on or off.<br>
---Can be used on SAM sites, for example, to shut down the radar without setting AI off or changing the alarm state.<br>
---Example:
---```
---local unit = Unit.getByName('samSiteUnit1')
---unit:enableEmission(false) -- Turns off the radar emitter
---```
---@param setting boolean -- True to turn on the radar emitter, false to turn it off.
function Unit:enableEmission(setting) end
---Returns the unit object by its name (not player name)
---@param name string
---@return Unit
@ -32,6 +41,21 @@ function Unit:getCallsign() end
---@return Controller
function Unit:getController() end
---Returns the number of infantry that can be embarked onto the aircraft.<br>
---Only applicable to airplanes or helicopters. Returns nil for ground or ship units.<br>
---Example:
---```
---local heli = Unit.getByName('transportHeli')
---local capacity = heli:getDescentCapacity()
---if capacity then
--- print("Capacity to embark infantry: " .. capacity)
---else
--- print("This unit cannot embark infantry.")
---end
---```
---@return number? -- The number of infantry that can be embarked, or nil if not applicable.
function Unit:getDescentCapacity() end
---Returns the current value for an animation argument on the external model of the given object.<br>
---Each model animation has an id tied to with different values representing different states of the model.<br>
---Animation arguments can be figured out by opening the respective 3d model in the modelviewer.<br>
@ -93,6 +117,20 @@ function Unit:getLife() end
---@return number
function Unit:getLife0() end
---Returns a table of friendly cargo objects indexed numerically and sorted by distance from the helicopter.<br>
---Only applicable to helicopters. Returns nil for other unit types.<br>
---Example:
---```
---local cargo = Unit.getByName('whoopwhoop'):getNearestCargos()
---for i = 1, #cargo do
--- if Object.getDesc(cargo[i]).typeName == 'ammo_cargo' then
--- return cargo[i]
--- end
---end
---```
---@return table? -- A table of cargo objects sorted by distance, or nil if not applicable.
function Unit:getNearestCargos() end
---Returns a string value of the name of the player if the unit is currently controlled by a player.
---@return string -- The name of the player controlling the unit, or nil if the unit is controlled by AI.
function Unit:getPlayerName() end