-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathBaseConflict.EntityComponents.Client.Visuals.pas
7251 lines (6424 loc) · 239 KB
/
BaseConflict.EntityComponents.Client.Visuals.pas
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
unit BaseConflict.EntityComponents.Client.Visuals;
interface
uses
System.Types,
Generics.Collections,
System.SysUtils,
System.RegularExpressions,
System.Rtti,
Classes,
Vcl.Dialogs,
Math,
Engine.Mesh,
{$IFDEF MAPEDITOR}
Engine.Mesh.Editor,
{$ENDIF}
Engine.Core,
Engine.Core.Camera,
Engine.Core.Types,
Engine.Core.Lights,
Engine.Animation,
Engine.GFXApi,
Engine.GFXApi.Types,
Engine.Vertex,
Engine.GUI,
Engine.Script,
Engine.Helferlein,
Engine.Helferlein.DataStructures,
Engine.Helferlein.Windows,
Engine.Terrain,
Engine.Math,
Engine.Log,
Engine.Math.Collision2D,
Engine.Math.Collision3D,
Engine.ParticleEffects,
Engine.PostEffects,
BaseConflict.Map,
BaseConflict.Game,
BaseConflict.Types.Shared,
BaseConflict.Types.Target,
BaseConflict.Constants,
BaseConflict.Constants.Cards,
BaseConflict.Constants.Client,
BaseConflict.Globals,
BaseConflict.Globals.Client,
BaseConflict.Entity,
BaseConflict.EntityComponents.Shared,
BaseConflict.EntityComponents.Client,
BaseConflict.Settings.Client;
type
{$RTTI INHERIT}
/// <summary> Adds shaking to the camera.</summary>
TCameraShakerComponent = class(TEntityComponent)
protected const
DEFAULT_DURATION = 500;
DEFAULT_STRENGTH = 0.25;
DEFAULT_WAVES = 5;
protected type
EnumShakerType = (stRadial, stVector, stRotation);
protected
// Attention the GFXD owns the shakers so they may be already freed
FCreatedShaker : TList<TCameraShaker>;
FShakerType : EnumShakerType;
FDuration, FDelay, FWaves : integer;
FStrength : single;
FVector : RVector3;
FShakeOnCreate, FShakeOnFire, FShakeOnFireWarhead, FShakeOnFree, FShakeOnDie, FShakeOnLose, FInvert, FGlobal, FNoFade : boolean;
FStopOnDie, FStopOnFree : boolean;
FShakerPositions : TList<ISharedData<RVector3>>;
procedure Shake;
procedure Stop;
procedure BeforeComponentFree; override;
published
[XEvent(eiAfterCreate, epLast, etTrigger)]
function OnAfterDeserialization() : boolean;
[XEvent(eiFire, epLast, etTrigger)]
function OnFire(Targets : RParam) : boolean;
[XEvent(eiFireWarhead, epLast, etTrigger)]
function OnFireWarhead(Targets : RParam) : boolean;
[XEvent(eiDie, epLast, etTrigger)]
function OnDie(KillerID, KillerCommanderID : RParam) : boolean;
[XEvent(eiLose, epLast, etTrigger, esGlobal)]
function OnLose(TeamID : RParam) : boolean;
public
constructor CreateGrouped(Entity : TEntity; Groups : TArray<byte>); override;
function VectorShaker(VectorX, VectorY, VectorZ : single) : TCameraShakerComponent;
function RotationShaker(Yaw, Pitch, Roll : single) : TCameraShakerComponent;
function ActivateOnCreate() : TCameraShakerComponent;
function ActivateNow() : TCameraShakerComponent;
function ActivateOnFireWarhead() : TCameraShakerComponent;
function ActivateOnFire() : TCameraShakerComponent;
function ActivateOnDie() : TCameraShakerComponent;
function ActivateOnLose() : TCameraShakerComponent;
function ActivateOnFree() : TCameraShakerComponent;
function StopOnDie : TCameraShakerComponent;
function StopOnFree : TCameraShakerComponent;
function Invert : TCameraShakerComponent;
function Strength(Radius : single) : TCameraShakerComponent;
function Duration(DurationMs : integer) : TCameraShakerComponent;
function Delay(DelayTime : integer) : TCameraShakerComponent;
function Waves(Waves : integer) : TCameraShakerComponent;
function NoFade : TCameraShakerComponent;
function Global : TCameraShakerComponent;
function PresetVectorLight : TCameraShakerComponent;
function PresetVectorMedium : TCameraShakerComponent;
function PresetVectorStrong : TCameraShakerComponent;
function PresetRotationLight : TCameraShakerComponent;
function PresetRotationMedium : TCameraShakerComponent;
function PresetRotationStrong : TCameraShakerComponent;
destructor Destroy; override;
end;
{$RTTI INHERIT}
/// <summary> Orients the mesh into movementdirection using his last position and his new position. </summary>
TOrienterMovementComponent = class(TEntityComponent)
protected
FFront : RVector2;
published
[XEvent(eiMove, epLast, etTrigger)]
/// <summary> Save move target. </summary>
function OnMove(const Target : RParam) : boolean;
[XEvent(eiDisplayFront, epHigh, etRead)]
/// <summary> Returns the direction to the move target, if no target specified, pass previous </summary>
function OnDisplayFront(const PreviousFront : RParam) : RParam;
end;
{$RTTI INHERIT}
/// <summary> Orients the mesh into target direction. </summary>
TOrienterTargetComponent = class(TEntityComponent)
protected
FTargetGroup, FFrontGroup : SetComponentGroup;
FTarget : RTarget;
FLastFront : RVector3;
FIsMoving, FWithY, FFromPivot, FKeepLastFront : boolean;
published
[XEvent(eiDie, epLast, etTrigger)]
/// <summary> Kill this component. </summary>
function OnDie(KillerID, KillerCommanderID : RParam) : boolean;
[XEvent(eiWelaSetMainTarget, epLast, etTrigger)]
/// <summary> Reorient the unit to match the target. </summary>
function OnTarget(const Target : RParam) : boolean;
[XEvent(eiDisplayFront, epHigh, etRead)]
/// <summary> Returns the direction to the target, if no target specified, pass previous </summary>
function OnDisplayFront(const Previous : RParam) : RParam;
public
function FrontGroup(const Group : TArray<byte>) : TOrienterTargetComponent;
function TargetGroup(const Group : TArray<byte>) : TOrienterTargetComponent;
function FrontWithY() : TOrienterTargetComponent;
function FrontFromPivot() : TOrienterTargetComponent;
function KeepLastFront() : TOrienterTargetComponent;
end;
{$RTTI INHERIT}
/// <summary> Set the front of an entity. </summary>
TOrienterFrontComponent = class(TEntityComponent)
protected
FFront : RVector3;
published
[XEvent(eiDisplayFront, epFirst, etRead)]
function OnDisplayFront(const Previous : RParam) : RParam;
public
function Front(FrontX, FrontY, FrontZ : single) : TOrienterFrontComponent;
end;
{$RTTI INHERIT}
/// <summary> Smooth front changes on mesh.</summary>
TOrienterSmoothRotateComponent = class(TEntityComponent)
protected
FRotateSpeed : single;
FCurrentFront : RVector3;
FFrameKey : cardinal;
published
[XEvent(eiDisplayFront, epLower, etRead)]
function OnDisplayFront(const PreviousFront : RParam) : RParam;
public
function SetAngleSpeed(Value : single) : TOrienterSmoothRotateComponent;
end;
{$RTTI INHERIT}
/// <summary> Automatically rotates the entity. </summary>
TOrienterAutoRotationComponent = class(TEntityComponent)
protected
FRotSpeed, FRandomOffset : RVector3;
FLimit : single;
FStartTime : double;
function LastTime : single;
published
[XEvent(eiDisplayFront, epMiddle, etRead)]
/// <summary> Rotate the unit. </summary>
function OnFront(const Previous : RParam) : RParam;
[XEvent(eiDisplayUp, epMiddle, etRead)]
/// <summary> Rotate the unit. </summary>
function OnUp(const Previous : RParam) : RParam;
public
constructor CreateGrouped(Entity : TEntity; Group : TArray<byte>); override;
function SetSpeed(RotationSpeed : RVector3) : TOrienterAutoRotationComponent;
function SpeedJitter(X, Y, Z : single) : TOrienterAutoRotationComponent;
function RandomOffset(X, Y, Z : single) : TOrienterAutoRotationComponent;
function StopAt(Limit : single) : TOrienterAutoRotationComponent;
end;
{$RTTI INHERIT}
/// <summary> Inverts the front of an entity. </summary>
TOrienterFrontInverterComponent = class(TEntityComponent)
published
[XEvent(eiDisplayFront, epLower, etRead)]
/// <summary> Inverts front. </summary>
function OnDisplayFront(const PreviousFront : RParam) : RParam;
end;
{$RTTI INHERIT}
/// <summary> Adjusts the size of this entity. </summary>
TVisualModificatorSizeComponent = class(TEntityComponent)
protected
FCurrentSize : single;
FSizes : TArray<RVector3>;
FTimeKeys : TArray<RTuple<integer, RVector3>>;
FDuration : TTimer;
published
[XEvent(eiSize, epLow, etRead)]
/// <summary> Puts this size modificator in the chain. </summary>
function OnSize(Previous : RParam) : RParam;
public
function SetTargetSize(Size : single) : TVisualModificatorSizeComponent;
function Keypoints(const Sizes : TArray<single>) : TVisualModificatorSizeComponent;
function KeypointsX(const Sizes : TArray<single>) : TVisualModificatorSizeComponent;
function KeypointsY(const Sizes : TArray<single>) : TVisualModificatorSizeComponent;
function KeypointsZ(const Sizes : TArray<single>) : TVisualModificatorSizeComponent;
function TimeKeys(const Times : TArray<integer>) : TVisualModificatorSizeComponent;
function Duration(Duration : integer) : TVisualModificatorSizeComponent;
destructor Destroy; override;
end;
{$RTTI INHERIT}
RMatrixAdjustments = record
BindInvertX, BindInvertY, BindInvertZ, BindSwapXY, BindSwapXZ, BindSwapYZ : boolean;
Offset, Rotation : RVector3;
function Apply(const a : RMatrix) : RMatrix;
end;
/// <summary> Masterclass for unitdisplays like meshes. </summary>
TVisualizerComponent = class(TEntityComponent)
private const
GAMEPLAY_SCALE_EVENTS = [eiWelaRange, eiWelaAreaOfEffect];
protected
FBoundZone : string;
FBindGroup : SetComponentGroup;
FBindMatrix : RMatrix;
FSize : RVector3;
FFixedTeamID : integer;
FOveriddenResourceCap : single;
FModelsize, FMinScaleEvent, FMaxScaleEvent, FFixedHeight, FResourceScaleFactorMin, FResourceScaleFactorMax : single;
FScaleWithResource : EnumResource;
FScaleEvent : EnumEventIdentifier;
FBindMatrixAdjustments : RMatrixAdjustments;
FFixedOrientation, FScaleWithEvent, FIgnoreSize, FIgnoreModelSize, FHasFixedHeight,
FBindDebug, FIsStatic, FFirstStaticApplyDone, FIsPiece, FVisibleWithWelaReady, FVisibleWithOption : boolean;
FVisibilityOption : EnumClientOption;
FWelaReadyGroup : SetComponentGroup;
FVisibleWithResource : EnumResource;
FVisibleWithUnitPropertyMustHave, FVisibleWithUnitPropertyMustNotHave : SetUnitProperty;
FOffset, FRotationOffset, FFixedFront, FFixedUp, FDefaultFront, FDefaultUp, FFixedOffset : RVector3;
/// <summary> Apply position, front, size etc data to visual representation</summary>
procedure Apply; virtual;
procedure Update;
function FinalSize : RVector3; virtual;
/// <summary> Called every frame, can override to manage visual representation (e.g. render).</summary>
procedure Idle; virtual;
procedure SetModelSize(ModelSize : single); virtual;
function IsVisible : boolean; virtual;
function IsBoundToBone : boolean;
function FinalModelOffset : RVector3;
published
[XEvent(eiModelSize, epLast, etWrite)]
/// <summary> Sets the modelsize. </summary>
function OnModelSize(Size : RParam) : boolean;
[XEvent(eiIdle, epLower, etTrigger, esGlobal)]
/// <summary> Apply changes and calling Idle every frame.</summary>
function OnIdle() : boolean;
public
function SetModelOffset(OffsetX, OffsetY, OffsetZ : single) : TVisualizerComponent; overload;
function SetModelOffset(Offset : RVector3) : TVisualizerComponent; overload;
function SetModelRotationOffset(Offset : RVector3) : TVisualizerComponent;
function BindToSubPosition(const ZoneName : string) : TVisualizerComponent;
function BindToSubPositionGroup(const ZoneName : string; TargetGroup : TArray<byte>) : TVisualizerComponent;
function InvertXBindMatrix : TVisualizerComponent;
function InvertYBindMatrix : TVisualizerComponent;
function InvertZBindMatrix : TVisualizerComponent;
function SwapXYBindMatrix : TVisualizerComponent;
function SwapXZBindMatrix : TVisualizerComponent;
function SwapYZBindMatrix : TVisualizerComponent;
function DebugBindMatrix : TVisualizerComponent;
function ScaleWith(Event : EnumEventIdentifier) : TVisualizerComponent;
function ScaleWithResource(Resource : EnumResource; ScaleFactorMin, ScaleFactorMax : single) : TVisualizerComponent;
function OverrideResourceCap(NewCap : single) : TVisualizerComponent;
function MaxScale(Maximum : single) : TVisualizerComponent;
function ScaleRange(Minimum, Maximum : single) : TVisualizerComponent;
function IgnoreSize : TVisualizerComponent;
function IgnoreModelSize : TVisualizerComponent;
/// <summary> Set a model offset of y = EPSILON </summary>
function IsDecal : TVisualizerComponent;
/// <summary> If set, the visualized thing is a sub part of the entity with it's own position and orientation. </summary>
function IsPiece : TVisualizerComponent;
/// <summary> Ignores the y component of the parent. </summary>
function FixedHeight(Height : single) : TVisualizerComponent;
function FixedHeightGround : TVisualizerComponent;
function FixedOffsetGround : TVisualizerComponent;
function FixedOrientationDefault : TVisualizerComponent;
function FixedOrientation(FrontX, FrontY, FrontZ : single) : TVisualizerComponent;
function FixedOrientationUp(UpX, UpY, UpZ : single) : TVisualizerComponent;
function FixedOrientationAngle(FrontX, FrontY, FrontZ : single) : TVisualizerComponent;
function DefaultOrientation(FrontX, FrontY, FrontZ : single) : TVisualizerComponent;
function DefaultOrientationUp(UpX, UpY, UpZ : single) : TVisualizerComponent;
function ShowAsTeam(FixTeamID : integer) : TVisualizerComponent;
function VisibleWithOption(Option : EnumClientOption) : TVisualizerComponent;
function VisibleWithWelaReady : TVisualizerComponent;
function VisibleWithWelaReadyGrouped(Group : TArray<byte>) : TVisualizerComponent;
function VisibleWithResource(ResourceID : integer) : TVisualizerComponent;
function VisibleWithUnitPropertyMustHave(Properties : TArray<byte>) : TVisualizerComponent;
function VisibleWithUnitPropertyMustNotHave(Properties : TArray<byte>) : TVisualizerComponent;
constructor Create(Owner : TEntity); override;
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>); override;
end;
{$RTTI INHERIT}
TParticleEffectComponent = class(TVisualizerComponent)
protected
FParticleEffect : TParticleEffect;
FDefer, FDeactivateOnTime : TTimer;
FLastTargets : ATarget;
FLoadedTeamID : integer;
FSizeNormalization : single;
FParticlePath, FEffectFilename : string;
FPlaceAtSavedTarget, FActivateWithWela, FClonesToTarget : boolean;
FStartEmissionOnCreate, FStartEmissionOnFire, FStartEmissionOnDie, FStartEmissionOnFree,
FStartEmissionOnFireWarhead, FStartEmissionOnPreFire, FStartEmissionOnLose : boolean;
FStopEmissionOnMoveTo, FStopEmissionOnDie, FStopEmissionOnFire : boolean;
FAtFireTarget, FChangesWithTeam, FEmitFromAllBones : boolean;
function FinalSize : RVector3; override;
procedure Apply; override;
procedure Idle; override;
procedure BeforeComponentFree; override;
procedure Start;
procedure StartNow;
procedure Stop;
function IsVisible : boolean; override;
procedure CheckAndReloadParticleEffect;
function Clone(Target : TEntity) : TParticleEffectComponent;
published
[XEvent(eiWelaActive, epLast, etWrite)]
function OnWelaActive(Value : RParam) : boolean;
[XEvent(eiAfterCreate, epLast, etTrigger)]
/// <summary> Starts Emission. </summary>
function OnAfterDeserialization() : boolean;
[XEvent(eiFire, epLast, etTrigger)]
/// <summary> Starts Emission. </summary>
function OnFire(Targets : RParam) : boolean;
[XEvent(eiPreFire, epLast, etTrigger)]
/// <summary> Starts Emission. </summary>
function OnPreFire(Targets : RParam) : boolean;
[XEvent(eiFireWarhead, epLast, etTrigger)]
/// <summary> Starts Emission. </summary>
function OnFireWarhead(Targets : RParam) : boolean;
[XEvent(eiMoveTo, epLast, etTrigger)]
function OnMoveTo(Target, Range : RParam) : boolean;
[XEvent(eiDie, epLower, etTrigger)]
/// <summary> Starts Emission. </summary>
function OnDie(KillerID, KillerCommanderID : RParam) : boolean;
[XEvent(eiExiled, epLast, etWrite)]
/// <summary> Unit stops pfx on exile. </summary>
function OnExiled(Exiled : RParam) : boolean;
[XEvent(eiLose, epLast, etTrigger, esGlobal)]
function OnLose(TeamID : RParam) : boolean;
public
constructor Create(Owner : TEntity; ParticlePath : string; SizeNormalization : single); reintroduce;
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>; const ParticlePath : string; SizeNormalization : single); reintroduce;
constructor CreateGroupedAndActivated(Owner : TEntity; Group : TArray<byte>; const ParticlePath : string; SizeNormalization : single);
function ActivateOnCreate() : TParticleEffectComponent;
function ActivateNow() : TParticleEffectComponent;
function ActivateOnFireWarhead() : TParticleEffectComponent;
function ActivateOnPreFire() : TParticleEffectComponent;
function ActivateOnFire() : TParticleEffectComponent;
function ActivateOnFireDelayed(DeferTime : integer) : TParticleEffectComponent;
function ActivateAtFireTarget() : TParticleEffectComponent;
function ActivateOnLose() : TParticleEffectComponent;
function ActivateOnWelaActivate() : TParticleEffectComponent;
function ActivateOnDie() : TParticleEffectComponent;
function ActivateOnFree() : TParticleEffectComponent;
function DeactivateOnMoveTo() : TParticleEffectComponent;
function DeactivateOnTime(StopTime : integer) : TParticleEffectComponent;
function DeactivateOnDie() : TParticleEffectComponent;
function DeactivateOnFire() : TParticleEffectComponent;
function Delay(DeferTime : integer) : TParticleEffectComponent;
function PlaceAtSavedTarget() : TParticleEffectComponent;
function IgnoreModelSize : TParticleEffectComponent; reintroduce;
function EmitFromAllBones : TParticleEffectComponent;
function ClonesToTarget : TParticleEffectComponent;
function ScaleWith(Event : EnumEventIdentifier) : TParticleEffectComponent; reintroduce;
function FixedOrientationDefault : TParticleEffectComponent; reintroduce;
function FixedHeightGround : TParticleEffectComponent; reintroduce;
function ScaleRange(Minimum, Maximum : single) : TParticleEffectComponent; reintroduce;
destructor Destroy; override;
end;
{$RTTI INHERIT}
/// <summary> Renders a hologram of the produced unit of this entity. </summary>
TProductionPreviewComponent = class(TEntityComponent)
protected
FPreviews : TAdvancedList<TEntity>;
FIsSpawner : boolean;
FUnitCount : integer;
procedure ComputePreviews;
procedure PositionPreviews;
procedure ClearPreviews;
procedure EnumerateComponents(Callback : ProcEnumerateEntityComponentCallback); override;
published
[XEvent(eiAfterCreate, epLast, etTrigger)]
/// <summary> Read Data and build previews. </summary>
function OnAfterCreate() : boolean;
[XEvent(eiModelSize, epLast, etWrite)]
/// <summary> Apply the size to the preview. </summary>
function OnModelSize(ModelSize : RParam) : boolean;
[XEvent(eiDie, epLast, etTrigger)]
/// <summary> Kills the preview. </summary>
function OnDie(KillerID, KillerCommanderID : RParam) : boolean;
[XEvent(eiColorAdjustment, epLast, etTrigger)]
/// <summary> Recolorize the preview. </summary>
function OnColorAdjustment(ColorAdjustment : RParam; absH, absS, absV : RParam) : boolean;
[XEvent(eiDrawOutline, epLast, etTrigger)]
/// <summary> Draw the preview outlined. </summary>
function OnDrawOutline(Color, OnlyOutline : RParam) : boolean;
[XEvent(eiIdle, epLower, etTrigger, esGlobal)]
/// <summary> Write visibilty to preview. </summary>
function OnIdle() : boolean;
[XEvent(eiSubPositionByString, epFirst, etRead)]
/// <summary> Relay query to the preview. </summary>
function OnSubPositionByString(Name, Previous : RParam) : RParam;
[XEvent(eiGetUnitsAtCursor, epLow, etRead, esGlobal)]
/// <summary> Returns the owner if returned value is preview. </summary>
function OnGetUnitsAtCursor(ClickRay : RParam; Previous : RParam) : RParam;
[XEvent(eiBoundings, epFirst, etRead)]
/// <summary> Redirect event. </summary>
function OnBoundings() : RParam;
public
constructor Create(Owner : TEntity); override;
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>); override;
function IsSpawner : TProductionPreviewComponent;
destructor Destroy; override;
end;
{$RTTI INHERIT}
TMeshComponent = class;
TMeshEffect = class abstract
protected
FOwningEntity : TEntity;
FOwningComponent : TMeshComponent;
FMesh : TMesh;
FCustomShader, FOriginalGlowTexture : string;
FHasShaderSetup, FManaged, FColorIdentityOverride : boolean;
FBlendMode : EnumBlendMode;
FNeedOwnPass : SetRenderStage;
FOwnPasses : integer;
FGlowOverride, FUseGlowOverride, FGlowTextureOverride, FOwnPassBlocks, FIsMounted : boolean;
FColorIdentity : EnumEntityColor;
// smallest value gets rendered first
FOrderValue : integer;
function Clone(const Effect : TMeshEffect) : TMeshEffect; virtual;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); virtual;
function Expired : boolean; virtual;
procedure InitializeOnMesh(const Mesh : TMesh); virtual;
procedure FinalizeOnMesh(); virtual;
procedure InitShader(const ShaderName : string);
procedure InitOnEntity(const Entity : TEntity); virtual;
constructor CreateEmpty;
public
/// <summary> If any effect is important it will be applied alone. If multiple the first is taken. </summary>
property Managed : boolean read FManaged write FManaged;
property OrderValue : integer read FOrderValue;
[ScriptExcludeMember]
property NeedOwnPass : SetRenderStage read FNeedOwnPass;
property IsMounted : boolean read FIsMounted;
property ColorIdentity : EnumEntityColor read FColorIdentity;
/// <summary> Only for own passes. </summary>
function Additive : TMeshEffect;
constructor Create();
function OverrideGlowTexture : TMeshEffect;
function OverrideColorIdentity(ColorIdentity : EnumEntityColor) : TMeshEffect;
procedure Reset; virtual;
procedure AssignToEntity(const Entity : TEntity);
end;
TMeshEffectGeneric = class abstract(TMeshEffect)
protected
FLastDisplayedTeamID : integer;
FTextureSlot : EnumTextureSlot;
FTextureName : string;
FEffectTexture : TTexture;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(const ShaderName, TextureFilename : string);
function SetTexture(const TextureFilename : string) : TMeshEffectGeneric;
destructor Destroy; override;
end;
TMeshEffectWithTimekeys = class abstract(TMeshEffectGeneric)
protected
FTimer : TTimer;
FTimedKeyPoints : TArray<TArray<RTuple<integer, single>>>;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
function CurrentValue(Index : integer = 0) : single;
function HasTimeLine(Index : integer) : boolean;
function Expired : boolean; override;
public
constructor Create(Duration : integer);
procedure Reset; override;
function AddNextTimeLine : TMeshEffectWithTimekeys;
function AddKey(TimeKey : integer; Value : single) : TMeshEffectWithTimekeys;
function AddPermaKey(Value : single) : TMeshEffectWithTimekeys;
destructor Destroy; override;
end;
TMeshEffectColorOverlay = class(TMeshEffect)
strict private
const
ORDER_VALUE = 2;
protected
FColor : RColor;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(const Color : cardinal);
end;
TMeshEffectTint = class(TMeshEffectWithTimekeys)
strict private
const
ORDER_VALUE = 5000;
protected
FColor : RColor;
FAdditive : boolean;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(Duration, Color : cardinal);
function Additive : TMeshEffectTint;
end;
/// <summary> Adds a icy surface to the mesh. </summary>
TMeshEffectIce = class(TMeshEffectWithTimekeys)
strict private
const
ORDER_VALUE = 5;
protected
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(Duration : integer);
end;
/// <summary> Adds a stone surface to the mesh. </summary>
TMeshEffectStone = class(TMeshEffectWithTimekeys)
strict private
const
ORDER_VALUE = 6;
protected
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(Duration : integer);
end;
/// <summary> Adds a ghost which flies away to the mesh. </summary>
TMeshEffectSoulExtract = class(TMeshEffectWithTimekeys)
protected
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(Duration : integer);
end;
/// <summary> Adds a ghostly corona to the mesh. </summary>
TMeshEffectSoulGain = class(TMeshEffectWithTimekeys)
strict private
const
ORDER_VALUE = 9999;
protected
FRadius : single;
FColor : RColor;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(Duration : integer);
function Radius(Radius : single) : TMeshEffectSoulGain;
function Color(Color : cardinal) : TMeshEffectSoulGain;
end;
/// <summary> Adds a ghostly corona to the mesh. </summary>
TMeshEffectGhost = class(TMeshEffectGeneric)
strict private
const
ORDER_VALUE = 3;
protected
FFactor, FOffset : single;
FAdditive : boolean;
FColor : RColor;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create();
function Factor(Factor : single) : TMeshEffectGhost;
function Offset(Offset : single) : TMeshEffectGhost;
function Additive : TMeshEffectGhost;
function Color(Color : cardinal) : TMeshEffectGhost;
end;
/// <summary> Adds full glow to the mesh and changes the albedo to the glow color dependent on the entitys color identity. </summary>
TMeshEffectGlow = class(TMeshEffectWithTimekeys)
strict private
const
ORDER_VALUE = 9998;
protected
FFixedColorIdentity : boolean;
FFixedColor : EnumEntityColor;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(Duration : integer);
function FixedColorIdentity(ColorIdentity : EnumEntityColor) : TMeshEffectGlow;
end;
/// <summary> Uses two timelines: First Glow, Second Visibility. Uses mask texture. </summary>
TMeshEffectHideAndGlow = class(TMeshEffectWithTimekeys)
strict private
const
ORDER_VALUE = 9997;
protected
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(Duration : integer; const TextureFilename : string);
end;
TMeshEffectSpherify = class(TMeshEffectWithTimekeys)
strict private
const
ORDER_VALUE = 9996;
protected
FUseFixedCenter : boolean;
FFixedCenter : RVector3;
FPowFactor : single;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(Duration : integer);
function PowFactor(PowFactor : single) : TMeshEffectSpherify;
function SetFixedCenter(X, Y, Z : single) : TMeshEffectSpherify;
end;
TMeshEffectMelt = class(TMeshEffectWithTimekeys)
strict private
const
ORDER_VALUE = 9995;
protected
FMeltStep, FMeltHeightOverride : single;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(Duration : integer);
function Step(Step : single) : TMeshEffectMelt;
function Height(Height : single) : TMeshEffectMelt;
end;
TMeshEffectWarp = class(TMeshEffectWithTimekeys)
strict private
const
ORDER_VALUE = 9994;
protected
FSmoothStep : single;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(const TextureFilename : string; Duration : integer);
function Smooth(Step : single) : TMeshEffectWarp;
end;
TMeshEffectMetal = class(TMeshEffectGeneric)
strict private
const
ORDER_VALUE = 10000;
protected
FColorOverride : EnumEntityColor;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure InitOnEntity(const Entity : TEntity); override;
public
constructor Create();
function ShowAsColor(ColorOverride : EnumEntityColor) : TMeshEffectMetal;
end;
TMeshEffectMatcap = class(TMeshEffectGeneric)
strict private
const
ORDER_VALUE = 9993;
protected
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure InitOnEntity(const Entity : TEntity); override;
public
constructor Create();
end;
TMeshEffectWobble = class(TMeshEffectGeneric)
strict private
const
ORDER_VALUE = 9992;
protected
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(const VoidMask : string);
end;
TMeshEffectInvisible = class(TMeshEffectGeneric)
strict private
const
ORDER_VALUE = 10;
protected
FSmoothStep, FSpeed, FSpan : single;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create();
function Smooth(Step : single) : TMeshEffectInvisible;
function Speed(Speed : single) : TMeshEffectInvisible;
function Span(Span : single) : TMeshEffectInvisible;
end;
TMeshEffectVoid = class(TMeshEffectGeneric)
strict private
const
ORDER_VALUE = 4999;
protected
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create();
end;
TMeshEffectSlidingTexture = class(TMeshEffectGeneric)
strict private
const
ORDER_VALUE = 4998;
protected
FSpeed, FTiling : RVector2;
FFurThickness : single;
FGlowOverride, FFurOverride : boolean;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
procedure InitializeOnMesh(const Mesh : TMesh); override;
procedure FinalizeOnMesh(); override;
public
constructor Create(const TextureFilename : string);
function Speed(const SpeedX, SpeedY : single) : TMeshEffectSlidingTexture;
function Tiling(const TilingX, TilingY : single) : TMeshEffectSlidingTexture;
end;
TMeshEffectTeamColor = class(TMeshEffectGeneric)
strict private
const
ORDER_VALUE = 9991;
protected
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
public
constructor Create(const MaskFilename : string);
end;
TMeshEffectSpawn = class(TMeshEffect)
strict private
const
ORDER_VALUE = 1;
BLUE_PASSES = 20;
EFFECT_TIMES : array [EnumEntityColor] of integer = (
1000, // ecColorless
2500, // ecBlack
2500, // ecGreen
2500, // ecRed
1500, // ecBlue
2500 // ecWhite
);
protected
FSpawneffectTexture : TTexture;
FCullmode : EnumCullmode;
FSpawnTimer : TTimer;
FFrame, FOffset : integer;
FZDiff, FHeightFactor : single;
FLegendary : boolean;
FOverrideColor : RColor;
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
function Expired : boolean; override;
procedure InitializeOnMesh(const Mesh : TMesh); override;
procedure FinalizeOnMesh(); override;
procedure SetUpShader(CurrentShader : TShader; Stage : EnumRenderStage; PassIndex : integer); override;
procedure InitOnEntity(const Entity : TEntity); override;
public
constructor Create();
function OverrideEffectTime(Interval : integer) : TMeshEffectSpawn;
function OffsetEffectTime(Offset : integer) : TMeshEffectSpawn;
function OverrideColor(Color : cardinal) : TMeshEffectSpawn;
function HeightFactor(Factor : single) : TMeshEffectSpawn;
function Legendary : TMeshEffectSpawn;
destructor Destroy; override;
end;
TMeshEffectSpawnerSpawn = class(TMeshEffectSpawn)
strict private
const
ORDER_VALUE = 5;
protected
function Clone(const Effect : TMeshEffect) : TMeshEffect; override;
public
constructor Create();
end;
EnumMeshTexture = (mtDiffuse, mtNormal, mtMaterial, mtGlow);
TConditionalMeshTexture = class abstract
TextureType : EnumMeshTexture;
TextureFilename : string;
function Check(Component : TEntityComponent) : boolean; virtual; abstract;
end;
TConditionalMeshTextureTeam = class(TConditionalMeshTexture)
TargetTeamID : integer;
function Check(Component : TEntityComponent) : boolean; override;
end;
TConditionalMeshTextureUnitProperty = class(TConditionalMeshTexture)
MustHaveAny : SetUnitProperty;
function Check(Component : TEntityComponent) : boolean; override;
end;
TConditionalMeshTextureResource = class(TConditionalMeshTexture)
ResourceType : EnumResource;
Comparator : EnumComparator;
ReferenceValue : single;
ComponentGroup : SetComponentGroup;
function Check(Component : TEntityComponent) : boolean; override;
end;
/// <summary> Displays a mesh. </summary>
TMeshComponent = class(TVisualizerComponent)
protected
const
SIZE_FACTOR_3DSMAX = 2 / 125;
var
FMesh : TMesh;
FDeathColorIdentityOverrideActive : boolean;
FDeathColorIdentityOverride : EnumEntityColor;
FDecaying, FIgnoreScalingForAnimations, FIsEffectMesh, FNoWalkOffset, FConditionalTexturesDirty : boolean;
FAnimationSpeed : TDictionary<string, single>;
FSizeNormalization : single;
FModelFileName : string;
FOutlineColor : RColor;
FLastBoundings : RSphere;
FHasAttackLoop, FHighlightedThisFrame, FOnlyOutline, FColorHasBeenAdjusted, FUsesGlobalShadingReduction, FShadingReductionFromTerrain, FCastsNoShadows : boolean;
FEffectStack : TAdvancedObjectList<TMeshEffect>;
FZoneToBoneBinding, FFollowingDefaultAnimation : TDictionary<string, string>;
FBoneAdjustments : TDictionary<string, RMatrixAdjustments>;
// conditional textures
FOriginalTextures : array [EnumMeshTexture] of string;
FConditionalTextures : TObjectList<TConditionalMeshTexture>;
FAlternatingZoneIndex : integer;
FAlternatingZones : TDictionary<string, integer>;
procedure LoadMesh;
procedure CheckConditionalTextures;
procedure ConditionalTexturesDirty;
procedure PopEffect;
procedure Apply; override;
function FinalSize : RVector3; override;
procedure Idle; override;
constructor Create(Meshpath : string); reintroduce; overload;
procedure AddMeshEffect(const MeshEffect : TMeshEffect);
procedure RemoveMeshEffect(const MeshEffect : TMeshEffect);
/// <summary> Returns default if not present in dict. </summary>
function GetBoneAdjustments(const BoneName : string) : RMatrixAdjustments;
procedure SetBoneAdjustments(const BoneName : string; const Value : RMatrixAdjustments);
function TryGetBoneAdjustments(const BoneName : string; out Adjustments : RMatrixAdjustments) : boolean;
published
[XEvent(eiDrawOutline, epMiddle, etTrigger)]
/// <summary> Draws a model outline in this frame. </summary>
function OnDrawOutline(Color, OnlyOutline : RParam) : boolean;
[XEvent(eiAfterCreate, epMiddle, etTrigger)]
/// <summary> Initializes the model. </summary>
function OnAfterDeserialization() : boolean;
[XEvent(eiChangeCommander, epLast, etTrigger, esGlobal)]
/// <summary> Update conditional textures. </summary>
function OnChangeCommander(Index : RParam) : boolean;
[XEvent(eiColorAdjustment, epLast, etTrigger), ScriptExcludeMember]
/// <summary> Recolorize the mesh. </summary>
function OnColorAdjustment(ColorAdjustment : RParam; absH, absS, absV : RParam) : boolean;
[XEvent(eiDie, epLast, etTrigger)]
/// <summary> Inflates the mesh and let it glow. </summary>
function OnDie(KillerID, KillerCommanderID : RParam) : boolean;
[XEvent(eiPlayAnimation, epLast, etTrigger)]
/// <summary> Plays an animation. </summary>
function OnPlayAnimation(AnimationName, AnimationPlayMode, Length : RParam) : boolean;
[XEvent(eiSubPositionByString, epFirst, etRead)]
/// <summary> Return the center of the mesh. </summary>
function OnSubPositionByString(Name : RParam; PrevValue : RParam) : RParam;
[XEvent(eiUnitPropertyChanged, epLast, etTrigger)]
/// <summary> Pauses animation. </summary>
function OnUnitPropertyChanged(ChangedUnitProperties, Removed : RParam) : boolean;
[XEvent(eiBoundings, epFirst, etRead)]
/// <summary> Return the boundingsphere. </summary>
function OnBoundings(Previous : RParam) : RParam;
[XEvent(eiClientOption, epLast, etTrigger, esGlobal)]
function OnClientOption(ChangedOption : RParam) : boolean;
[XEvent(eiResourceBalance, epLast, etWrite)]
function OnSetResource(ResourceID, Amount : RParam) : boolean;
[XEvent(eiFire, epLast, etTrigger)]
function OnFire(Targets : RParam) : boolean;
public
constructor Create(Owner : TEntity; Meshpath : string); reintroduce; overload;
constructor CreateGrouped(Owner : TEntity; Group : TArray<byte>; Meshpath : string); reintroduce;
function CastsNoShadows : TMeshComponent;
function ShadingReductionFromTerrain : TMeshComponent;
function ApplyAutoSizeNormalization : TMeshComponent;
function ApplyLegacySizeFactor : TMeshComponent;
function HasAttackLoop : TMeshComponent;
function NoWalkOffset : TMeshComponent;
function AlternatingZone(const ZoneName : string; ZoneCount : integer) : TMeshComponent;
function IgnoreScalingForAnimations : TMeshComponent;
function IsEffectMesh : TMeshComponent;
function SetAnimationSpeed(const AnimationName : string; AnimationSpeed : single) : TMeshComponent;
function CreateNewAnimationFrom(SourceAnimation : string; NewAnimationName : string; Startframe, Endframe : integer) : TMeshComponent;
/// <summary> For "FBX import" to create several animationclips from standard fbx animationtrack,
/// until MAYA LT supports named animationclips.</summary>
function CreateNewAnimation(AnimationName : string; Startframe, Endframe : integer) : TMeshComponent; overload;
function CreateNewAnimationFromFile(const AnimationFile, AnimationName : string) : TMeshComponent; overload;
function SetFollowingDefaultAnimation(const AnimationName, FollowingDefaultAnimationName : string) : TMeshComponent; overload;
function ApplyTeamColoring(MaskFilename : string) : TMeshComponent;
function BindZoneToBone(const ZoneName, BoneName : string) : TMeshComponent;
function IsDecal : TMeshComponent; reintroduce;
function BoneInvertX(const BoneName : string) : TMeshComponent;
function BoneInvertY(const BoneName : string) : TMeshComponent;
function BoneInvertZ(const BoneName : string) : TMeshComponent;
function BoneSwapXY(const BoneName : string) : TMeshComponent;
function BoneSwapXZ(const BoneName : string) : TMeshComponent;
function BoneSwapYZ(const BoneName : string) : TMeshComponent;
function BoneSwizzleXZY(const BoneName : string) : TMeshComponent;
function BoneSwizzleZYX(const BoneName : string) : TMeshComponent;
function BoneSwizzleYXZ(const BoneName : string) : TMeshComponent;
function BoneSwizzleZXY(const BoneName : string) : TMeshComponent;
function BoneSwizzleYZX(const BoneName : string) : TMeshComponent;
function BoneOffset(const BoneName : string; OffsetX, OffsetY, OffsetZ : single) : TMeshComponent;
function BoneRotation(const BoneName : string; RotationX, RotationY, RotationZ : single) : TMeshComponent;
function BindTextureToResource(TextureType : EnumMeshTexture; const TextureFilename : string; ResourceType : EnumResource; Comparator : EnumComparator; ReferenceValue : single; TargetGroup : TArray<byte>) : TMeshComponent;
function BindTextureToTeam(TextureType : EnumMeshTexture; const TextureFilename : string; TeamID : integer) : TMeshComponent;
function BindTextureToUnitProperty(TextureType : EnumMeshTexture; const TextureFilename : string; MustHave : TArray<byte>) : TMeshComponent;
function DeathColorIdentityOverride(ColorIdentity : EnumEntityColor) : TMeshComponent;
{$IFDEF MAPEDITOR}
[ScriptExcludeMember]
procedure ShowMaterialEditor;
{$ENDIF}
destructor Destroy; override;
end;
{$RTTI INHERIT}
TMeshEffectComponent = class(TEntityComponent)
protected
FEffects : TObjectDictionary<TMeshComponent, TObjectList<TMeshEffect>>;
FTargetGroup : SetComponentGroup;
FDelayedEffects : TObjectList<TMeshEffect>;
FOnDie, FOnFire, FOnPreFire, FOnLose, FAtTarget, FOnWelaUnitProduced : boolean;
procedure ApplyEffects(Targets : TArray<TEntity>);
published
[XEvent(eiDie, epLast, etTrigger)]
function OnDie(KillerID, KillerCommanderID : RParam) : boolean;
[XEvent(eiFire, epLast, etTrigger)]
function OnFire(Targets : RParam) : boolean;