-
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
Re-add event to allow mods to adjust UFO interception time #1317
Re-add event to allow mods to adjust UFO interception time #1317
Conversation
783d8d5
to
233b076
Compare
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 03d8f1b..7006534 100644
--- a/target/CHL_Event_Compiletest.uc
+++ b/target/CHL_Event_Compiletest.uc
@@ -1196,6 +1196,13 @@ static function EventListenerReturn OnPostSquaddieLoadoutApplied(Object EventDat
return ELR_NoInterrupt;
}
+static function EventListenerReturn OnPostUFOSetInterceptionTime(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
+{
+ // Your code here
+
+ return ELR_NoInterrupt;
+}
+
static function EventListenerReturn OnPreCompleteStrategyFromTacticalTransfer(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
// Your code here
What? (click to expand)The Highlander documentation tool generates event listener examples from event specifications. |
/// EventSource: XComGameState_UFO, | ||
/// NewGameState: none | ||
/// ``` | ||
|
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.
The empty line before the event trigger is unnecessary, and I would add Start / End Issue #### tags before the start of the docs and after the event trigger.
Also the docs could be formulated a bit better, like:
The
PostUFOSetInterceptionTime
event allows mods to modify the state of a UFO
after it has been created, but before the gamestate is submitted.
To use this event, listen to it withELD_Immediate
deferral and edit the state object received.
There's also this issue to consider: https://www.reddit.com/r/xcom2mods/wiki/index/events#wiki_important_note
In short, when listening to events using ELD_Immediate, the state objects passed as EventSource / EventData are taken from History. To modify the current version of the state object, listeners must explicitly get it from the NewGameState you should be passing with the event, otherwise you would be modifying History.
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.
Ok, this has been refactored and updated to shift the call up the stack and pass in NewGameState to the event.
d511a70
to
1501894
Compare
/// To use this event, listen to it with `ELD_Immediate` | ||
/// and edit the state object received in the NewGameState. | ||
/// | ||
/// local XComGameState_UFO UFOState; |
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.
Please use unrealscript <code>
tags around the example code, for example:
/// ```unrealscript
/// float GetPreDefaultAttackingDamageModifier_CH(
/// XComGameState_Effect EffectState,
/// XComGameState_Unit SourceUnit,
/// Damageable Target,
/// XComGameState_Ability AbilityState,
/// const out EffectAppliedData ApplyEffectParameters,
/// float CurrentDamage,
/// XComGameState NewGameState)
/// ```
Also, nitpicking, but I'd adjust docs a little:
"To use this event, listen to it with the ELD_Immediate
deferral, and make sure to get the latest version of the UFO state object from the NewGameState, for example: ".
refactor commit to pass NewGameState revise docs
1501894
to
5b9fea7
Compare
Fixes issue #1316.
This event existed in the LW2 Highlander as well as the non-WOTC X2CommunityHighlander. This pull request re-adds it and documents it so LWoTC can use this event for its original purpose of adjusting the UFO interception time for systems such as Long War that do not use the base game mission calendar.