SHOW:
|
|
- or go back to the newest paste.
1 | class X2AmbientNarrativeCriteria_SVF_TemplateModificator extends X2AmbientNarrativeCriteria; | |
2 | ||
3 | static function array<X2DataTemplate> CreateTemplates() | |
4 | { | |
5 | // This turns out to be a good hook for doing global template modification because subclasses of X2AmbientNarrativeCriteria | |
6 | // are the last ones loaded when the game is setting up. We'll just return an empty list of templates for template creation | |
7 | // (because we're not actually using this to create any templates) and put our template modifications in-between | |
8 | local array<X2DataTemplate> Templates; | |
9 | Templates.Length = 0; | |
10 | ||
11 | // Update the Suppression visualization function | |
12 | UpdateSuppressionVisualizationFunction(); | |
13 | ||
14 | return Templates; | |
15 | } | |
16 | ||
17 | static function UpdateSuppressionVisualizationFunction() | |
18 | { | |
19 | local X2AbilityTemplate AbilityTemplate; | |
20 | ||
21 | // Find the Suppression ability template | |
22 | AbilityTemplate = class'X2AbilityTemplateManager'.static.GetAbilityTemplateManager().FindAbilityTemplate('Suppression'); | |
23 | if (AbilityTemplate != none) | |
24 | { | |
25 | AbilityTemplate.BuildVisualizationFn = SuppressionBuildVisualization; | |
26 | ||
27 | `LOG("Suppression Visualization Fix: Updated " @ AbilityTemplate.DataName @ " template visualization function."); | |
28 | } | |
29 | } | |
30 | ||
31 | //--------------------------------------------------------------------------------------------------- | |
32 | // Suppression Visualization | |
33 | //--------------------------------------------------------------------------------------------------- | |
34 | ||
35 | static simulated function SuppressionBuildVisualization(XComGameState VisualizeGameState) | |
36 | { | |
37 | local XComGameStateHistory History; | |
38 | local XComGameStateContext_Ability Context; | |
39 | local StateObjectReference InteractingUnitRef; | |
40 | ||
41 | local VisualizationActionMetadata EmptyTrack; | |
42 | local VisualizationActionMetadata ActionMetadata; | |
43 | ||
44 | local XComGameState_Ability Ability; | |
45 | local X2Action_PlaySoundAndFlyOver SoundAndFlyOver; | |
46 | ||
47 | local XComUnitPawn UnitPawn; | |
48 | local XComWeapon Weapon; | |
49 | ||
50 | History = `XCOMHISTORY; | |
51 | ||
52 | Context = XComGameStateContext_Ability(VisualizeGameState.GetContext()); | |
53 | InteractingUnitRef = Context.InputContext.SourceObject; | |
54 | ||
55 | //Configure the visualization track for the shooter | |
56 | //**************************************************************************************** | |
57 | ActionMetadata = EmptyTrack; | |
58 | ActionMetadata.StateObject_OldState = History.GetGameStateForObjectID(InteractingUnitRef.ObjectID, eReturnType_Reference, VisualizeGameState.HistoryIndex - 1); | |
59 | ActionMetadata.StateObject_NewState = VisualizeGameState.GetGameStateForObjectID(InteractingUnitRef.ObjectID); | |
60 | ActionMetadata.VisualizeActor = History.GetVisualizer(InteractingUnitRef.ObjectID); | |
61 | ||
62 | // Check the actor's pawn and weapon, see if they can play the suppression effect | |
63 | - | (63) UnitPawn = XGUnit(BuildTrack.TrackActor).GetPawn(); |
63 | + | UnitPawn = XGUnit(ActionMetadata.VisualizeActor).GetPawn(); |
64 | Weapon = XComWeapon(UnitPawn.Weapon); | |
65 | if (Weapon != None && | |
66 | !UnitPawn.GetAnimTreeController().CanPlayAnimation(Weapon.WeaponSuppressionFireAnimSequenceName) && | |
67 | !UnitPawn.GetAnimTreeController().CanPlayAnimation(class'XComWeapon'.default.WeaponSuppressionFireAnimSequenceName)) | |
68 | { | |
69 | // The unit can't play their weapon's suppression effect. Replace it with the normal fire effect so at least they'll look like they're shooting | |
70 | Weapon.WeaponSuppressionFireAnimSequenceName = Weapon.WeaponFireAnimSequenceName; | |
71 | } | |
72 | ||
73 | class'X2Action_ExitCover'.static.AddToVisualizationTree(ActionMetadata, Context, false, ActionMetadata.LastActionAdded); | |
74 | class'X2Action_StartSuppression'.static.AddToVisualizationTree(ActionMetadata, Context, false, ActionMetadata.LastActionAdded); | |
75 | //**************************************************************************************** | |
76 | //Configure the visualization track for the target | |
77 | InteractingUnitRef = Context.InputContext.PrimaryTarget; | |
78 | Ability = XComGameState_Ability(History.GetGameStateForObjectID(Context.InputContext.AbilityRef.ObjectID, eReturnType_Reference, VisualizeGameState.HistoryIndex - 1)); | |
79 | ActionMetadata = EmptyTrack; | |
80 | ActionMetadata.StateObject_OldState = History.GetGameStateForObjectID(InteractingUnitRef.ObjectID, eReturnType_Reference, VisualizeGameState.HistoryIndex - 1); | |
81 | ActionMetadata.StateObject_NewState = VisualizeGameState.GetGameStateForObjectID(InteractingUnitRef.ObjectID); | |
82 | ActionMetadata.VisualizeActor = History.GetVisualizer(InteractingUnitRef.ObjectID); | |
83 | SoundAndFlyOver = X2Action_PlaySoundAndFlyOver(class'X2Action_PlaySoundAndFlyOver'.static.AddToVisualizationTree(ActionMetadata, Context, false, ActionMetadata.LastActionAdded)); | |
84 | SoundAndFlyOver.SetSoundAndFlyOverParameters(None, Ability.GetMyTemplate().LocFlyOverText, '', eColor_Good); | |
85 | if (XComGameState_Unit(ActionMetadata.StateObject_OldState).ReserveActionPoints.Length != 0 && XComGameState_Unit(ActionMetadata.StateObject_NewState).ReserveActionPoints.Length == 0) | |
86 | { | |
87 | SoundAndFlyOver = X2Action_PlaySoundAndFlyOver(class'X2Action_PlaySoundAndFlyOver'.static.AddToVisualizationTree(ActionMetadata, Context, false, ActionMetadata.LastActionAdded)); | |
88 | SoundAndFlyOver.SetSoundAndFlyOverParameters(none, class'XLocalizedData'.default.OverwatchRemovedMsg, '', eColor_Good); | |
89 | } | |
90 | } | |
91 | ||
92 | Warning/Error Summary | |
93 | --------------------- | |
94 | D:\SteamLibrary\SteamApps\common\XCOM 2 War of the Chosen SDK\Development\Src\WOTCSuppressionVisualizationFix\Classes\X2AmbientNarrativeCriteria_SVF_TemplateModificator.uc(63): | |
95 | Error, Bad or missing expression for token: XGUnit, in '=' |