-
Notifications
You must be signed in to change notification settings - Fork 73
Trigger an Event in XComUnitPawn.PlayHitEffects #826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -377,6 +377,67 @@ simulated function DamageTypeHitEffectContainer GetDamageTypeHitEffectContainer( | |
| return DamageEffectContainer; | ||
| } | ||
|
|
||
| /// HL-Docs: feature:OverrideHitEffects; issue:825; tags:tactical | ||
| /// Allows listeners to override the default behavior of XComUnitPawn.PlayHitEffects | ||
| /// This is especially useful for preventing the hardcoded templar fx for | ||
| /// eHit_Parry, eHit_Reflect and eHit_Deflect which play for any abilities that utilizing these hit results. | ||
| /// If OverrideHitEffect is set to true the PlayHitEffects function will return early and the default behavior is ommited. | ||
| /// | ||
| /// ```unrealscript | ||
| /// EventID: OverrideHitEffects | ||
| /// EventData: XComLWTuple { | ||
| /// Data: [ | ||
| /// out bool OverrideHitEffect, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should clarify in the body of the docs above what impact this value has (so modders don't need to look into the source code to find out). I know it can be inferred, but I can only be confident in the inference because I looked at the code. A more subtle question is whether changing the event values below affects
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pledbrook is that more clear now with that addition? |
||
| /// inout float Damage, | ||
| /// inout Actor InstigatedBy, | ||
| /// inout vector HitLocation, | ||
| /// inout name DamageTypeName, | ||
| /// inout vector Momentum, | ||
| /// inout bool bIsUnitRuptured, | ||
| /// inout EAbilityHitResult HitResult, | ||
| /// ] | ||
| /// } | ||
| /// EventSource: self (XComUnitPawn) | ||
| /// NewGameState: no | ||
| /// ``` | ||
| simulated private function bool TriggerOnOverrideHitEffects( | ||
| float Damage, | ||
| Actor InstigatedBy, | ||
| vector HitLocation, | ||
| name DamageTypeName, | ||
| vector Momentum, | ||
| bool bIsUnitRuptured, | ||
| EAbilityHitResult HitResult | ||
| ) | ||
| { | ||
| local XComLWTuple Tuple; | ||
|
|
||
| Tuple = new class'XComLWTuple'; | ||
| Tuple.Id = 'OverrideHitEffects'; | ||
| Tuple.Data.Add(8); | ||
| Tuple.Data[0].kind = XComLWTVBool; | ||
| Tuple.Data[0].b = false; // Override default hit effects | ||
| Tuple.Data[1].kind = XComLWTVFloat; | ||
| Tuple.Data[1].f = Damage; | ||
| Tuple.Data[2].kind = XComLWTVObject; | ||
| Tuple.Data[2].o = InstigatedBy; | ||
| Tuple.Data[3].kind = XComLWTVVector; | ||
| Tuple.Data[3].v = HitLocation; | ||
| Tuple.Data[4].kind = XComLWTVName; | ||
| Tuple.Data[4].n = DamageTypeName; | ||
| Tuple.Data[5].kind = XComLWTVVector; | ||
| Tuple.Data[5].v = Momentum; | ||
| Tuple.Data[6].kind = XComLWTVBool; | ||
| Tuple.Data[6].b = bIsUnitRuptured; | ||
| Tuple.Data[7].kind = XComLWTVInt; | ||
| Tuple.Data[7].i = HitResult; | ||
|
|
||
| `XEVENTMGR.TriggerEvent('OverrideHitEffects', Tuple, self); | ||
|
|
||
| return Tuple.Data[0].b; | ||
| } | ||
|
|
||
|
|
||
| simulated function PlayHitEffects(float Damage, Actor InstigatedBy, vector HitLocation, name DamageTypeName, vector Momentum, bool bIsUnitRuptured, EAbilityHitResult HitResult= eHit_Success, optional TraceHitInfo ThisHitInfo ) | ||
| { | ||
| local XComPawnHitEffect HitEffect; | ||
|
|
@@ -386,6 +447,13 @@ simulated function PlayHitEffects(float Damage, Actor InstigatedBy, vector HitLo | |
| local DamageTypeHitEffectContainer DamageContainer; | ||
| local XGUnit SourceUnit; | ||
|
|
||
| // Start Issue #825 | ||
| if (TriggerOnOverrideHitEffects(Damage, InstigatedBy, HitLocation, DamageTypeName, Momentum, bIsUnitRuptured, HitResult)) | ||
| { | ||
| return; | ||
| } | ||
| // End Issue #825 | ||
|
|
||
| // The HitNormal used to have noise applied, via "* 0.5 * VRand();", but S.Jameson requested | ||
| // that it be removed, since he can add noise with finer control via the editor. mdomowicz 2015_07_06 | ||
| HitNormal = Normal(Momentum); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.