Skip to content
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

Update docs and functionality for OverrideHitEffects event #1115

Merged
merged 2 commits into from
Feb 7, 2022

Conversation

Iridar
Copy link
Contributor

@Iridar Iridar commented Dec 31, 2021

Closes #1114

This PR updates both the docs and event functionality to be in line with each other.

A mod I'm working on has a legitimate use for this event that requires overriding some of the stuff passed in the Tuple.

I opted not to make bIsUnitRuptured an out argument since I don't have personal use for it and I didn't want to deal with the whole "booleans can't be out arguments" thing.

@Iridar Iridar added the ready-to-review A pull request is ready to be reviewed label Dec 31, 2021
@Iridar Iridar added this to the 1.24.0 milestone Dec 31, 2021
@Iridar Iridar self-assigned this Dec 31, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Dec 31, 2021

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..0edabdd 100644
--- a/target/CHL_Event_Compiletest.uc
+++ b/target/CHL_Event_Compiletest.uc
@@ -608,6 +608,7 @@ static function EventListenerReturn OnOverrideHitEffects(Object EventData, Objec
 	Pawn = XComUnitPawn(EventSource);
 	Tuple = XComLWTuple(EventData);
 
+	OverrideHitEffect = Tuple.Data[0].b;
 	Damage = Tuple.Data[1].f;
 	InstigatedBy = Actor(Tuple.Data[2].o);
 	HitLocation = Tuple.Data[3].v;
@@ -620,7 +621,6 @@ static function EventListenerReturn OnOverrideHitEffects(Object EventData, Objec
 
 	Tuple.Data[0].b = OverrideHitEffect;
 	Tuple.Data[1].f = Damage;
-	Tuple.Data[2].o = InstigatedBy;
 	Tuple.Data[3].v = HitLocation;
 	Tuple.Data[4].n = DamageTypeName;
 	Tuple.Data[5].v = Momentum;
What? (click to expand)

The Highlander documentation tool generates event listener examples from event specifications.
This comment contains the modifications that would be made to the copy-pasteable event listeners in documentation, for PR authors and reviewers to inspect for correctness, and will automatically be kept up-to-date whenever this PR is updated.

@Xymanek
Copy link
Member

Xymanek commented Feb 5, 2022

I opted not to make bIsUnitRuptured an out argument since I don't have personal use for it and I didn't want to deal with the whole "booleans can't be out arguments" thing.

But the code (as it stands now) does do the bool -> int -> bool conversion?

@Iridar
Copy link
Contributor Author

Iridar commented Feb 5, 2022

I opted not to make bIsUnitRuptured an out argument since I don't have personal use for it and I didn't want to deal with the whole "booleans can't be out arguments" thing.

But the code (as it stands now) does do the bool -> int -> bool conversion?

Yes, I decided to do it anyway, I thought you wanted it.

@Xymanek
Copy link
Member

Xymanek commented Feb 5, 2022

I definitely prefer this version - was just asking about the disconnect between code and comments

@Xymanek Xymanek merged commit 145e9da into X2CommunityCore:master Feb 7, 2022
@Xymanek Xymanek removed the ready-to-review A pull request is ready to be reviewed label Feb 7, 2022
@Iridar Iridar deleted the 1114-OverrideHitEffects-fix branch October 29, 2023 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OverrideHitEffects event has inconsistent functionality / docs
2 participants