-
Notifications
You must be signed in to change notification settings - Fork 147
/
openra.lua
1464 lines (1459 loc) · 48.8 KB
/
openra.lua
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
local interpreter = {
name = "OpenRA",
description = "OpenRA map scripting Lua API",
api = {"baselib", "openra"},
hasdebugger = false,
skipcompile = true,
}
-- This is an automatically generated Lua API definition generated for release-20171014 of OpenRA.
-- https://github.com/OpenRA/OpenRA/wiki/Utility was used with the --zbstudio-lua-api parameter.
-- See https://github.com/OpenRA/OpenRA/wiki/Lua-API for human readable documentation.
local api = {
Actor = {
type = "class",
childs = {
BuildTime = {
type = "function",
description = [[Returns the build time (in ticks) of the requested unit type.
An optional second value can be used to exactly specify the producing queue type.]],
args = "(string type, string queue = nil)",
returns = "(int)",
},
Cost = {
type = "function",
args = "(string type)",
returns = "(int)",
},
Create = {
type = "function",
description = [[Create a new actor. initTable specifies a list of key-value pairs that defines the initial parameters for the actor's traits.]],
args = "(string type, bool addToWorld, LuaTable initTable)",
returns = "(Actor)",
},
CruiseAltitude = {
type = "function",
description = [[Returns the cruise altitude of the requested unit type (zero if it is ground-based).]],
args = "(string type)",
returns = "(int)",
},
}
},
Beacon = {
type = "class",
childs = {
New = {
type = "function",
description = [[Creates a new beacon that stays for the specified time at the specified WPos. Does not remove player set beacons, nor gets removed by placing them.]],
args = "(Player owner, WPos position, int duration = 750, bool showRadarPings = True)",
returns = "(Beacon)",
},
}
},
Camera = {
type = "class",
childs = {
Position = {
type = "value",
description = [[The center of the visible viewport.]],
},
}
},
CPos = {
type = "class",
childs = {
New = {
type = "function",
description = [[Create a new CPos with the specified coordinates.]],
args = "(int x, int y)",
returns = "(CPos)",
},
Zero = {
type = "value",
description = [[The cell coordinate origin.]],
},
}
},
CVec = {
type = "class",
childs = {
New = {
type = "function",
description = [[Create a new CVec with the specified coordinates.]],
args = "(int x, int y)",
returns = "(CVec)",
},
Zero = {
type = "value",
description = [[The cell zero-vector.]],
},
}
},
DateTime = {
type = "class",
childs = {
GameTime = {
type = "value",
description = [[Get the current game time (in ticks).]],
},
IsHalloween = {
type = "value",
description = [[True on the 31st of October.]],
},
Minutes = {
type = "function",
description = [[Converts the number of minutes into game time (ticks).]],
args = "(int minutes)",
returns = "(int)",
},
Seconds = {
type = "function",
description = [[Converts the number of seconds into game time (ticks).]],
args = "(int seconds)",
returns = "(int)",
},
}
},
Facing = {
type = "class",
childs = {
East = {
type = "value",
},
North = {
type = "value",
},
NorthEast = {
type = "value",
},
NorthWest = {
type = "value",
},
South = {
type = "value",
},
SouthEast = {
type = "value",
},
SouthWest = {
type = "value",
},
West = {
type = "value",
},
}
},
HSLColor = {
type = "class",
childs = {
Aqua = {
type = "value",
},
Black = {
type = "value",
},
Blue = {
type = "value",
},
Brown = {
type = "value",
},
Cyan = {
type = "value",
},
DarkBlue = {
type = "value",
},
DarkCyan = {
type = "value",
},
DarkGray = {
type = "value",
},
DarkGreen = {
type = "value",
},
DarkOrange = {
type = "value",
},
DarkRed = {
type = "value",
},
FromHex = {
type = "function",
description = [[Create a new HSL color with the specified red/green/blue/[alpha] hex string (rrggbb[aa]).]],
args = "(string value)",
returns = "(HSLColor)",
},
FromRGB = {
type = "function",
description = [[Create a new HSL color with the specified red/green/blue/[alpha] values.]],
args = "(int red, int green, int blue, int alpha = 255)",
returns = "(HSLColor)",
},
Fuchsia = {
type = "value",
},
Gold = {
type = "value",
},
Gray = {
type = "value",
},
Green = {
type = "value",
},
LawnGreen = {
type = "value",
},
LightBlue = {
type = "value",
},
LightCyan = {
type = "value",
},
LightGray = {
type = "value",
},
LightGreen = {
type = "value",
},
LightYellow = {
type = "value",
},
Lime = {
type = "value",
},
LimeGreen = {
type = "value",
},
Magenta = {
type = "value",
},
Maroon = {
type = "value",
},
Navy = {
type = "value",
},
New = {
type = "function",
description = [[Create a new HSL color with the specified hue/saturation/luminosity.]],
args = "(int hue, int saturation, int luminosity)",
returns = "(HSLColor)",
},
Olive = {
type = "value",
},
Orange = {
type = "value",
},
OrangeRed = {
type = "value",
},
Purple = {
type = "value",
},
Red = {
type = "value",
},
Salmon = {
type = "value",
},
SkyBlue = {
type = "value",
},
Teal = {
type = "value",
},
White = {
type = "value",
},
Yellow = {
type = "value",
},
}
},
Lighting = {
type = "class",
childs = {
Ambient = {
type = "value",
},
Blue = {
type = "value",
},
Flash = {
type = "function",
description = [[Controls the `FlashPaletteEffect` trait.]],
args = "(string type = nil, int ticks = -1)",
returns = "(void)",
},
Green = {
type = "value",
},
Red = {
type = "value",
},
}
},
Map = {
type = "class",
childs = {
ActorsInBox = {
type = "function",
description = [[Returns a table of all actors within the requested rectangle, filtered using the specified function.]],
args = "(WPos topLeft, WPos bottomRight, LuaFunction filter = nil)",
returns = "(Actor[])",
},
ActorsInCircle = {
type = "function",
description = [[Returns a table of all actors within the requested region, filtered using the specified function.]],
args = "(WPos location, WDist radius, LuaFunction filter = nil)",
returns = "(Actor[])",
},
ActorsInWorld = {
type = "value",
description = [[Returns a table of all the actors that are currently on the map/in the world.]],
},
ActorsWithTag = {
type = "function",
description = [[Returns a table of all actors tagged with the given string.]],
args = "(string tag)",
returns = "(Actor[])",
},
BottomRight = {
type = "value",
description = [[Returns the location of the bottom-right corner of the map (assuming zero terrain height).]],
},
CenterOfCell = {
type = "function",
description = [[Returns the center of a cell in world coordinates.]],
args = "(CPos cell)",
returns = "(WPos)",
},
ClosestEdgeCell = {
type = "function",
description = [[Returns the closest cell on the visible border of the map from the given cell.]],
args = "(CPos givenCell)",
returns = "(CPos)",
},
ClosestMatchingEdgeCell = {
type = "function",
description = [[Returns the first cell on the visible border of the map from the given cell,
matching the filter function called as function(CPos cell).]],
args = "(CPos givenCell, LuaFunction filter)",
returns = "(CPos)",
},
Difficulty = {
type = "value",
description = [[Returns the difficulty selected by the player before starting the mission.]],
},
IsNamedActor = {
type = "function",
description = [[Returns true if actor was originally specified in the map file.]],
args = "(Actor actor)",
returns = "(bool)",
},
IsSinglePlayer = {
type = "value",
description = [[Returns true if there is only one human player.]],
},
LobbyOption = {
type = "function",
description = [[Returns the value of a `ScriptLobbyDropdown` selected in the game lobby.]],
args = "(string id)",
returns = "(LuaValue)",
},
NamedActor = {
type = "function",
description = [[Returns the actor that was specified with a given name in the map file (or nil, if the actor is dead or not found).]],
args = "(string actorName)",
returns = "(Actor)",
},
NamedActors = {
type = "value",
description = [[Returns a table of all the actors that were specified in the map file.]],
},
RandomCell = {
type = "function",
description = [[Returns a random cell inside the visible region of the map.]],
args = "()",
returns = "(CPos)",
},
RandomEdgeCell = {
type = "function",
description = [[Returns a random cell on the visible border of the map.]],
args = "()",
returns = "(CPos)",
},
TerrainType = {
type = "function",
description = [[Returns the type of the terrain at the target cell.]],
args = "(CPos cell)",
returns = "(string)",
},
TopLeft = {
type = "value",
description = [[Returns the location of the top-left corner of the map (assuming zero terrain height).]],
},
}
},
Media = {
type = "class",
childs = {
Debug = {
type = "function",
description = [[Displays a debug message to the player, if "Show Map Debug Messages" is checked in the settings.]],
args = "(string text)",
returns = "(void)",
},
DisplayMessage = {
type = "function",
description = [[Display a text message to the player.]],
args = "(string text, string prefix = Mission, Nullable`1 color = nil)",
returns = "(void)",
},
FloatingText = {
type = "function",
description = [[Display a text message at the specified location.]],
args = "(string text, WPos position, int duration = 30, Nullable`1 color = nil)",
returns = "(void)",
},
PlayMovieFullscreen = {
type = "function",
description = [[Play a VQA video fullscreen. File name has to include the file extension.]],
args = "(string movie, LuaFunction func = nil)",
returns = "(void)",
},
PlayMovieInRadar = {
type = "function",
description = [[Play a VQA video in the radar window. File name has to include the file extension. Returns true on success, if the movie wasn't found the function returns false and the callback is executed.]],
args = "(string movie, LuaFunction playComplete = nil)",
returns = "(bool)",
},
PlayMusic = {
type = "function",
description = [[Play track defined in music.yaml or map.yaml, or keep track empty for playing a random song.]],
args = "(string track = nil, LuaFunction func = nil)",
returns = "(void)",
},
PlaySound = {
type = "function",
description = [[Play a sound file]],
args = "(string file)",
returns = "(void)",
},
PlaySoundNotification = {
type = "function",
description = [[Play a sound listed in notifications.yaml]],
args = "(Player player, string notification)",
returns = "(void)",
},
PlaySpeechNotification = {
type = "function",
description = [[Play an announcer voice listed in notifications.yaml]],
args = "(Player player, string notification)",
returns = "(void)",
},
SetBackgroundMusic = {
type = "function",
description = [[Play track defined in music.yaml or map.yaml as background music. If music is already playing use Media.StopMusic() to stop it and the background music will start automatically. Keep the track empty to disable background music.]],
args = "(string track = nil)",
returns = "(void)",
},
StopMusic = {
type = "function",
description = [[Stop the current song.]],
args = "()",
returns = "(void)",
},
}
},
Player = {
type = "class",
childs = {
GetPlayer = {
type = "function",
description = [[Returns the player with the specified internal name, or nil if a match is not found.]],
args = "(string name)",
returns = "(Player)",
},
GetPlayers = {
type = "function",
description = [[Returns a table of players filtered by the specified function.]],
args = "(LuaFunction filter)",
returns = "(Player[])",
},
}
},
Reinforcements = {
type = "class",
childs = {
Reinforce = {
type = "function",
description = [[Send reinforcements consisting of multiple units. Supports ground-based, naval and air units. The first member of the entryPath array will be the units' spawnpoint, while the last one will be their destination. If actionFunc is given, it will be executed once a unit has reached its destination. actionFunc will be called as actionFunc(Actor actor). Returns a table containing the deployed units.]],
args = "(Player owner, String[] actorTypes, CPos[] entryPath, int interval = 25, LuaFunction actionFunc = nil)",
returns = "(Actor[])",
},
ReinforceWithTransport = {
type = "function",
description = [[Send reinforcements in a transport. A transport can be a ground unit (APC etc.), ships and aircraft. The first member of the entryPath array will be the spawnpoint for the transport, while the last one will be its destination. The last member of the exitPath array is be the place where the transport will be removed from the game. When the transport has reached the destination, it will unload its cargo unless a custom actionFunc has been supplied. Afterwards, the transport will follow the exitPath and leave the map, unless a custom exitFunc has been supplied. actionFunc will be called as actionFunc(Actor transport, Actor[] cargo). exitFunc will be called as exitFunc(Actor transport). Returns a table in which the first value is the transport, and the second a table containing the deployed units.]],
args = "(Player owner, string actorType, String[] cargoTypes, CPos[] entryPath, CPos[] exitPath = nil, LuaFunction actionFunc = nil, LuaFunction exitFunc = nil)",
returns = "(LuaTable)",
},
}
},
Trigger = {
type = "class",
childs = {
AfterDelay = {
type = "function",
description = [[Call a function after a specified delay. The callback function will be called as func().]],
args = "(int delay, LuaFunction func)",
returns = "(void)",
},
Clear = {
type = "function",
description = [[Removes the specified trigger from this actor. Note that the removal will only take effect at the end of a tick, so you must not add new triggers at the same time that you are calling this function.]],
args = "(Actor a, string triggerName)",
returns = "(void)",
},
ClearAll = {
type = "function",
description = [[Removes all triggers from this actor. Note that the removal will only take effect at the end of a tick, so you must not add new triggers at the same time that you are calling this function.]],
args = "(Actor a)",
returns = "(void)",
},
OnAddedToWorld = {
type = "function",
description = [[Call a function when this actor is added to the world. The callback function will be called as func(Actor self).]],
args = "(Actor a, LuaFunction func)",
returns = "(void)",
},
OnAllKilled = {
type = "function",
description = [[Call a function when all of the actors in a group are killed. The callback function will be called as func().]],
args = "(Actor[] actors, LuaFunction func)",
returns = "(void)",
},
OnAllKilledOrCaptured = {
type = "function",
description = [[Call a function when all of the actors in a group have been killed or captured. The callback function will be called as func().]],
args = "(Actor[] actors, LuaFunction func)",
returns = "(void)",
},
OnAllRemovedFromWorld = {
type = "function",
description = [[Call a function when all of the actors in a group have been removed from the world. The callback function will be called as func().]],
args = "(Actor[] actors, LuaFunction func)",
returns = "(void)",
},
OnAnyKilled = {
type = "function",
description = [[Call a function when one of the actors in a group is killed. The callback function will be called as func(Actor killed).]],
args = "(Actor[] actors, LuaFunction func)",
returns = "(void)",
},
OnCapture = {
type = "function",
description = [[Call a function when this actor is captured. The callback function will be called as func(Actor self, Actor captor, Player oldOwner, Player newOwner).]],
args = "(Actor a, LuaFunction func)",
returns = "(void)",
},
OnDamaged = {
type = "function",
description = [[Call a function when the actor is damaged. The callback function will be called as func(Actor self, Actor attacker).]],
args = "(Actor a, LuaFunction func)",
returns = "(void)",
},
OnDiscovered = {
type = "function",
description = [[Call a function when this actor is discovered by an enemy or a player with a Neutral stance. The callback function will be called as func(Actor discovered, Player discoverer). +The player actor needs the 'EnemyWatcher' trait.]],
args = "(Actor a, LuaFunction func)",
returns = "(void)",
},
OnEnteredFootprint = {
type = "function",
description = [[Call a function when a ground-based actor enters this cell footprint. Returns the trigger id for later removal using RemoveFootprintTrigger(int id). The callback function will be called as func(Actor a, int id).]],
args = "(CPos[] cells, LuaFunction func)",
returns = "(int)",
},
OnEnteredProximityTrigger = {
type = "function",
description = [[Call a function when an actor enters this range. Returns the trigger id for later removal using RemoveProximityTrigger(int id). The callback function will be called as func(Actor a, int id).]],
args = "(WPos pos, WDist range, LuaFunction func)",
returns = "(int)",
},
OnExitedFootprint = {
type = "function",
description = [[Call a function when a ground-based actor leaves this cell footprint. Returns the trigger id for later removal using RemoveFootprintTrigger(int id). The callback function will be called as func(Actor a, int id).]],
args = "(CPos[] cells, LuaFunction func)",
returns = "(int)",
},
OnExitedProximityTrigger = {
type = "function",
description = [[Call a function when an actor leaves this range. Returns the trigger id for later removal using RemoveProximityTrigger(int id). The callback function will be called as func(Actor a, int id).]],
args = "(WPos pos, WDist range, LuaFunction func)",
returns = "(int)",
},
OnIdle = {
type = "function",
description = [[Call a function each tick that the actor is idle. The callback function will be called as func(Actor self).]],
args = "(Actor a, LuaFunction func)",
returns = "(void)",
},
OnInfiltrated = {
type = "function",
description = [[Call a function when this actor is infiltrated. The callback function will be called as func(Actor self, Actor infiltrator).]],
args = "(Actor a, LuaFunction func)",
returns = "(void)",
},
OnKilled = {
type = "function",
description = [[Call a function when the actor is killed. The callback function will be called as func(Actor self, Actor killer).]],
args = "(Actor a, LuaFunction func)",
returns = "(void)",
},
OnKilledOrCaptured = {
type = "function",
description = [[Call a function when this actor is killed or captured. The callback function will be called as func().]],
args = "(Actor a, LuaFunction func)",
returns = "(void)",
},
OnObjectiveAdded = {
type = "function",
description = [[Call a function when this player is assigned a new objective. The callback function will be called as func(Player player, int objectiveID).]],
args = "(Player player, LuaFunction func)",
returns = "(void)",
},
OnObjectiveCompleted = {
type = "function",
description = [[Call a function when this player completes an objective. The callback function will be called as func(Player player, int objectiveID).]],
args = "(Player player, LuaFunction func)",
returns = "(void)",
},
OnObjectiveFailed = {
type = "function",
description = [[Call a function when this player fails an objective. The callback function will be called as func(Player player, int objectiveID).]],
args = "(Player player, LuaFunction func)",
returns = "(void)",
},
OnPassengerEntered = {
type = "function",
description = [[Call a function for each passenger when it enters a transport. The callback function will be called as func(Actor transport, Actor passenger).]],
args = "(Actor a, LuaFunction func)",
returns = "(void)",
},
OnPassengerExited = {
type = "function",
description = [[Call a function for each passenger when it exits a transport. The callback function will be called as func(Actor transport, Actor passenger).]],
args = "(Actor a, LuaFunction func)",
returns = "(void)",
},
OnPlayerDiscovered = {
type = "function",
description = [[Call a function when this player is discovered by an enemy or neutral player. The callback function will be called as func(Player discovered, Player discoverer, Actor discoveredActor).The player actor needs the 'EnemyWatcher' trait.]],
args = "(Player discovered, LuaFunction func)",
returns = "(void)",
},
OnPlayerLost = {
type = "function",
description = [[Call a function when this player fails any primary objective. The callback function will be called as func(Player player).]],
args = "(Player player, LuaFunction func)",
returns = "(void)",
},
OnPlayerWon = {
type = "function",
description = [[Call a function when this player completes all primary objectives. The callback function will be called as func(Player player).]],
args = "(Player player, LuaFunction func)",
returns = "(void)",
},
OnProduction = {
type = "function",
description = [[Call a function when this actor produces another actor. The callback function will be called as func(Actor producer, Actor produced).]],
args = "(Actor a, LuaFunction func)",
returns = "(void)",
},
OnRemovedFromWorld = {
type = "function",
description = [[Call a function when this actor is removed from the world. The callback function will be called as func(Actor self).]],
args = "(Actor a, LuaFunction func)",
returns = "(void)",
},
RemoveFootprintTrigger = {
type = "function",
description = [[Removes a previously created footprint trigger.]],
args = "(int id)",
returns = "(void)",
},
RemoveProximityTrigger = {
type = "function",
description = [[Removes a previously created proximity trigger.]],
args = "(int id)",
returns = "(void)",
},
}
},
UserInterface = {
type = "class",
childs = {
SetMissionText = {
type = "function",
description = [[Displays a text message at the top center of the screen.]],
args = "(string text, Nullable`1 color = nil)",
returns = "(void)",
},
}
},
Utils = {
type = "class",
childs = {
All = {
type = "function",
description = [[Returns true if func returns true for all elements in a collection.]],
args = "(LuaValue[] collection, LuaFunction func)",
returns = "(bool)",
},
Any = {
type = "function",
description = [[Returns true if func returns true for any element in a collection.]],
args = "(LuaValue[] collection, LuaFunction func)",
returns = "(bool)",
},
Do = {
type = "function",
description = [[Calls a function on every element in a collection.]],
args = "(LuaValue[] collection, LuaFunction func)",
returns = "(void)",
},
ExpandFootprint = {
type = "function",
description = [[Expands the given footprint one step along the coordinate axes, and (if requested) diagonals.]],
args = "(CPos[] footprint, bool allowDiagonal)",
returns = "(CPos[])",
},
FormatTime = {
type = "function",
description = [[Returns the ticks formatted to HH:MM:SS.]],
args = "(int ticks, bool leadingMinuteZero = True)",
returns = "(string)",
},
Random = {
type = "function",
description = [[Returns a random value from a collection.]],
args = "(LuaValue[] collection)",
returns = "(LuaValue)",
},
RandomInteger = {
type = "function",
description = [[Returns a random integer x in the range low <= x < high.]],
args = "(int low, int high)",
returns = "(int)",
},
Shuffle = {
type = "function",
description = [[Returns the collection in a random order.]],
args = "(LuaValue[] collection)",
returns = "(LuaValue[])",
},
Skip = {
type = "function",
description = [[Skips over the first numElements members of a table and return the rest.]],
args = "(LuaTable table, int numElements)",
returns = "(LuaTable)",
},
Take = {
type = "function",
description = [[Returns the first n values from a collection.]],
args = "(int n, LuaValue[] source)",
returns = "(LuaValue[])",
},
Where = {
type = "function",
description = [[Returns the original collection filtered with the func.]],
args = "(LuaValue[] collection, LuaFunction func)",
returns = "(LuaTable)",
},
}
},
WDist = {
type = "class",
childs = {
FromCells = {
type = "function",
description = [[Create a new WDist by cell distance.]],
args = "(int numCells)",
returns = "(WDist)",
},
New = {
type = "function",
description = [[Create a new WDist.]],
args = "(int r)",
returns = "(WDist)",
},
}
},
WPos = {
type = "class",
childs = {
New = {
type = "function",
description = [[Create a new WPos with the specified coordinates.]],
args = "(int x, int y, int z)",
returns = "(WPos)",
},
Zero = {
type = "value",
description = [[The world coordinate origin.]],
},
}
},
WVec = {
type = "class",
childs = {
New = {
type = "function",
description = [[Create a new WVec with the specified coordinates.]],
args = "(int x, int y, int z)",
returns = "(WVec)",
},
Zero = {
type = "value",
description = [[The world zero-vector.]],
},
}
},
AcceptsCondition = {
type = "function",
description = [[Check whether this actor accepts a specific external condition.]],
args = "(string condition)",
returns = "(bool)",
},
AcceptsUpgrade = {
type = "function",
description = [[Check whether this actor accepts a specific upgrade. DEPRECATED! Will be removed.]],
args = "(string upgrade)",
returns = "(bool)",
},
AddPrimaryObjective = {
type = "function",
description = [[Add a primary mission objective for this player. The function returns the ID of the newly created objective, so that it can be referred to later.]],
args = "(string description)",
returns = "(int)",
},
AddSecondaryObjective = {
type = "function",
description = [[Add a secondary mission objective for this player. The function returns the ID of the newly created objective, so that it can be referred to later.]],
args = "(string description)",
returns = "(int)",
},
AddTag = {
type = "function",
description = [[Add a tag to the actor. Returns true on success, false otherwise (for example the actor may already have the given tag).]],
args = "(string tag)",
returns = "(bool)",
},
AmmoCount = {
type = "function",
description = [[Returns the count of the actor's specified ammopool.]],
args = "(string poolName = primary)",
returns = "(int)",
},
Attack = {
type = "function",
description = [[Attack the target actor. The target actor needs to be visible.]],
args = "(Actor targetActor, bool allowMove = True, bool forceAttack = False)",
returns = "(void)",
},
AttackMove = {
type = "function",
description = [[Move to a cell, but stop and attack anything within range on the way. closeEnough defines an optional range (in cells) that will be considered close enough to complete the activity.]],
args = "(CPos cell, int closeEnough = 0)",
returns = "(void)",
},
Build = {
type = "function",
description = [[Build the specified set of actors using a TD-style (per building) production queue. The function will return true if production could be started, false otherwise. If an actionFunc is given, it will be called as actionFunc(Actor[] actors) once production of all actors has been completed. The actors array is guaranteed to only contain alive actors.]],
args = "(String[] actorTypes, LuaFunction actionFunc = nil)",
returns = "(bool)",
},
Build = {
type = "function",
description = [[Build the specified set of actors using classic (RA-style) production queues. The function will return true if production could be started, false otherwise. If an actionFunc is given, it will be called as actionFunc(Actor[] actors) once production of all actors has been completed. The actors array is guaranteed to only contain alive actors. Note: This function will fail to work when called during the first tick.]],
args = "(String[] actorTypes, LuaFunction actionFunc = nil)",
returns = "(bool)",
},
BuildingsKilled = {
type = "value",
description = [[The total number of buildings killed by this player.]],
},
BuildingsLost = {
type = "value",
description = [[The total number of buildings lost by this player.]],
},
CallFunc = {
type = "function",
description = [[Run an arbitrary Lua function.]],
args = "(LuaFunction func)",
returns = "(void)",
},
CanTarget = {
type = "function",
description = [[Checks if the targeted actor is a valid target for this actor.]],
args = "(Actor targetActor)",
returns = "(bool)",
},
Capture = {
type = "function",
description = [[Captures the target actor.]],
args = "(Actor target)",
returns = "(void)",
},
Cash = {
type = "value",
description = [[The amount of cash held by the player.]],
},
CenterPosition = {
type = "value",
description = [[The actor position in world coordinates.]],
},
Chronoshift = {
type = "function",
description = [[Chronoshift a group of actors. A duration of 0 will teleport the actors permanently.]],
args = "(LuaTable unitLocationPairs, int duration = 0, bool killCargo = False)",
returns = "(void)",
},
Color = {
type = "value",
description = [[The player's color.]],
},
DeathsCost = {
type = "value",
description = [[The combined value of all units lost by this player.]],
},
Demolish = {
type = "function",
description = [[Demolish the target actor.]],
args = "(Actor target)",
returns = "(void)",
},
Deploy = {
type = "function",
description = [[Queue a new transformation.]],
args = "()",
returns = "(void)",
},
Destroy = {
type = "function",
description = [[Remove the actor from the game, without triggering any death notification.]],
args = "()",
returns = "(void)",
},
DisguiseAs = {
type = "function",
description = [[Disguises as the target actor.]],
args = "(Actor target)",
returns = "(void)",
},
DisguiseAsType = {
type = "function",
description = [[Disguises as the target type with the specified owner.]],
args = "(string actorType, Player newOwner)",
returns = "(void)",
},
EnterTransport = {
type = "function",
description = [[Move to and enter the transport.]],
args = "(Actor transport)",
returns = "(void)",
},
Experience = {
type = "value",
},
Facing = {
type = "value",
description = [[The direction that the actor is facing.]],
},
Faction = {
type = "value",
description = [[The player's faction.]],
},
FindResources = {
type = "function",
description = [[Search for nearby resources and begin harvesting.]],
args = "()",
returns = "(void)",
},
Flash = {
type = "function",
description = [[Render a target flash on the actor. If set, 'asPlayer'
defines which player palette to use. Duration is in ticks.]],
args = "(int duration = 4, Player asPlayer = nil)",
returns = "(void)",
},
GetActors = {
type = "function",
description = [[Returns all living actors staying inside the world for this player.]],
args = "()",
returns = "(Actor[])",