-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDcsTypes.lua
More file actions
1250 lines (1101 loc) · 56.6 KB
/
DcsTypes.lua
File metadata and controls
1250 lines (1101 loc) · 56.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[
This file is intended to be used as reference and easy intellisense during lua development in DCS.
By adding this file into your LUA directory the classes and functions should be recognised by any intellisense tool that supports lua annotations.
https://luals.github.io/wiki/annotations
Authored by: Dutchie
TODO: GetCategory proper types return
TODO: Description table per type
TODO: define fields of MissionGroupTable
TODO: define fields for Controller class
TODO: AMMO TABLE for CoalitionObject getAmmo
TODO: SENSORS TABLE for CoalitionObject getSensors
]]
---Vec2 is a 2D-vector for the ground plane as a reference plane.
---@class Vec2
---@field x number
---@field y number
---Vec3 type is a 3D-vector. It is a table that has following format
---@class Vec3
---@field x number directed to the north
---@field y number directed to the east
---@field z number directed up (away from ground)
---@class Position : Vec3
---@field p Vec3 Point on map
---@class Array<T>: { [number]: T }
---@class MGRS
---@field UTMZone string
---@field MGRSDigraph string
---@field Easting number
---@field Northing number
do -- env
---@class env
---@field mission table TODO: Mission
---@field info fun(log:string, showMessageBox:boolean?) Prints passed log line with prefix 'info'
---@field warning fun(log:string, showMessageBox:boolean?) Prints passed log line with prefix 'warning'
---@field error fun(log:string, showMessageBox:boolean?) Prints passed log line with prefix 'error'
---@field setErrorMessageBoxEnabled fun(toggle:boolean?) Enables or disables the lua error box to show up on a lua error
---@field getValueDictByKey fun(value:string) : string Returns a string associated with the passed dictionary key value.
env = env
end
do -- timer
---@class timer
---@field getTime fun() : number returns the time in the mission (in seconds. 3 decimals)
---@field getAbsTime fun() : number returns the real time in seconds. 0 for midnight, 43200 for noon
---@field getTime0 fun() : number returns the mission start time in seconds
---@field scheduleFunction fun(functionToCall: function, arguments: table|nil, modelTime: number) : number schedule the function to be run at 'modelTime' and returns the functionID
---@field removeFunction fun(functionID:number) removes a scheduled function from the scheduler
---@field setFunctionTime fun(functionID:number, modelTime:number) reschedules an scheduled function
timer = timer
end
do -- land
---@class land
---@field getHeight fun(position:Vec2) : number returns the distance from the sea-level to the ground alt at point
---@field getSurfaceHeightWithSeabed fun(position:Vec2) : sufaceHeight: number, depth: number returns the surface height and the depth of the seabed respectively.
---@field getSurfaceType fun(position: Vec2) : SurfaceType returns the surface type at a certain position
---@field isVisible fun(origin: Vec3, target: Vec3) returns whether or not there's line between the two points that's not interrupted by terrain.
---@field getIP fun(origin:Vec3, direction:number, distance:number) TODO: Describe
---@field profile fun(start:Vec3, end:Vec3) : Array<Vec3> Returns a list of terrain points between two points. Amount is not directly known.
---@field getClosestPointOnRoads fun(roadType: RoadType, x : number, y : number) : x: number, y: number return x and y coordinate of the closest point on a road type.
---@field findPathOnRoads fun(roadType: RoadType, startX: number, startY: number, endX: number, endY: number) : Array<Vec2> Returns a list of Vec2 points of a road. Can be quite long!
land = land
---@enum SurfaceType
land.SurfaceType = {
LAND = 1,
SHALLOW_WATER = 2,
WATER = 3,
ROAD = 4,
RUNWAY = 5
}
---@alias RoadType
---| "roads"
---| "railroads"
end
do -- atmosphere
---@class atmosphere
---@field getWind fun(point:Vec3): Vec3 returns a velocity vector for the wind at a point
---@field getWindWithTurbulence fun(point:Vec3): Vec3 return a velocity vector for the wind including turbulent air
---@field getTemperatureAndPressure fun(point:Vec3) : temp: number, pressure: number returns temperature and pressure. Kelvins and Pascals.
atmosphere = atmosphere
end
do -- world
---@class Event
---@field id world.event
---@field time number
---@class EventHandler
---@field onEvent fun(event: Event)
---@class world
---@field addEventHandler fun(handler: EventHandler) Adds an event handler that will be called on DCS events.
---@field removeEventHandler fun(handler: EventHandler) Removes an event handler from the "to call table"
---@field getPlayer fun() : Unit returns the unit object that is specified as "Player" in the mission editor
---@field getAirbases fun(side: CoalitionSide?) : Array<Airbase> returns airbases (ships, bases, farps) of a side, or all if side is not passed
---@field searchObjects fun(category: ObjectCategory, searchVolume: Volume, handler: fun(item:Object, value : any?), value: any?) : table searches a volume or space for objects of a specific type and can call the handler function on each found object
---@field getMarkPanels fun() : table TODO: describe
---@field removeJunk fun(searchVolume: Volume) : number searches a volume for any wrecks, craters or debris and removes it
---@field getFogThickness fun() : number returns the global fog thickness. 0 if no fog is present
---@field setFogThickness fun(thickness: number) sets the fog thickness. 100 to 5000. 0 to remove fog
---@field getFogVisibilityDistance fun() : number returns the visibility distance in mist
---@field setFogVisibilityDistance fun(visibility:number) sets the visibility distance. 100 to 100000. If 0 the fog will be removed.
---@field setFogAnimation fun(dataTable: Array<Array<number>>) {relative time (seconds), visibility (meters), thickness (meters)} eg. {5, 1000, 500},
---@field weather table TODO: describe weather
world = world
do -- Event Types
---@enum world.event
world.event = {
S_EVENT_INVALID = 0,
S_EVENT_SHOT = 1,
S_EVENT_HIT = 2,
S_EVENT_TAKEOFF = 3,
S_EVENT_LAND = 4,
S_EVENT_CRASH = 5,
S_EVENT_EJECTION = 6,
S_EVENT_REFUELING = 7,
S_EVENT_DEAD = 8,
S_EVENT_PILOT_DEAD = 9,
S_EVENT_BASE_CAPTURED = 10,
S_EVENT_MISSION_START = 11,
S_EVENT_MISSION_END = 12,
S_EVENT_TOOK_CONTROL = 13,
S_EVENT_REFUELING_STOP = 14,
S_EVENT_BIRTH = 15,
S_EVENT_HUMAN_FAILURE = 16,
S_EVENT_DETAILED_FAILURE = 17,
S_EVENT_ENGINE_STARTUP = 18,
S_EVENT_ENGINE_SHUTDOWN = 19,
S_EVENT_PLAYER_ENTER_UNIT = 20,
S_EVENT_PLAYER_LEAVE_UNIT = 21,
S_EVENT_PLAYER_COMMENT = 22,
S_EVENT_SHOOTING_START = 23,
S_EVENT_SHOOTING_END = 24,
S_EVENT_MARK_ADDED = 25,
S_EVENT_MARK_CHANGE = 26,
S_EVENT_MARK_REMOVED = 27,
S_EVENT_KILL = 28,
S_EVENT_SCORE = 29,
S_EVENT_UNIT_LOST = 30,
S_EVENT_LANDING_AFTER_EJECTION = 31,
S_EVENT_PARATROOPER_LENDING = 32,
S_EVENT_DISCARD_CHAIR_AFTER_EJECTION = 33,
S_EVENT_WEAPON_ADD = 34,
S_EVENT_TRIGGER_ZONE = 35,
S_EVENT_LANDING_QUALITY_MARK = 36,
S_EVENT_BDA = 37,
S_EVENT_AI_ABORT_MISSION = 38,
S_EVENT_DAYNIGHT = 39,
S_EVENT_FLIGHT_TIME = 40,
S_EVENT_PLAYER_SELF_KILL_PILOT = 41,
S_EVENT_PLAYER_CAPTURE_AIRFIELD = 42,
S_EVENT_EMERGENCY_LANDING = 43,
S_EVENT_UNIT_CREATE_TASK = 44,
S_EVENT_UNIT_DELETE_TASK = 45,
S_EVENT_SIMULATION_START = 46,
S_EVENT_WEAPON_REARM = 47,
S_EVENT_WEAPON_DROP = 48,
S_EVENT_UNIT_TASK_COMPLETE = 49,
S_EVENT_UNIT_TASK_STAGE = 50,
S_EVENT_MAC_EXTRA_SCORE = 51,
S_EVENT_MISSION_RESTART = 52,
S_EVENT_MISSION_WINNER = 53,
S_EVENT_RUNWAY_TAKEOFF = 54,
S_EVENT_RUNWAY_TOUCH = 55,
S_EVENT_MAC_LMS_RESTART = 56,
S_EVENT_SIMULATION_FREEZE = 57,
S_EVENT_SIMULATION_UNFREEZE = 58,
S_EVENT_HUMAN_AIRCRAFT_REPAIR_START = 59,
S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH = 60,
S_EVENT_MAX = 61,
}
end
---@enum BirthPlace
world.BirthPlace = {
wsBirthPlace_Air = 1,
wsBirthPlace_RunWay = 2,
wsBirthPlace_Park = 3,
wsBirthPlace_Heliport_Hot = 4,
wsBirthPlace_Heliport_Cold = 5,
}
do --Volumes
---@class Volume
---@field id VolumeType
---@class Segment
---@field params SegmentParams
---@class SegmentParams
---@field from Vec3
---@field to Vec3
---@class Box : Volume
---@field params BoxParams
---@class BoxParams
---@field min Vec3
---@field max Vec3
---@class Sphere : Volume
---@field params SphereParams
---@class SphereParams
---@field point Vec3
---@field radius number
---@class VolumePyramid : Volume
---@field params VolumePyramidParams
---@class VolumePyramidParams
---@field pos Vec3
---@field length number
---@field halfAngleHor number
---@field halfAngleVer number
end
---@enum VolumeType
world.VolumeType = {
SEGMENT = 1,
BOX = 2,
SPHERE = 3,
PYRAMID = 4
}
end
do -- coalition
---@class coalition
---@field addGroup fun(countryID: CountryID, groupCategory: GroupCategory, groupData: MissionGroupTable) : Group Spawn a group. If the name of the group or unit is already present the unit will be replaced.
---@field addStaticObject fun(countryID: CountryID, data: MissionStaticObjectTable) : StaticObject Dynamically adds a static object to the mission. Name needs to be unique. UnitID and groupID can be ommitted and will be created automatically
---@field getGroups fun(coalitionID : CoalitionSide, category: GroupCategory?) : Array<Group> returns group objects of a specific category (or all if no category is specified)
---@field getStaticObjects fun(coalitionID: CoalitionSide) : Array<StaticObject> returns static objects in a coalition
---@field getAirbases fun(coalitionID: CoalitionSide) : Array<Airbase> returns airbases belonging to a coalition
---@field getPlayers fun(coalitionID: CoalitionSide) : Array<Unit> returns units currently occupied by players
---@field getServiceProviders fun(coalitionID: CoalitionSide, serviceType: CoalitionService) : Array<Unit> Returns all units that provide a specific service. (AWACS, Tankers etc.)
---@field addRefPoint fun(coalitionID: CoalitionSide, refPoint: RefPoint) adds a new reference point to the coalition
---@field getRefPoints fun(coalitionID: CoalitionSide) : table TODO: Ref point return table
---@field getMainRefPoint fun(coalitionID: CoalitionSide) : Vec3 returns bullseye location for coalition
---@field getCountryCoalition fun(countryID: CountryID) : CoalitionSide returns coalitionID for a specific countryID
coalition = coalition
---@class RefPoint
---@field callsign number
---@field type number
---@field point Vec3
do -- group tables
---@class MissionGroupTable
end
do -- static object tables
---@class MissionStaticObjectTable
---@field heading number
---@field groupId number
---@field shape_name string
---@field type string
---@field unitId number
---@field rate number
---@field name string
---@field category string
---@field x number
---@field y number
---@field dead boolean
end
---@enum CoalitionSide
coalition.side = {
NEUTRAL = 0,
RED = 1,
BLUE = 2,
}
---@enum CoalitionService
coalition.service = {
ATC = 0,
AWACS = 1,
TANKER = 2,
FAC = 3
}
end
do -- trigger
---@class Trigger
---@field action TriggerActions
---@field misc TriggerMisc
trigger = trigger
---@class TriggerMisc
---@field getUserFlag fun(flagName: string) : number returns the value of a user flag.
---@field getZone fun(zoneName: string) : Array<TriggerZone> returns triggerzones. Only works for cilinders really. For more detailed zone data see: env.mission.triggers.zones
trigger.misc = trigger.misc
---@class TriggerActions : OutText, OutSound, OtherCommands, MarkCommands, AITriggerCommands
---@field ctfColorTag fun(unitName: string, smokeColor: SmokePlumeColor, minAlt: number?) Created a smoke plume behind a specified aircraft
---@field setUserFlag fun(flagName: string, userFlagValue: boolean|number) Sets a user flag to a specified value
---@field explosion fun(point: Vec3, power: number) Creates an explosion at a given point at the specified power.
---@field smoke fun(point: Vec3, color: SmokeColor) Creates colored smoke marker at a given point
---@field effectSmokeBig fun(point: Vec3, effect: SmokeEffect, density: number, name: string?) Creates a large smoke effect on a vec3 point of a specified type and density.
---@field effectSmokeStop fun(name: string) Stop a smoke effect effect of the passsed name
---@field illuminationBomb fun(point: Vec3, power: number) Creates an ilumination bomb that will burn for 300 seconds
---@field signalFlare fun(point: Vec3, flareColor: FlareColor, azimuth: number) Creates a signal flare at the given point in the specified color. The flare will be launched in the direction of the azimuth variable.
---@field radioTransmission fun(fileName: string, point:Vec3, modulation: Modulation, loop: boolean, frequency: number, power: number, name: string?) Transmits an audio file to be broadcast over a specific frequency eneminating from the specified point.
---@field stopRadioTransmission fun(name: string) Stops a radio transmission of the passed name
---@field setUnitInternalCargo fun(unitName: string, mass: number) Sets the internal cargo for the specified unit at the specified mass
trigger.action = trigger.action
---@class OutSound
---@field outSound fun(fileName: string) Plays a sound file to all players.
---@field outSoundForCoalition fun(coalitionSide: CoalitionSide, soundFile: string) Plays a sound file to all players on the specified coalition.
---@field outSoundForCountry fun(country: CountryID, soundfile: string) Plays a sound file to all players on the specified country.
---@field outSoundForGroup fun(groupId: number, soundFile: string) Plays a sound file to all players in the specified group.
---@field outSoundForUnit fun(unitId: number, soundFile: string) Plays a sound file to all players in the specified unit.
---@class OutText
---@field outText fun(text: string, displayTime: number, clearview: boolean?) Displays the passed string of text for the specified time to all players.
---@field outTextForCoalition fun(coalitionId: CoalitionSide, text: string, displayTime: number, clearview: boolean?) Displays the passed string of text for the specified time to all players belonging to the specified coalition.
---@field outTextForCountry fun(country: CountryID, text: string, displayTime: number, clearview: boolean?) Displays the passed string of text for the specified time to all players belonging to the specified country.
---@field outTextForGroup fun(groupId: number, text: string, displayTime: number, clearView: boolean?) Displays the passed string of text for the specified time to all players in the specified group.
---@field outTextForUnit fun(unitId: number, text: string, displayTime: number, clearView: boolean?) Displays the passed string of text for the specified time to all players in the specified unit.
---@class OtherCommands
---@field addOtherCommand fun(name: string, userFlagName: string, userFlagValue: string) Adds a command to the "F10 Other" radio menu allowing players to call commands and set flags within the mission.
---@field removeOtherCommand fun(name: string) Removes the command that matches the specified name input variable from the "F10 Other" radio menu.
---@field addOtherCommandForCoalition fun(coalitionId: CoalitionSide, name: string, userFlagName: string, userFlagValue: number) Adds a command to the "F10 Other" radio menu allowing players to call commands and set flags within the mission.
---@field removeOtherCommandForCoalition fun(coalitionId: CoalitionSide, name: string) Removes the command that matches the specified name input variable from the "F10 Other" radio menu if the command was added for coalition.
---@field addOtherCommandForGroup fun(groupId: number, name: string, userFlagName: string, userFlagValue: number) Adds a command to the "F10 Other" radio menu allowing players to call commands and set flags within the mission.
---@field removeOtherCommandForGroup fun(groupId: number, name: string) Removes the command that matches the specified name input variable from the "F10 Other" radio menu if the command exists for the specified group.
---@class MarkCommands
---@field markToAll fun(id: number, text:string, point:Vec3, readOnly: boolean?, message: string?) Adds a mark point to all on the F10 map with attached text.
---@field markToCoalition fun(id: number, text: string, point: Vec3, coalitionID: CoalitionSide, readOnly: boolean?, message: string) Adds a mark point to a coalition on the F10 map with attached text.
---@field markToGroup fun(id: number, text: string, point: Vec3, groupID: number, readOnly: boolean?, message: string) Adds a mark point to a group on the F10 map with attached text.
---@field removeMark fun(id: number) Removes a mark panel from the f10 map
---@field markupToAll fun(shapeID: ShapeId, coalition: DrawCoalition, id: number, ... : any) Complex parameters. <br/> See: https://wiki.hoggitworld.com/view/DCS_func_markupToAll
---@field lineToAll fun(coalition: DrawCoalition, id: number, startPoint:Vec3, endPoint: Vec3, color:table, lineType: LineType, readonly: boolean?, message: string?) Creates a line on the F10 map from one point to another.
---@field circleToAll fun(coalition: DrawCoalition, id: number, center: Vec3 , radius: number, color: table , fillColor: table , lineType: LineType , readOnly: boolean?, message: string?) Creates a circle on the map with a given radius, color, fill color, and outline.
---@field rectToAll fun(coalition:DrawCoalition, id:number, startPoint: Vec3, endPoint:Vec3, color: table, fillColor: table, lineType: LineType , readOnly: boolean?, message: string?) Creates a rectangle on the map from the startpoint in one corner to the endPoint in the opposite corner.
---@field quadToAll fun(coalition:DrawCoalition, id:number, point1: Vec3, point2:Vec3, point3:Vec3, point4:Vec3,color: table, fillColor: table, lineType: LineType , readOnly: boolean?, message: string?) Creates a shape defined by the 4 points on the F10 map.
---@field textToAll fun(coalition:DrawCoalition, id: number, point:Vec3, color: table, fillColor: table, fontSize:table, readOnly:boolean, text:string) Creates a text imposed on the map at a given point. Text scales with the map.
---@field arrowToAll fun(coalition:DrawCoalition, id: number, startPoint:Vec3, endPoint:Vec3, color:table, fillColor:table, lineType:LineType, readonly:boolean?, message: string?) Creates an arrow from the startPoint to the endPoint on the F10 map. The arrow will be "pointing at" the startPoint
---@field setMarkupRadius fun(id:number, radius:number) Updates the radius of the specified mark to be the new value.
---@field setMarkupText fun(id:number, text: string) Updates the text value of the passed mark to the passed text value.
---@field setMarkupFontSize fun(id:number, fontSize:number) Updates the font size of the specified mark to be the new value.
---@field setMarkupColor fun(id:number, color:table) Updates the color of the specified mark to be the new value.
---@field setMarkupColorFill fun(id: number, color: table) Updates the fill color of the specified mark to be the new value.
---@field setMarkupTypeLine fun(id:number, lineType: LineType) Updates the type line of the specified mark to be the new value.
---@field setMarkupPositionEnd fun(id: number, end:Vec3) Updates the position of a mark that was defined at the last point given to create it.
---@field setMarkupPositionStart fun(id: number, end:Vec3) Updates the position of a mark that was defined at the last point given to create it.
---@class AITriggerCommands
---@field setAITask fun(group:Group, taskIndex:number) Sets the task of the specified index to be the one and only active task.
---@field pushAITask fun(group:Group, taskIndex:number) Pushes the task of the specified index to the front of the tasking queue.
---@field activateGroup fun(group:Group) Activates the specified group if it is setup for "late activation." Calls the Group.activate function.
---@field deactivateGroup fun(group:Group) Deactivates the specified group. Calls the Group.destroy function.
---@field setGroupAIOn fun(group:Group) Turns the specified groups AI on. Calls the Group.getController(setOnOff(true)) function.
---@field setGroupAIOff fun(group:Group) Turns the specified groups AI off. Calls the Group.getController(setOnOff(false)) function.
---@field groupStopMoving fun(group:Group) Orders the specified group to stop moving. Calls Group.getController(setCommand()) function and sets the stopRoute command to true.
---@field groupContinueMoving fun(group:Group) Orders the specified group to resume moving. Calls Group.getController(setCommand()) function and sets the stopRoute command to false.
---@enum SmokeColor
trigger.smokeColor = {
Green = 0,
Red = 1,
White = 2,
Orange = 3,
Blue = 4
}
---@enum FlareColor
trigger.flareColor = {
Green = 0,
Red = 1,
White = 2,
Yellow = 3
}
---@alias SmokePlumeColor
---| 0 Disabled
---| 1 Green
---| 2 Red
---| 3 White
---| 4 Orange
---| 5 Blue
---@alias SmokeEffect
---| 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
---@alias Modulation
---| 0 AM
---| 1 FM
---@alias ShapeId
---| 1 Line
---| 2 Circle
---| 3 Rect
---| 4 Arrow
---| 5 Text
---| 6 Quad
---| 7 Freeform
---@alias LineType
---| 0 No Line
---| 1 Solid
---| 2 Dashed
---| 3 Dotted
---| 4 Dot Dash
---| 5 Long Dash
---| 6 Two Dash
---@alias DrawCoalition
---| -1 All
---| 0 Neutral
---| 1 Red
---| 2 Blue
---@class TriggerZone
---@field point Vec3
---@field radius number
end
do --coord
---@class Coord
---@field LLtoLO fun(lattitude: number, longitude:number, altitude: number?):Vec3 Returns a point from latitude and longitude in the vec3 format.
---@field LOtoLL fun(point:Vec3): lattitude:number, longitude:number, altitude:number Returns multiple values of a given vec3 point in latitude, longitude, and altitude
---@field LLtoMGRS fun(lattitude: number, longitude:number):MGRS Returns an MGRS table from the latitude and longitude coordinates provided
---@field MGRStoLL fun(mgrs:MGRS): lattitude:number, longitude:number, altitude:number Returns multiple values of a given in MGRS coordinates and converts it to latitude, longitude, and altitude
coord = coord
end
do -- missioncommands
---@class MissionCommands
---@field addCommand fun(name:string, path: table?, functionToRun: function, argument: any?):table Adds a command to the "F10 Other" radio menu allowing players to run specified scripting functions.
---@field addSubMenu fun(name: string, path: table?): table Creates a submenu of a specified name for all players.
---@field removeItem fun(path:table?) Removes the item of the specified path from the F10 radio menu for all.
---@field addCommandForCoalition fun(coalition: CoalitionSide, name: string, path: table?, functionToRun:function, argument:any?):table Adds a command to the "F10 Other" radio menu allowing players to run specified scripting functions.
---@field addSubMenuForCoalition fun(coalition:CoalitionSide, name: string, path:table?):table Creates a submenu of a specified name for the specified coalition. Can be used to create nested sub menues. If the path is not specified, submenu is added to the root menu.
---@field removeItemForCoalition fun(coalition:CoalitionSide, path:table?) Removes the item of the specified path from the F10 radio menu for the specified coalition.
---@field addCommandForGroup fun(groupId: number, name: string, path: table?, functionToRun:function, argument:any?):table Adds a command to the "F10 Other" radio menu allowing players to run specified scripting functions.
---@field addSubMenuForGroup fun(groupId: number, name:string, path:table?): table Creates a submenu of a specified name for the specified group.
---@field removeItemForGroup fun(groupId: number, path:table?) Removes the item of the specified path from the F10 radio menu for the specified group.
missionCommands = missionCommands
end
do -- net
---@class Net
---@field send_chat fun(message:string, all:boolean?) Sends a chat message.
---@field send_chat_to fun(message: string, playerID: number, fromID: number?) Sends a chat message to the player with the passed id.
---@field load_mission fun(name:string):boolean Loads the specified mission.
---@field load_next_mission fun():boolean Load the next mission from the server mission list.
---@field get_player_list fun():table? Returns players currently connected TODO: Document table
---@field get_my_player_id fun():number returns playerID
---@field get_server_id fun():number returns the playerID for the server (currently always 1)
---@field get_player_info fun(playerID: number, attribute? : string) : PlayerInfo Returns a table of attributes for a given playerId. If optional attribute present only that value is returned
---@field kick fun(playerID:number, message:string?):boolean Kicks a player from the server. Can display a message to the user.
---@field get_stat fun(playeID:number, statID:number?):number
---@field get_name fun(playerID:number):string get players name
---@field get_slot fun(playerID:number):coalitionID:CoalitionSide,slotID:number gets coalitionID and slotID of a player
---@field force_player_slot fun(playerID: number, sideID: CoalitionSide, slotID:number) forces a
---@field lua2json fun(luaObject:any):string converts a lua object to a json string
---@field json2lua fun(json: string):table converts a json string to a lua object
---@field dostring_in fun(state:string, dostring:string):string Executes a lua string in a given lua environment in the game.
---@field log fun(text:string) writes INFO log to, recommend using "env" singleton to log as it supports all levels.
net = net
---@class PlayerInfo
---@field id number
---@field name string
---@field side CoalitionSide
---@field slotID number
---@field ping number
---@field ipaddr string
---@field ucid string
-- undocumented
--@field set_slot
--@field recv_chat
end
do -- Country
---@class CountrySingleton
---@field name table<number,string>
country = country
---@enum CountryID
country.id = {
RUSSIA = 1,
UKRAINE = 2,
USA = 3,
TURKEY = 4,
UK = 5,
FRANCE = 6,
GERMANY = 7,
CANADA = 8,
SPAIN = 9,
THE_NETHERLANDS = 10,
BELGIUM = 11,
NORWAY = 12,
DENMARK = 13,
ISRAEL = 14,
GEORGIA = 15,
INSURGENTS = 16,
ABKHAZIA = 17,
SOUTH_OSETIA = 18,
ITALY = 19
}
end
--========================
-- Classes
--========================
do -- Controller
---@class Controller
Controller = Controller
---@alias TaskType
---| "NoTask"
---| "AttackGroup" attack group
---|
---@class Task
---@field id TaskType
do -- Task Aliases
AI = AI
---@enum WeaponExpend
AI.Task.WeaponExpend = {
}
end
do --TaskWrapper
---@class WrapperTask : Task
end
do -- Main Tasks
---@class MainTask : Task
---@class AttackGroup : MainTask
---@field params AttackGroupParams
---@class AttackGroupParams
---@field groupId number
---@field weaponType WeaponFlag?
---@field expend AI.Task.WeaponExpend?
---@field directionEnabled boolean?
---@field altitude number?
---@field attackQtyLimit boolean?
---@field attackQty number?
---@class AttackUnit : Task
---@field params AttackUnitParams
---@class AttackUnitParams
---@field unitId number
---@field weaponType WeaponFlag?
---@field expend AI.Task.WeaponExpend?
---@field direction number?
---@field attackQtyLimit boolean?
---@field attackQty number?
---@field groupAttack number?
---@class Bombing : Task
---@field params BombingTaskParams
---@class BombingTaskParams
---@field point Vec2
---@field attackQty number
---@field weaponType WeaponFlag?
---@field expend AI.Task.WeaponExpend?
---@field attackQtyLimit boolean?
---@field direction number?
---@field groupAttack boolean?
---@field altitude number?
---@field altitudeEnabled boolean?
---@field attackType string "DIVE"
---@class Strafing : Task
--[[
TODO
]]
---@class CarpetBombing : Task
--[[
TODO
]]
---@class AttackMapObject : Task
--[[
TODO
]]
---@class BombingRunway : Task
--[[
TODO
]]
---@class orbit : Task
--[[
TODO
]]
---@class refueling : Task
--[[
TODO
]]
---@class land : Task
--[[
TODO
]]
---@class follow : Task
--[[
TODO
]]
---@class followBigFormation : Task
--[[
TODO
]]
---@class escort : Task
--[[
TODO
]]
---@class Embarking : Task
--[[
TODO
]]
---@class fireAtPoint : Task
--[[
TODO
]]
---@class hold : Task
--[[
TODO
]]
---@class FAC_AttackGroup : Task
--[[
TODO
]]
---@class EmbarkToTransport : Task
--[[
TODO
]]
---@class DisembarkFromTransport : Task
--[[
TODO
]]
---@class CargoTransportation : Task
--[[
TODO
]]
---@class goToWaypoint : Task
--[[
TODO
]]
---@class groundEscort : Task
--[[
TODO
]]
---@class RecoveryTanker : Task
--[[
TODO
]]
end
---@class EnrouteTask : Task
do -- AI
---@class AI
AI = AI
AI = {
-- AI.Option
Option = {
-- AI.Option.Air
Air = {
---@enum AI.Option.Air.id
id = {
JETT_TANKS_IF_EMPTY = "25",
SILENCE = "7",
ROE = "0",
RADAR_USING = "3",
OPTION_RADIO_USAGE_ENGAGE = "22",
PROHIBIT_AG = "17",
ECM_USING = "13",
PROHIBIT_WP_PASS_REPORT = "19",
PROHIBIT_AA = "14",
REACTION_ON_THREAT = "1",
PREFER_VERTICAL = "32",
FORCED_ATTACK = "26",
PROHIBIT_AB = "16",
RTB_ON_OUT_OF_AMMO = "10",
MISSILE_ATTACK = "18",
PROHIBIT_JETT = "15",
OPTION_RADIO_USAGE_CONTACT = "21",
FLARE_USING = "4",
OPTION_RADIO_USAGE_KILL = "23",
FORMATION = "5",
RTB_ON_BINGO = "6",
NO_OPTION = "-1",
},
val = {
---@enum AI.Option.Air.val.FLARE_USING
FLARE_USING = {
WHEN_FLYING_NEAR_ENEMIES = "3",
WHEN_FLYING_IN_SAM_WEZ = "2",
AGAINST_FIRED_MISSILE = "1",
NEVER = "0",
},
---@enum AI.Option.Air.val.RADAR_USING
RADAR_USING = {
FOR_ATTACK_ONLY = "1",
FOR_SEARCH_IF_REQUIRED = "2",
NEVER = "0",
FOR_CONTINUOUS_SEARCH = "3",
},
---@enum AI.Option.Air.val.REACTION_ON_THREAT
REACTION_ON_THREAT = {
BYPASS_AND_ESCAPE = "3",
EVADE_FIRE = "2",
NO_REACTION = "0",
PASSIVE_DEFENCE = "1",
ALLOW_ABORT_MISSION = "4",
},
---@enum AI.Option.Air.val.MISSILE_ATTACK
MISSILE_ATTACK = {
HALF_WAY_RMAX_NEZ = "2",
MAX_RANGE = "0",
TARGET_THREAT_EST = "3",
RANDOM_RANGE = "4",
NEZ_RANGE = "1",
},
---@enum AI.Option.Air.val.ECM_USING
ECM_USING = {
ALWAYS_USE = "3",
NEVER_USE = "0",
USE_IF_DETECTED_LOCK_BY_RADAR = "2",
USE_IF_ONLY_LOCK_BY_RADAR = "1",
},
---@enum AI.Option.Air.val.ROE
ROE = {
WEAPON_FREE = "0",
RETURN_FIRE = "3",
OPEN_FIRE = "2",
WEAPON_HOLD = "4",
OPEN_FIRE_WEAPON_FREE = "1",
},
}
},
Ground = {
---@enum AI.Option.Ground.id
id = {
EVASION_OF_ARM = "31",
ALARM_STATE = "9",
DISPERSE_ON_ATTACK = "8",
ENGAGE_AIR_WEAPONS = "20",
AC_ENGAGEMENT_RANGE_RESTRICTION = "24",
FORMATION = "5",
ROE = "0",
NO_OPTION = "-1",
},
val = {
---@enum AI.Option.Ground.val.ALARM_STATE
ALARM_STATE = {
AUTO = "0",
GREEN = "1",
RED = "2",
},
---@enum AI.Option.Ground.val.ROE
ROE = {
OPEN_FIRE = "2",
WEAPON_HOLD = "4",
RETURN_FIRE = "3"
}
}
},
Naval = {
---@enum AI.Option.Naval.id
id = {
ROE = "0",
NO_OPTION = "-1",
},
val = {
---@enum AI.Option.Naval.val.ROE
ROE = {
OPEN_FIRE = "2",
WEAPON_HOLD = "4",
RETURN_FIRE = "3",
},
}
}
},
Task = {
---@enum AI.Task.OrbitPattern
OrbitPattern = {
RACE_TRACK = "Race-Track",
CIRCLE = "Circle",
},
---@enum AI.Task.Designation
Designation = {
WP = "WP",
NO = "No",
LASER = "Laser",
IR_POINTER = "IR-Pointer",
AUTO = "Auto",
},
---@enum AI.Task.TurnMethod
TurnMethod = {
FLY_OVER_POINT = "Fly Over Point",
FIN_POINT = "Fin Point",
},
---@enum AI.Task.VehicleFormation
VehicleFormation = {
VEE = "Vee",
ECHELON_RIGHT = "EchelonR",
OFF_ROAD = "Off Road",
RANK = "Rank",
ECHELON_LEFT = "EchelonL",
ON_ROAD = "On Road",
CONE = "Cone",
DIAMOND = "Diamond",
},
---@enum AI.Task.AltitudeType
AltitudeType = {
RADIO = "RADIO",
BARO = "BARO",
},
---@enum AI.Task.WaypointType
WaypointType = {
TAKEOFF = "TakeOff",
TAKEOFF_PARKING = "TakeOffParking",
TURNING_POINT = "Turning Point",
TAKEOFF_PARKING_HOT = "TakeOffParkingHot",
LAND = "Land",
},
---@enum AI.Task.WeaponExpend
WeaponExpend = {
QUARTER = "Quarter",
TWO = "Two",
ONE = "One",
FOUR = "Four",
HALF = "Half",
ALL = "All",
},
},
---@enum AI.Skill
Skill = {
PLAYER = "Player",
AVERAGE = "Average",
HIGH = "High",
EXCELLENT = "Excellent",
GOOD = "Good",
CLIENT = "Client"
}
}
end
end
do -- Object
---@class Object
---@field getName fun(self:Object): string returns the name of the object in the mission environment
---@field isExist fun(self:Object): boolean Return a boolean value based on whether the object currently exists in the mission.
---@field destroy fun(self:Object) Destroys the object, physically removing it from the game world without creating an event.
---@field getCategory fun(self:Object): category: ObjectCategory, subCategory:number Returns an enumerator of the category for the specific object. <br/>!!Dependent on how called. Check docs
---@field getTypeName fun(self:Object): string returns the typename of the object
---@field getDesc fun(self:Object):table returns description table, which is different for each type and subtype and even object
---@field hasAttribute fun(self:Object, attribute:string):boolean Returns a boolean value if the object in question has the passed attribute.
---@field getPoint fun(self:Object):Vec3 Returns a vec3 table of the x, y, and z coordinates for the position of the given object in 3D space.
---@field getPosition fun(self:Object):Position Returns a Position3 table of the objects current position and orientation in 3D space.
---@field getVelocity fun(self:Object):Vec3 Returns a vec3 table of the objects velocity vectors.
---@field inAir fun(self:Object):boolean Returns a boolean value if the object in question is in the air.
Object = Object
---@enum ObjectCategory
Object.Category = {
UNIT = 1,
WEAPON = 2,
STATIC = 3,
BASE = 4,
SCENERY = 5,
Cargo = 6
}
end
do --SceneryObject
---@class SceneryObject : Object
---@field getLife fun(self:SceneryObject):number gets the life of a sceneryObject
---@field getDescByName fun(typeName:string):table gets the description based on the typename
SceneryObject = SceneryObject
end
do --CoalitionObject
---@class CoalitionObject : Object
---@field getCoalition fun(self:CoalitionObject):CoalitionSide Returns an enumerator that defines the coalition that an object currently belongs to.
---@field getCountry fun(self:CoalitionObject):CountryID Returns an enumerator that defines the country that an object currently belongs to.
CoalitionObject = CoalitionObject
end
do --Unit
---@class Unit : CoalitionObject
---@field Category UnitCategory
---@field getByName fun(name: string): Unit?
---@field getDescByName fun(typeName: string): table?
---@field isActive fun(self:Unit): boolean Returns a boolean value if the unit is activated
---@field getPlayerName fun(self:Unit): string? Returns a string value of the name of the player if the unit is currently controlled by a player
---@field getID fun(self:Unit): number Returns a number which defines the unique mission id of a given object.
---@field getNumber fun(self:Unit):number Returns a numerical value of the default index of the specified unit within the group as defined within the mission editor or addGroup scripting function.
---@field getCategoryEx fun(self:Unit):number Returns an enumerator of the category for the specific object.
---@field getObjectID fun(self:Unit):number Returns the runtime object Id associated with the unit.
---@field getController fun(self:Unit):Controller Returns the controller of the specified object.
---@field getGroup fun(self:Unit):Group Gets the group of the unit
---@field getCallsign fun(self:Unit): string Returns a localized string of the units callsign
---@field getLife fun(self:Unit): number Returns the current "life" of a unit.
---@field getLife0 fun(self:Unit):number Returns the initial life value of a unit.
---@field getFuel fun(self:Unit):number Returns a percentage of the current fuel remaining in an aircraft's inventory based on the maximum possible fuel load.
---@field getAmmo fun(self:Unit):table returns ammo table TODO: specify table
---@field getSensors fun(self:Unit):table returns sensors table TODO: Specify table
---@field hasSensors fun(self:Unit, sensorType: SensorType?, subType:OpticType|RadarType|nil) : boolean Returns true if the unit has the specified sensors.
---@field getRadar fun(self:Unit) : isOperational:boolean, mostInteresting: Object Returns two values. The first value is a boolean indicating if any radar on the Unit is operational.
---@field getDrawArgumentValue fun(self:Unit, arg:number): number Returns the current value for an animation argument on the external model of the given object
---@field getNearestCargos fun(self:Unit): table Returns a table of friendly cargo objects indexed numerically and sorted by distance from the helicopter.
---@field enableEmission fun(self:Unit, setting:boolean) Sets the passed group or unit objects radar emitters on or off.
---@field getDescentCapacity fun(self:Unit):number Returns the number of infantry that can be embark onto the aircraft.
Unit = Unit
---@enum UnitCategory
Unit.Category = {
AIRPLANE = 0,
HELICOPTER = 1,
GROUND_UNIT = 2,
SHIP = 3,
STRUCTURE = 4
}
---@enum SensorType
Unit.SensorType = {
OPTIC = 0,
RADAR = 1,
IRST = 2,
RWR = 3