-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add 'OverrideMetaHitEffect' event #1117
Add 'OverrideMetaHitEffect' event #1117
Conversation
Pull request modifies event listener templates Difference (click to expand)diff --git a/target/CHL_Event_Compiletest.uc b/target/CHL_Event_Compiletest.uc
index 62b936b..3d07a78 100644
--- a/target/CHL_Event_Compiletest.uc
+++ b/target/CHL_Event_Compiletest.uc
@@ -659,6 +659,39 @@ static function EventListenerReturn OnOverrideKillXp(Object EventData, Object Ev
return ELR_NoInterrupt;
}
+static function EventListenerReturn OnOverrideMetaHitEffect(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
+{
+ local XComUnitPawn Pawn;
+ local XComLWTuple Tuple;
+ local bool OverrideMetaHitEffect;
+ local vector HitLocation;
+ local name DamageTypeName;
+ local vector Momentum;
+ local bool bIsUnitRuptured;
+ local EAbilityHitResult HitResult;
+
+ Pawn = XComUnitPawn(EventSource);
+ Tuple = XComLWTuple(EventData);
+
+ OverrideMetaHitEffect = Tuple.Data[0].b;
+ HitLocation = Tuple.Data[1].v;
+ DamageTypeName = Tuple.Data[2].n;
+ Momentum = Tuple.Data[3].v;
+ bIsUnitRuptured = Tuple.Data[4].b;
+ HitResult = EAbilityHitResult(Tuple.Data[5].i);
+
+ // Your code here
+
+ Tuple.Data[0].b = OverrideMetaHitEffect;
+ Tuple.Data[1].v = HitLocation;
+ Tuple.Data[2].n = DamageTypeName;
+ Tuple.Data[3].v = Momentum;
+ Tuple.Data[4].b = bIsUnitRuptured;
+ Tuple.Data[5].i = HitResult;
+
+ return ELR_NoInterrupt;
+}
+
static function EventListenerReturn OnOverrideMissionImage(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
local XComGameState_MissionSite MissionState;
What? (click to expand)The Highlander documentation tool generates event listener examples from event specifications. |
/// ```event | ||
/// EventID: OverrideMetaHitEffect, | ||
/// EventData: [ | ||
/// out bool OverrideMetaHitEffect, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this is inout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will adjust.
/// inout vector HitLocation, | ||
/// inout name DamageTypeName, | ||
/// inout vector Momentum, | ||
/// in bool bIsUnitRuptured, | ||
/// inout enum[EAbilityHitResult] HitResult, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these inout
with the exception of bIsUnitRuptured
? Are listeners meant to be able to override these values while keeping the vanilla logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are listeners meant to be able to override these values while keeping the vanilla logic?
Yeah, why not? This would be consistent with changes I did for the other similar event nearby.
with the exception of bIsUnitRuptured?
It's a bool and I'm lazy about converting it to int and back and explaining it in docs, and I'm not sure it even makes a difference anyway. If there's a use case for it later, it can be added into the Tuple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it even makes a difference anyway
X2WOTCCommunityHighlander/X2WOTCCommunityHighlander/Src/XComGame/Classes/XComUnitPawn.uc
Lines 607 to 618 in 5bac3f6
if (bIsUnitRuptured) | |
{ | |
if (DamageContainer != none) | |
{ | |
RuptureEffectTemplate = DamageContainer.GetMetaRuptureHitEffectTemplateForDamageType(DamageTypeName); | |
} | |
if (HitEffectTemplate != none) | |
{ | |
Spawn(class'XComPawnHitEffect', , , HitLocation, Rotator(HitNormal), RuptureEffectTemplate); | |
} | |
} |
/// Meta Hit Effects are intended to communicate the overall effect of the attack, | ||
/// and include things like blood gushing out of the unit. | ||
/// If `OverrideMetaHitEffect` is set to `true`, the default behavior is omitted, | ||
/// and no meta hit effect is played. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add something like
... Keeping it set to
false
will allow the original logic to run, but you can also modify the parameters passed to it
@Xymanek implemented changes you requested. I'll do the same for OverrideHitEffects. |
Closes #1116