Add functions in server GUI

Add AI enum table
Add some missing functions
This commit is contained in:
omltcat
2024-05-20 15:25:25 -04:00
parent fb09e97c37
commit d8022bc029
9 changed files with 373 additions and 10 deletions

165
library/mission/AI.lua Normal file
View File

@@ -0,0 +1,165 @@
---@meta
---@class AI
AI = {
Skill = {
PLAYER = "Player",
CLIENT = "Client",
AVERAGE = "Average",
GOOD = "Good",
HIGH = "High",
EXCELLENT = "Excellent"
},
Task = {
OrbitPattern = {
RACE_TRACK = "Race-Track",
CIRCLE = "Circle"
},
Designation = {
NO = "No",
WP = "WP",
IR_POINTER = "IR-Pointer",
LASER = "Laser",
AUTO = "Auto"
},
TurnMethod = {
FLY_OVER_POINT = "Fly Over Point",
FIN_POINT = "Fin Point"
},
VehicleFormation = {
VEE = "Vee",
ECHELON_RIGHT = "EchelonR",
OFF_ROAD = "Off Road",
RANK = "Rank",
ECHELON_LEFT = "EchelonL",
ON_ROAD = "On Road",
CONE = "Cone",
DIAMOND = "Diamond"
},
AltitudeType = {
RADIO = "RADIO",
BARO = "BARO"
},
WaypointType = {
TAKEOFF = "TakeOff",
TAKEOFF_PARKING = "TakeOffParking",
TURNING_POINT = "Turning Point",
TAKEOFF_PARKING_HOT = "TakeOffParkingHot",
LAND = "Land"
},
WeaponExpend = {
QUARTER = "Quarter",
TWO = "Two",
ONE = "One",
FOUR = "Four",
HALF = "Half",
ALL = "All"
}
},
Option = {
Air = {
id = {
ROE = 0,
REACTION_ON_THREAT = 1,
RADAR_USING = 3,
FLARE_USING = 4,
Formation = 5,
RTB_ON_BINGO = 6,
SILENCE = 7,
RTB_ON_OUT_OF_AMMO = 10,
ECM_USING = 13,
PROHIBIT_AA = 14,
PROHIBIT_JETT = 15,
PROHIBIT_AB = 16,
PROHIBIT_AG = 17,
MISSILE_ATTACK = 18,
PROHIBIT_WP_PASS_REPORT = 19,
OPTION_RADIO_USAGE_CONTACT = 21,
OPTION_RADIO_USAGE_ENGAGE = 22,
OPTION_RADIO_USAGE_KILL = 23,
JETT_TANKS_IF_EMPTY = 25,
FORCED_ATTACK = 26,
PREFER_VERTICAL = 32
},
val = {
ROE = {
WEAPON_FREE = 0,
OPEN_FIRE_WEAPON_FREE = 1,
OPEN_FIRE = 2,
RETURN_FIRE = 3,
WEAPON_HOLD = 4
},
REACTION_ON_THREAT = {
NO_REACTION = 0,
PASSIVE_DEFENCE = 1,
EVADE_FIRE = 2,
BYPASS_AND_ESCAPE = 3,
ALLOW_ABORT_MISSION = 4,
AAA_EVADE_FIRE = 5
},
RADAR_USING = {
NEVER = 0,
FOR_ATTACK_ONLY = 1,
FOR_SEARCH_IF_REQUIRED = 2,
FOR_CONTINUOUS_SEARCH = 3
},
FLARE_USING = {
NEVER = 0,
AGAINST_FIRED_MISSILE = 1,
WHEN_FLYING_IN_SAM_WEZ = 2,
WHEN_FLYING_NEAR_ENEMIES = 3
},
ECM_USING = {
NEVER_USE = 0,
USE_IF_ONLY_LOCK_BY_RADAR = 1,
USE_IF_DETECTED_LOCK_BY_RADAR = 2,
ALWAYS_USE = 3
},
MISSILE_ATTACK = {
MAX_RANGE = 0,
NEZ_RANGE = 1,
HALF_WAY_RMAX_NEZ = 2,
TARGET_THREAT_EST = 3,
RANDOM_RANGE = 4
}
}
},
Ground = {
id = {
ROE = 0,
FORMATION = 5,
DISPERSE_ON_ATTACK = 8,
ALARM_STATE = 9,
ENGAGE_AIR_WEAPONS = 20,
AC_ENGAGEMENT_RANGE_RESTRICTION = 24,
Restrict_AAA_min = 27,
Restrict_Targets = 28,
Restrict_AAA_max = 29
},
val = {
ALARM_STATE = {
AUTO = 0,
GREEN = 1,
RED = 2
},
ROE = {
OPEN_FIRE = 2,
RETURN_FIRE = 3,
WEAPON_HOLD = 4
}
}
},
Naval = {
id = {
ROE = 0
},
val = {
ROE = {
OPEN_FIRE = 2,
RETURN_FIRE = 3,
WEAPON_HOLD = 4
}
}
}
}
}

View File

