Merge pull request #3 from Rolln-dev/master

Added missing functions (trigger, coalition)
Added missing classes (VoiceChat, radio)
This commit is contained in:
Phil Du 2024-07-24 09:28:27 -04:00 committed by GitHub
commit bfbe153d9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 379 additions and 5 deletions

View File

@ -43,6 +43,16 @@ function coalition.addGroup(countryId, groupCategory, groupData) end
function coalition.addStaticObject(countryId, groupData) end
---Returns a table of unit objects that are currently occupied by players. Function is useful in multiplayer to easily filter client aircraft from everything else.
---___
---Example: <br>
---Print the names of client aircraft currently spawned on blue.
---```lua
--- local bluePlayers = coalition.getPlayers(2)
--- for i = 1, #bluePlayers do
--- env.info(Unit.getName(bluePlayers[i]))
--- end
---```
---___
---@param coalitionId coalition.side -- The id of the coalition.
---@return Unit[] -- A table of unit objects that are currently occupied by players.
function coalition.getPlayers(coalitionId) end
@ -62,4 +72,69 @@ function coalition.getGroups(coalitionId, groupCategory) end
---Returns a table of static objects (StaticObject[]) belonging to the specified coalition.
---@param coalitionId coalition.side -- The id of the coalition.
---@return StaticObject[] -- A table of static objects.
function coalition.getStaticObjects(coalitionId) end
function coalition.getStaticObjects(coalitionId) end
---Returns a table of airbase objects belonging to the specified coalition. Objects can be ships, static objects(FARP), or airbases on the map.
---When the function is run as world.getAirbases() no input values required, and the function returns all airbases, ships, and farps on the map
---___
---Example: <br>
---The following iterates the returned airbases via world.getAirbases() and stores callsign, id, and other useful information in another table.
---```lua
--- local base = world.getAirbases()
--- local myBaseTbl = {}
--- for i = 1, #base do
--- local info = {}
--- info.desc = Airbase.getDesc(base[i])
--- info.callsign = Airbase.getCallsign(base[i])
--- info.id = Airbase.getID(base[i])
--- info.cat = Airbase.getCategory(base[i])
--- info.point = Airbase.getPoint(base[i])
--- if Airbase.getUnit(base[i]) then
--- info.unitId = Airbase.getUnit(base[i]):getID()
--- end
---
--- myBaseTbl[info.callsign] = info
--- end
--- ```
---___
---@param coalitionId coalition.side Id of coalition.
---@return Airbase[] # Table of airbases for the given coalition.
function coalition.getAirbases(coalitionId ) end
---Returns a table of unit objects that provide a given service to player controlled aircraft. Services are ATC, AWACS, TANKER, and FAC.
---___
---@param coalitionId coalition.side Id of coalition.
---@param service coalition.service Type of service.
---@return Unit[] # Table of Unit objects of the given service.
function coalition.getServiceProviders(coalitionId , service ) end
---A refPoint is a table format used in addRefPoints, getRefPoints and getMainRefPoint functions.
---@class coalition.refPoint
---@field callsign number
---@field type number
---@field point vec3
coalition.refPoint = {}
---Creates a new reference point belonging to the specified coalition. Reference points are used by JTACs.
---```lua
--- RefPoint = {
--- callsign = number,
--- type = number,
--- point = Vec3
--- }
---```
---@param coalitionId coalition.side
---@param refPoint coalition.refPoint
function coalition.addRefPoints(coalitionId , refPoint ) end
---Returns a table of reference points as defined by the mission editor or added via scripting. Reference points are used by JTACs.
---___
---@param coalitionId coalition.side
---@return coalition.refPoint[] # Table of refPoints for given coalition.
function coalition.getRefPoints(coalitionId ) end
---Returns the position of a coalitions "bullseye" as specified in the mission editor.
---___
---@param coalitionId coalition.side
---@return vec3 bullseye Bullseye of given coalition.
function coalition.getMainRefPoint(coalitionId ) end

11
library/mission/radio.lua Normal file
View File

@ -0,0 +1,11 @@
---@meta
---The radio enumerator has a single table that defines the radio modulation used to transmit.
---@class radio
radio = {}
---@enum radio.modulation
radio.modulation = {
AM = 0,
FM = 1
}

View File

