forked from FAForever/fa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnit.lua
More file actions
722 lines (595 loc) · 17.1 KB
/
Unit.lua
File metadata and controls
722 lines (595 loc) · 17.1 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
--- Class Unit
-- @classmod Sim.Unit
--- Add a command cap to a unit.
-- Also adds a button to the UI, or enables it, for the unit to use the new command.
-- @param capName String Available:
-- RULEUCC_Move
-- RULEUCC_Stop
-- RULEUCC_Attack
-- RULEUCC_Guard
-- RULEUCC_Patrol
-- RULEUCC_RetaliateToggle
-- RULEUCC_Repair
-- RULEUCC_Capture
-- RULEUCC_Transport
-- RULEUCC_CallTransport
-- RULEUCC_Nuke
-- RULEUCC_Tactical
-- RULEUCC_Teleport
-- RULEUCC_Ferry
-- RULEUCC_SiloBuildTactical
-- RULEUCC_SiloBuildNuke
-- RULEUCC_Sacrifice
-- RULEUCC_Pause
-- RULEUCC_Overcharge
-- RULEUCC_Dive
-- RULEUCC_Reclaim
-- RULEUCC_SpecialAction
-- RULEUCC_Dock
-- RULEUCC_Script
-- RULEUCC_Invalid
function Unit:AddCommandCap(capName)
end
--- Add a toggle cap to a unit.
-- Also adds a button to the UI, or enables it, for the unit to use the new command.
-- @param capName String Available:
-- RULEUTC_ShieldToggle
-- RULEUTC_WeaponToggle
-- RULEUTC_JammingToggle
-- RULEUTC_IntelToggle
-- RULEUTC_ProductionToggle
-- RULEUTC_StealthToggle
-- RULEUTC_GenericToggle
-- RULEUTC_SpecialToggle
-- RULEUTC_CloakToggle
function Unit:AddToggleCap(capName)
end
--- Adds unit to the storage of the carrier.
-- @param unit Target unit to load.
function Unit:AddUnitToStorage(unit)
end
--- Changes the unit's armor type.
-- @param damageTypeName String, see lua/armordefinition.lua available types.
-- @param multiplier TODO.
function Unit:AlterArmor(damageTypeName, multiplier)
end
--- Calculate the desired world position from the supplied relative vector from the center of the unit.
-- Used for naval factories to set rally point under them.
-- @param vector Table {x, y, z}.
function Unit:CalculateWorldPositionFromRelative(vector)
end
--- See if the unit can build the target unit.
-- @param bpID Blueprint ID of the target unit, example 'ueb0101'.
-- @return true/false.
function Unit:CanBuild(bpID)
end
--- See if the unit can path to the goal.
-- @param position Table with position {x, y, z}.
-- @return result, bestGoal true/false, if falses, returns the closest position, else the original position.
function Unit:CanPathTo(position)
end
--- See if the unit can path to the goal rectangle.
-- TODO: find out if it returns position as well
-- @param rectangle Map area created by function Rect(x0, z0, x1, z1).
-- @return true/false
function Unit:CanPathToRect(rectangle)
end
--- TODO.
function Unit:ClearFocusEntity()
end
--- TODO.
function Unit:EnableManipulators([string boneName | int boneIndex], bool Enable)
end
--- TODO.
function Unit:GetArmorMult(damageTypeName)
end
--- Get the tactical attack manager object of this unit.
function Unit:GetAttacker()
end
--- Returns a blip (if any) that the given army has for the unit
-- @return blip
function Unit:GetBlip(armyIndex)
end
--- Returns the build rate of a unit.
-- What fraction of target unit it builds per second.
-- @return rate
function Unit:GetBuildRate()
end
--- Returns list of unit that the unit is transporting.
-- @return Table List of units or empty table.
function Unit:GetCargo()
end
--- Return table of commands queued up for this unit.
-- @return table
function Unit:GetCommandQueue()
end
--- Get the consumption of energy of the unit.
-- @return number
function Unit:GetConsumptionPerSecondEnergy()
end
--- Get the consumption of mass of the unit.
-- @return number
function Unit:GetConsumptionPerSecondMass()
end
--- Return the name of the layer the unit is currently in.
-- @return layer String, name of the layer, types: 'Air','Land', 'Orbital', 'Seabed', 'Sub', 'Water'.
function Unit:GetCurrentLayer()
end
--- Returns the current move location of the unit.
-- TODO: untested.
-- @return position Table with position {x, y ,z}.
function Unit:GetCurrentMoveLocation()
end
--- Get the fire state for the unit.
-- TODO find out return format.
function Unit:GetFireState()
end
--- TODO.
function Unit:GetFocusUnit(self)
end
--- Find out ratio of fuel ramaining.
-- @return ratio How much fuel left, range 0 - 1.
function Unit:GetFuelRatio()
end
--- Get the fuel use time.
-- @return number Fuel left in seconds.
function Unit:GetFuelUseTime()
end
--- Returns the unit that is being guarded.
-- @return unit Guarded unit or nil.
function Unit:GetGuardedUnit()
end
--- Find out units that are guarding this unit.
-- @return table Table of units that are guarding this uni.
function Unit:GetGuards()
end
--- Find out current health
-- @return number HP remaining.
function Unit:GetHealth()
end
--- Get the navigator object of this unit.
function Unit:GetNavigator()
end
--- Find out number of nuclear missile this unit has available.
-- @return number
function Unit:GetNukeSiloAmmoCount()
end
--- Get number of factory/engineer build orders that fit in the specified category.
-- @param category Unit's category, example: categories.ALLUNITS.
function Unit:GetNumBuildOrders(category)
end
--- Get the production of energy of the unit.
-- @return number Production of energy per second.
function Unit:GetProductionPerSecondEnergy()
end
--- Get the production of mass of the unit.
-- @return number Production of mass per second.
function Unit:GetProductionPerSecondMass()
end
--- Get the rally point for the factory.
-- @return position Table with position {x, y ,z}.
function Unit:GetRallyPoint()
end
--- Return the fraction of requested resources this unit consumed last tick.
-- Normally 1, but can be fractional if economy is struggling.
function Unit:GetResourceConsumed()
end
--- Get the current toggle state of the script bit that matches the string.
-- TODO.
function Unit:GetScriptBit()
end
--- Get the shield ratio.
-- @return float Range 0 - 1.
function Unit:GetShieldRatio()
end
--- Find out unit's specific statistics.
-- Example: 'KILLS'.
-- @param statName String, name of the stat to find out.
-- @param [defaultVal] TODO.
-- Special case for the Salem:
-- GetStat("h1_SetSalemAmph", 0 or 1)
-- Disable/Enable amphibious mode
function Unit:GetStat(statName, [defaultVal])
end
--- Find out number of tactical missile this unit has available.
-- @return number
function Unit:GetTacticalSiloAmmoCount()
end
--- Return our target unit if we have one.
-- @return entity or nil.
function Unit:GetTargetEntity()
end
---
-- Unit:GetTransportFerryBeacon()
function Unit:GetTransportFerryBeacon()
end
--- Returns the unit's blueprint ID.
-- @return bpID
function Unit:GetUnitId(self)
end
--- TODO.
-- GetVelocity() -> x,y,z
function Unit:GetVelocity()
end
--- return the index'th weapon of this unit.
-- Index must be between 1 and self:GetWeaponCount(), inclusive.
-- @return weapon
function Unit:GetWeapon(index)
end
--- Return the number of weapons on this unit.
-- Note that dummy weapons are not included in the count, so this may differ from the number of weapons defined in the unit's blueprint.
-- @return number
function Unit:GetWeaponCount()
end
--- TODO.
function Unit:GetWorkProgress()
end
--- Give nuclear missile to the unit.
-- @param num Amout of missiles to give.
function Unit:GiveNukeSiloAmmo(num)
end
--- Give tactical missile to the unit.
-- @param num Amout of missiles to give.
function Unit:GiveTacticalSiloAmmo(num)
end
--- TODO.
function Unit:HasMeleeSpaceAroundTarget(target)
end
--- TODO.
function Unit:HasValidTeleportDest()
end
--- Makes unit's bone invisible.
-- @param bone Bone name or index.
-- @param affectChildren true/false.
function Unit:HideBone(bone, affectChildren)
end
--- See if unit is under construction.
-- @return bool true/false.
function Unit:IsBeingBuilt()
end
--- Returns if this unit can be captured or not.
-- @return bool true/false.
function Unit:IsCapturable()
end
--- See if the eunit is in Idle state or not.
-- @return bool true/false.
function Unit:IsIdleState()
end
--- See if it's a mobile unit.
-- @return bool true/false.
function Unit:IsMobile()
end
--- See if the unit is moving or not.
-- @return bool true/false.
function Unit:IsMoving()
end
--- See if the unit has paused overcharge.
-- @return bool true/false.
function Unit:IsOverchargePaused()
end
--- See if the unit is paused.
-- @return bool true/false.
function Unit:IsPaused()
end
--- See if the unit is stunned.
-- @return bool true/false.
function Unit:IsStunned()
end
--- See if the unit is in given state.
-- @param stateName String, see SetUnitState function for available states.
-- @return bool true/false.
function Unit:IsUnitState(stateName)
end
--- TODO.
-- @return bool true/false.
function Unit:IsValidTarget(self)
end
--- Kill a specific manipulator held by a script object.
-- TODO: param
function Unit:KillManipulator()
end
--- TODO.
function Unit:KillManipulators([boneName|boneIndex])
end
--- TODO.
function Unit:MeleeWarpAdjacentToTarget(target)
end
--- TODO.
function Unit:PrintCommandQueue()
end
--- TODO.
function Unit:RecoilImpulse(x, y, z)
end
--- Allow building of categories for this unit.
-- @param category Unit's category, example categories.TECH1.
function Unit:RemoveBuildRestriction(category)
end
--- Remove a command cap to a unit.
-- Also removes the command button, or disables it, from the UI, see AddCommandCap for available options.
-- @param capName String.
function Unit:RemoveCommandCap(capName)
end
--- Remove amout of nuke missiles from the unit.
-- @param num Amount of nukes to remove.
function Unit:RemoveNukeSiloAmmo(num)
end
--- Remove amout of tactical missiles from the unit.
-- @param num Amount of tactical missiles to remove.
function Unit:RemoveTacticalSiloAmmo(num)
end
--- Remove a toggle cap to a unit.
-- Also removes the command button, or disables it, from the UI, see AddToggleCap for available options.
-- @param capName String.
function Unit:RemoveToggleCap(capName)
end
--- Restore buildable categories to that as defined in the blueprint
function Unit:RestoreBuildRestrictions()
end
--- Restore the command caps of the unit back to blueprint spec.
function Unit:RestoreCommandCaps()
end
--- Restore the toggle caps of the unit back to blueprint spec.
function Unit:RestoreToggleCaps()
end
--- Revert the collision shape to the blueprint spec.
function Unit:RevertCollisionShape()
end
--- Revert the elevation of the unit back to the blueperint spec.
function Unit:RevertElevation()
end
--- Restore regen rate of the unit back to blueprint spec.
function Unit:RevertRegenRate()
end
--- TODO.
-- ScaleGetBuiltEmitter(self, emitter)
function Unit:ScaleGetBuiltEmitter(self, emitter)
end
--- Set the acceleration multiplier of the unit.
-- @param float Multiplier to apply.
function Unit:SetAccMult(float)
end
--- Set auto silo build mode to on/off.
-- @param bool true/false
function Unit:SetAutoMode(bool)
end
--- TODO.
-- @param flag true/false.
function Unit:SetBlockCommandQueue(flag)
end
--- Set the break off distance multiplier of the unit.
-- @param float Multiplier to apply.
function Unit:SetBreakOffDistanceMult(float)
end
--- Set the break off trigger multiplier of the unit.
-- TODO: find out what this does.
function Unit:SetBreakOffTriggerMult(float)
end
--- Set the build rate of a unit: what fraction of target unit it builds per second.
-- @param frac Number.
function Unit:SetBuildRate(frac)
end
--- TODO.
-- @param flag true/false.
function Unit:SetBusy(flag)
end
--- Set if this unit can be captured or not.
-- @param flag true/false.
function Unit:SetCapturable(flag)
end
--- TODO.
-- @param flag true/false.
function Unit:SetConsumptionActive(flag)
end
--- Set the consumption of energy of a unit.
-- @param value Amount of energy consumed per second.
function Unit:SetConsumptionPerSecondEnergy(value)
end
--- Set the consumption of mass of the unit.
-- @param value Amount of mass consumed per second.
function Unit:SetConsumptionPerSecondMass(value)
end
--- Set the creator for this unit.
-- Used for example for UEF ACU pods or Kennel pods.
-- @param unit Parent unit.
function Unit:SetCreator(unit)
end
--- Sets a custom name for the unit, displayed by green text.
-- @param name String with the name.
function Unit:SetCustomName(name)
end
--- If set true, enemy units won't target this unit.
-- Accidental hits can still damage it but it enemy units won't lock on it.
-- @param flag true/false.
function Unit:SetDoNotTarget(flag)
end
--- Set the elevation of the unit
-- @param TODO.
function Unit:SetElevation()
end
--- Set a specific fire state for the retaliation state of the unit.
-- @param fireState Return fie - 0, Hold fire - 1 and Ground fire - 2.
function Unit:SetFireState(fireState)
end
--- TODO.
function Unit:SetFocusEntity(focus)
end
--- Set the fuel ratio.
-- How much fuel has the unit left
-- @param ratio Float, range 0 - 1.
function Unit:SetFuelRatio(ratio)
end
--- Set the fuel use time.
-- @seconds Number, how many seconds of can the unit fly.
function Unit:SetFuelUseTime(seconds)
end
--- Sets if the unit is able to move.
-- @param flag true/false.
function Unit:SetImmobile(flag)
end
---
-- SetIsValidTarget(self,bool)
function Unit:SetIsValidTarget(self, bool)
end
--- Set if this unit has an overcharge pasued.
-- @param flag true/false.
function Unit:SetOverchargePaused(flag)
end
--- Pauses building, upgrading and other tasks of the unit.
-- @param flag true/false.
function Unit:SetPaused(flag)
end
--- Enable, disable production of resources on the unit.
-- Used for mass fabricators or extractors for example.
-- @param flag true/false.
function Unit:SetProductionActive(flag)
end
--- Set the production of energy of the unit.
-- @param number Amout of energy to produce per second.
function Unit:SetProductionPerSecondEnergy(number)
end
--- Set the production of mass of the unit.
-- @param number Amout of mass to produce per second.
function Unit:SetProductionPerSecondMass(number)
end
--- Set if this unit can be reclaimed or not.
-- @param flag true/false.
function Unit:SetReclaimable(flag)
end
--- Set the regen rate of a unit.
-- @param rate Number of HPs regenerated per second.
function Unit:SetRegenRate(rate)
end
--- Set the script bit that matches the string to the desired state.
-- @param string TODO.
-- @param state true/false.
function Unit:SetScriptBit(string, state)
end
--- Set the shield ratio.
-- @param ratio Float, range 0 - 1.
function Unit:SetShieldRatio(ratio)
end
--- Set the speed multiplier of the unit.
-- @param float Multiplier to apply.
function Unit:SetSpeedMult(float)
end
--- Set the unit statistic.
-- @param name String, name of the stat to set.
-- @param value Number.
function Unit:SetStat(name, value)
end
--- Sets the icon underlay to set texture.
-- Used in campaign to highlight objetcive targets. Example 'icon_objective_primary', the dds textures must be in textures\ui\common\game\strategicicons.
-- @param icon String, name of the texture to apply, '' - empty string to reset.
function Unit:SetStrategicUnderlay(icon)
end
--- Stuns the unit for the set time.
-- @param time Number, seconds.
function Unit:SetStunned(time)
end
--- Set the turn multiplier of the unit.
-- @param float Multiplier to apply.
function Unit:SetTurnMult(float)
end
--- Set if the unit can be selected.
-- @param flag true/false.
function Unit:SetUnSelectable(flag)
end
--- Set unit's state.
-- @param stateName String, name of the state to set.
-- 'Immobile'
-- 'Moving'
-- 'Attacking'
-- 'Guarding'
-- 'Building'
-- 'Upgrading'
-- 'WaitingForTransport'
-- 'TransportLoading'
-- 'TransportUnloading'
-- 'MovingDown'
-- 'MovingUp'
-- 'Patrolling'
-- 'Busy'
-- 'Attached'
-- 'BeingReclaimed'
-- 'Repairing'
-- 'Diving'
-- 'Surfacing'
-- 'Teleporting'
-- 'Ferrying'
-- 'WaitForFerry'
-- 'AssistMoving'
-- 'PathFinding'
-- 'ProblemGettingToGoal'
-- 'NeedToTerminateTask'
-- 'Capturing'
-- 'BeingCaptured'
-- 'Reclaiming'
-- 'AssistingCommander'
-- 'Refueling'
-- 'GuardBusy'
-- 'ForceSpeedThrough'
-- 'UnSelectable'
-- 'DoNotTarget'
-- 'LandingOnPlatform'
-- 'CannotFindPlaceToLand'
-- 'BeingUpgraded'
-- 'Enhancing'
-- 'BeingBuilt'
-- 'NoReclaim'
-- 'NoCost'
-- 'BlockCommandQueue'
-- 'MakingAttackRun'
-- 'HoldingPattern'
-- 'SiloBuildingAmmo'
-- @param bool true/false.
function Unit:SetUnitState(stateName, bool)
end
--- Set the work progress on the unit.
-- Used for ACU upgrades, missile construction? TODO.
-- @param float Range 0 - 1, where 1 is completed.
function Unit:SetWorkProgress(float)
end
--- Makes unit's bone visible.
-- @param bone Bone name or index.
-- @param affectChildren true/false.
function Unit:ShowBone(bone, affectChildren)
end
--- Stops production of a missile.
function Unit:StopSiloBuild()
end
--- Test if a unit has this specified set to true in the blueprint spec.
-- @param capName String.
function Unit:TestCommandCaps(capName)
end
--- Test if a unit has this specified set to true in the blueprint spec.
-- @param capName String.
function Unit:TestToggleCaps(capName)
end
--- Toggle the fire state for the retaliation state of the unit.
function Unit:ToggleFireState()
end
--- Toggle the script bit that matches the string.
-- TODO.
function Unit:ToggleScriptBit()
end
--- Detach all units from a transport.
-- @param destroySomeUnits TODO.
function Unit:TransportDetachAllUnits(destroySomeUnits)
end
--- Find out if carrier is full or not.
-- @return true/false.
function Unit:TransportHasAvailableStorage()
end
--- Find out if the target unit can fit into the carrier.
-- @param target Unit to test.
-- @return true/false.
function Unit:TransportHasSpaceFor(target)
end
---
-- derived from Entity
function Unit:base()
end
---
--
function Unit:moho.unit_methods()
end