@@ -0,0 +1,16 @@
---@meta
---@class Airbase: CoalitionObject
---@field id_ integer
Airbase = {}
---@enum Airbase.Category
Airbase.Category = {
AIRDROME = 0,
HELIPAD = 1,
SHIP = 2,
}
---Returns a localized string of the airbases's callsign.<br>
---In the case of airbases, the callsign of world airbases is defined by the game. Callsigns for units, farps, or ships can be specified by the user with the mission editor or scripting engine.
---@return string
function Airbase:getCallsign() end

View File

@@ -139,9 +139,9 @@ function missionCommands.removeItemForCoalition(coalition, path) end
---@param name string -- The name of the command.
---@param path table | nil -- Optional. Defines whether the command will be in a named submenu.
---@param functionToRun function -- The function to be run when the command is selected.
---@param anyArguement any -- Optional. Any argument to be passed to the function.
---@param ... any -- Optional. Any argument to be passed to the function.
---@return table -- A table indicating where in the F10 menu the command resides.
function missionCommands.addCommandForGroup(groupId, name, path, functionToRun, anyArguement) end
function missionCommands.addCommandForGroup(groupId, name, path, functionToRun, ...) end
---Creates a submenu of a specified name for the specified group. Can be used to create nested submenus. If the path is not specified, submenu is added to the root menu.<br>
---This function returns a table indicating where in the F10 menu the submenu resides.<br>

View File

@@ -3,6 +3,16 @@
---@class net
net = {}
---Executes a lua string in a given lua environment in the game.
---@param state 'mission'|'gui'|'server'|'export'|'config' -- The lua environment in the game.<br>
--- `'mission'`: holds current mission <br>
--- `'server'`: GUI (hooks) environment <br>
--- `'export'`: runs $WRITE_DIR/Scripts/Export.lua and the relevant export API <br>
--- `'config'`: the state in which $INSTALL_DIR/Config/main.cfg is executed, as well as $WRITE_DIR/Config/autoexec.cfg. Used for configuration settings <br>
---@param dostring string -- The lua string to be executed.
---@return string -- The result of the lua string execution.
function net.dostring_in(state, dostring) end
---Forces the player to occupy the set slot.<br>
---SlotId matches unit Ids of client aircraft. The exception being Combined Arms slots and multicrew slots. The latter of which have "_X" appended to denote the seat.
---SideID:
@@ -55,4 +65,10 @@ function net.lua2json(lua) end
---Converts a JSON string to a lua table.
---@param json string
---@return table
function net.json2lua(json) end
function net.json2lua(json) end
---Kicks a player from the server. Can display a message to the user.
---@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

View File

@@ -66,6 +66,14 @@ function Object:getTypeName() end
---@return vec3
function Object:getVelocity() end
---Returns a boolean value if the object in question has the passed attribute.<br>
---See [Article list of Attributes](https://wiki.hoggitworld.com/view/DCS_enum_attributes) for more details.<br>
---Additionally, attributes for each object are defined within their DB lua file. DB files provided on [github](https://github.com/mrSkortch/DCS-miscScripts/tree/master/ObjectDB) for reference.<br>
---Function also works with Unit, Weapon, Static Object, Scenery Object, Airbase.
---@param attribute string -- The attribute to check for.
---@return boolean -- True if the object has the attribute, false otherwise.
function Object:hasAttribute(attribute) end
---Returns a boolean value if the object in question is in the air.
---@return boolean
function Object:inAir() end

View File

@@ -10,20 +10,23 @@
---@field weapon_name string?
---@field target Unit?
---@field comment string?
---@field subPlace number?
---@field place Airbase?
---@field subPlace integer?
---`vec2.x = vec3.x = north`<br>`vec2.y = vec3.z = east`
---@class vec2
---@field x number positive x is north
---@field y number positive y is east
---`vec3.x = north`<br>`vec3.y = up`<br>`vec3.z = east`![](https://www.digitalcombatsimulator.com/upload/medialibrary/c96/Pos3_illustration2.jpg)
---`vec3.x = north`<br>`vec3.y = up`<br>`vec3.z = east`<br>
---![](https://www.digitalcombatsimulator.com/upload/medialibrary/c96/Pos3_illustration2.jpg)
---@class vec3
---@field x number positive x is north
---@field y number positive y is up
---@field z number positive z is east
---A table describing how a unit's local nose, up, right axes translate to world axes using three unit vectors. Also contains its location.<br>`pos.x = vec3` unit vector of nose direction<br>`pos.y = vec3` unit vector of up direction<br>`pos.z = vec3` unit vector of right direction<br>`pos.p = vec3` location of the object![](https://www.digitalcombatsimulator.com/upload/medialibrary/c96/Pos3_illustration2.jpg)
---A table describing how a unit's local nose, up, right axes translate to world axes using three unit vectors. Also contains its location.<br>`pos.x = vec3` unit vector of nose direction<br>`pos.y = vec3` unit vector of up direction<br>`pos.z = vec3` unit vector of right direction<br>`pos.p = vec3` location of the object<br>
---![](https://www.digitalcombatsimulator.com/upload/medialibrary/c96/Pos3_illustration2.jpg)
---@class pos3
---@field x vec3 nose unit vector
---@field y vec3 up unit vector