@ -23,8 +23,8 @@ trigger.flareColor = {
---@class trigger.action
trigger.action = {}
---Creates an explosion at a given point at the specified power.
---@param vec3 vec3
---@param power number
---@param vec3 vec3 Position of explosion.
---@param power number Power of explosion.
function trigger.action.explosion(vec3, power) end
---Creates a signal flare at the given point in the specified color. <br>
@ -320,7 +320,7 @@ function trigger.action.removeMark(id) end
---Updates the position of a mark that was defined at the first point given to create it. Can be used to "move" an existing mark from one place to the next without deleting it and creating a new one.
---@param id integer -- The unique id of the mark to be updated.
---@param vec3 table -- The new position for the mark in the form of a vec3 table {x, y, z}.
---@param vec3 vec3 -- The new position for the mark in the form of a vec3 table {x, y, z}.
function trigger.action.setMarkupPositionStart(id, vec3) end
---Updates the color of the specified mark to be the new value.
@ -377,4 +377,260 @@ function trigger.misc.getZone(zoneName) end
---Sets a user flag to the specified value.
---@param flagNumOrName string -- The number or name of the user flag.
---@param userFlagValue boolean|integer -- The value to set the user flag to.
function trigger.action.setUserFlag(flagNumOrName, userFlagValue) end
function trigger.action.setUserFlag(flagNumOrName, userFlagValue) end
---Creates a smoke plume behind a specified aircraft. When passed 0 for smoke type the plume will be disabled. When triggering the on the same unit with a different color the plume will simply change color.
---
---Optional value for altitude can be set. This value is in meters and defines the altitude at which the aircraft must be for the smoke to dispense. If the aircraft goes below that altitude the smoke will stop. As long as the smoke is enabled the toggling on/off by changing altitude is automated.
---
--- - Disable 0
--- - Green 1
--- - Red 2
--- - White 3
--- - Orange 4
--- - Blue 5
---___
---Example: <br>
---The following creates a blue smoke plume on an aircraft named "IWishEDWouldDocumentFeaturesMore" that will be enabled based on the altitude the aircraft was at when the function was run.
---```lua
---trigger.action.ctfColorTag('IWishEDWouldDocumentFeaturesMore', 5)
---```
---___
---@param unitName string Unit
---@param smokeColor integer Color of Smoke
function trigger.action.ctfColorTag(unitName , smokeColor ) end
---Creates colored smoke marker at a given point. Smoke uses trigger.smokeColor enum
---
---trigger.smokeColor
--- - Green 0
--- - Red 1
--- - White 2
--- - Orange 3
--- - Blue 4
---___
---@param vec3 vec3 Location of smoke.
---@param smokeColor trigger.smokeColor Color of smoke.
function trigger.action.smoke(vec3, smokeColor ) end
---Creates a large smoke effect on a vec3 point of a specified type and density.
--- - 1 = small smoke and fire
--- - 2 = medium smoke and fire
--- - 3 = large smoke and fire
--- - 4 = huge smoke and fire
--- - 5 = small smoke
--- - 6 = medium smoke
--- - 7 = large smoke
--- - 8 = huge smoke
---
---Density is any value from 0 to 1. For example 0.5 <br>
---Name is a unique name given to the smoke mark to be used with removing it.
---___
---The following creates a large smoke and fire effect with a density of 0.75
---```lua
--- local someZone = trigger.misc.getZone('whatever').point
--- someZone.y = land.getHeight({x = someZone.x, y = someZone.z}) -- compensate for ground level
--- trigger.action.effectSmokeBig(someZone, 3, 0.75)
---```
---___
---@param vec3 vec3 Location of smoke
---@param preset integer Smoke preset.
---@param density number Density of smoke from 0 to 1.
---@param name? string Optional Unique name given to the smoke mark to be used with removing it.
function trigger.action.effectSmokeBig(vec3, preset, density, name) end
---Stops a big smoke effect of the passed name. Used in conjunction with trigger.action.effectSmokeBig
---___
---Example: <br>
---The following stops a big smoke effect named "fire1".
---```lua
--- trigger.action.effectSmokeStop('fire1')
---```
---___
---@param name string Name give in trigger.effectSmokeBig
function trigger.action.effectSmokeStop(name ) end
---Transmits an audio file to be broadcast over a specific frequency eneminating from the specified point.
---
---Modulation Values:
--- - 0 = AM
--- - 1 = FM
---
---Frequency is in Hz and requires 9 digits. <br>
---Power is measured in Watts
---___
---Example: <br>
---The following plays an audio file on 124 Mhz AM.
---```lua
--- local p = trigger.misc.getZone('zone').point
--- trigger.action.radioTransmission('l10n/DEFAULT/tusk_onstation.wav', p, 0, false, 124000000, 100, 'message')
---```
---___
---@param filename string Name of audio file to play.
---@param point vec3 Location of radioTransmission.
---@param modulation radio.modulation Modulation of signal.
---@param loop boolean Whether to loop transmission or not.
---@param frequency number Frequency in Hz, 9 digits.
---@param power number Power in Watts.
---@param name string Name of transmission.
function trigger.action.radioTransmission(filename, point, modulation, loop, frequency, power, name) end
---Stops a radio transmission of the passed name. Transmission must be named in the trigger.action.radioTransmission it was sent from.
---___
---Example: <br>
---The following tops a transmission that was named "messaage".
---```lua
--- trigger.action.stopRadioTransmission('message')
---```
---___
---@param name string Name of radio transmission given in trigger.action.radioTransmission.
function trigger.action.stopRadioTransmission(name ) end
---Plays a sound file to all players. The sound file must be placed inside of the miz file in order to be played.
---___
---Example: <br>
---```lua
--- trigger.action.outSound('hq_ThisIsWizard.wav')
---```
---You can also create custom folders within the miz to store sound files. For example below has a folder named "Sounds" and plays the sound "fileName.wav" inside the Sounds folder. This can be useful to add sound files to a mission without having to add those files via triggers.
---```lua
--- trigger.action.outSound("Sounds/fileName.wav")
---```
---___
---@param soundfile string Name of sound file.
function trigger.action.outSound(soundfile ) end
---Plays a sound file to all players on the specified country. The sound file must be placed inside of the miz file in order to be played.
---___
---@param country country.id Id of country to play sound for.
---@param soundfile string Name of sound file.
function trigger.action.outSoundForCountry(country, soundfile ) end
---Plays a sound file to all players in the specified unit. Unit is specified by the corresponding UnitId The sound file must be placed inside of the miz file in order to be played.
---___
---@param unitId number Unit Id.
---@param soundfile string Name of sound file.
function trigger.action.outSoundForUnit(unitId, soundfile ) end
---Displays the passed string of text for the specified time to all players belonging to the specified country. Boolean clearview defines whether or not to use the old message display format. The old message display overwrites existing messages and is good for displaying anything that must be updated at a high rate like lap times.
---___
---@param country country.id Id of country to send text to.
---@param text string Text to display.
---@param displayTime number How long to display text in seconds.
---@param clearview boolean Whether to clear all previous text before displaying.
function trigger.action.outTextForCountry(country, text, displayTime, clearview) end
---Adds a command to the "F10 Other" radio menu allowing players to call commands and set flags within the mission. Command is added for both teams. The string name is the text that will be displayed in the F10 Other menu and is also used in the function to remove the command from the menu.
---___
---@param name string Name of command.
---@param userFlagName string User flag name to set.
---@param userFlagValue number Value to set for user flag.
function trigger.action.addOtherCommand(name, userFlagName, userFlagValue ) end
---Removes the command that matches the specified name input variable from the "F10 Other" radio menu.
---___
---@param name string Name of command given in trigger.action.addOtherCommand.
function trigger.action.removeOtherCommand(name ) end
---Adds a command to the "F10 Other" radio menu allowing players to call commands and set flags within the mission. Command is added for all players belonging to the specified coalition. The string name is the text that will be displayed in the F10 Other menu and is also used in the function to remove the command from the menu.
---___
---@param coalition coalition.side Coalition to add command for.
---@param name string Name of command to add.
---@param userFlagName string Name of user flag to set.
---@param userFlagValue number Value to set for user flag.
function trigger.action.addOtherCommandForCoalition(coalition, name, userFlagName , userFlagValue ) end
---Removes the command that matches the specified name input variable from the "F10 Other" radio menu if the command was added for coalition.
---___
---@param coalitionId coalition.side Coalition to remove command from.
---@param name string Name of command given in trigger.action.addOtherCommandForCoalition.
function trigger.action.removeOtherCommandForCoalition(coalitionId, name ) end
---Adds a command to the "F10 Other" radio menu allowing players to call commands and set flags within the mission. Command is added for a specific group designated by its groupId. The string name is the text that will be displayed in the F10 Other menu and is also used in the function to remove the command from the menu.
---___
---@param groupId number GroupId to add command for.
---@param name string Name of command to add.
---@param userFlagName string Name of user flag to set.
---@param userFlagValue number Value to set user flag to.
function trigger.action.addOtherCommandForGroup(groupId, name, userFlagName, userFlagValue ) end
---Removes the command that matches the specified name input variable from the "F10 Other" radio menu if the command exists for the specified group.
---___
---@param groupId number GroupId to remove command from.
---@param name string Name of command given in trigger.action.addOtherCommandForGroup
function trigger.action.removeOtherCommandForGroup(groupId, name ) end
---Updates the radius of the specified mark to be the new value. If the id of the passed mark is not a circle then nothing will happen.
---___
---@param id number Id of mark to set radius (must be a circle id).
---@param radius number New radius of circle.
function trigger.action.setMarkupRadius(id , radius ) end
---Updates the font size of the specified mark to be the new value. If the id of the passed mark does not have text then nothing will happen.
---___
---@param id number Id of Markup to set.
---@param fontSize number New font size.
function trigger.action.setMarkupFontSize(id, fontSize ) end
---Updates the type line of the specified mark to be the new value.
---
---LineTypes:
--- - 0 No Line
--- - 1 Solid
--- - 2 Dashed
--- - 3 Dotted
--- - 4 Dot Dash
--- - 5 Long Dash
--- - 6 Two Dash
---___
---@param id number Id of markup to set.
---@param TypeLine number Type of line to use.
function trigger.action.setMarkupTypeLine(id , TypeLine ) end
---Updates the position of a mark that was defined at the last point given to create it. Can be used to "move" an existing mark from one place to the next without deleting it and creating a new one.
---___
---@param id number Id of markup to set.
---@param vec3 vec3 The new position for the mark.
function trigger.action.setMarkupPositionEnd(id, vec3 ) end
---Sets the task of the specified index to be the one and only active task.
---___
---@param Group Group Group to set task for.
---@param taskIndex number Index of task to become active.
function trigger.action.setAITask(Group, taskIndex ) end
---Pushes the task of the specified index to the front of the tasking queue.
---___
---@param Group Group Group to set task for.
---@param taskIndex number Index of task to bring to front of task queue.
function trigger.action.pushAITask(Group , taskIndex ) end
---Activates the specified group if it is setup for "late activation." Calls the Group.activate function.
---___
---@param Group Group Late activated group to activate.
function trigger.action.activateGroup(Group ) end
---Deactivates the specified group. Calls the Group.destroy function.
---___
---@param Group Group Group to deactivate.
function trigger.action.deactivateGroup(Group ) end
---Turns the specified groups AI on. Calls the Group.getController(setOnOff(true)) function. Only works with ground and ship groups.
---___
---@param Group Group Group to turn on AI (Ground and Ship only).
function trigger.action.setGroupAIOn(Group ) end
---Turns the specified groups AI off. Calls the Group.getController(setOnOff(false)) function. Only works with ground and ship groups.
---___
---@param Group Group Group to turn off AI (Ground and Ship only).
function trigger.action.setGroupAIOff(Group ) end
---Orders the specified group to stop moving. Calls Group.getController(setCommand()) function and sets the stopRoute command to true. Only works with ground groups.
---___
---@param Group Group Group to stop moving (Ground only).
function trigger.action.groupStopMoving(Group ) end
---Orders the specified group to resume moving. Calls Group.getController(setCommand()) function and sets the stopRoute command to false. Only works with ground groups.
---___
---@param Group Group Group to continue moving (Ground only).
function trigger.action.groupContinueMoving(Group ) end

View File

@ -0,0 +1,32 @@
---@meta
---The voice chat singleton is a means of creating customized voice chat rooms for players to interact with each other in multiplayer.
---@class VoiceChat
VoiceChat ={}
---@enum VoiceChat.Side
VoiceChat.Side = {
NEUTRAL = 0,
RED = 1,
BLUE = 2,
ALL = 3,
}
---@enum VoiceChat.RoomType
VoiceChat.RoomType= {
PERSISTENT = 0,
MULTICREW = 1,
MANAGEABLE = 2,
}
---Creates a VoiceChat room for players to join and interact with each other in a multiplayer mission.
---___
---Example:
---```lua
--- VoiceChat.CreateRoom("SRSIsBetter", 2, 0)
---```
---___
---@param roomName string Name of roomto create.
---@param side VoiceChat.Side Who to create the room for.
---@param roomType VoiceChat.RoomType Type of room to create.
function VoiceChat.createRoom(roomName, side, roomType) end