X2CommunityCore / X2WOTCCommunityHighlander

https://steamcommunity.com/workshop/filedetails/?id=1134256495
MIT License
60 stars 68 forks source link

Add event to override patrol behavior if pod is spotted in stealth #1360

Closed Tedster59 closed 1 month ago

Tedster59 commented 1 month ago

Fixes #1354. Another LW2/X2CommunityHighlander feature that is not part of the WOTC Highlander.

Code is at https://github.com/X2CommunityCore/X2CommunityHighlander/blob/master/X2CommunityHighlander/Src/XComGame/Classes/XGAIPlayer.uc#L702

The code as is from the X2CommunityHighlander should work to update the matching function in XGAIPlayer.uc

The comment from LW2 config shows why this is needed:

This adjusts an interesting vanilla setting in which patrolling AI (who had not sighted XCOM) would stop patrolling when a concealed XCOM unit sighted them)

github-actions[bot] commented 1 month ago

Pull request modifies event listener templates

Difference (click to expand) ```diff diff --git a/target/CHL_Event_Compiletest.uc b/target/CHL_Event_Compiletest.uc index 7006534..02ed7bd 100644 --- a/target/CHL_Event_Compiletest.uc +++ b/target/CHL_Event_Compiletest.uc @@ -1261,6 +1261,26 @@ static function EventListenerReturn OnShouldCivilianRun(Object EventData, Object return ELR_NoInterrupt; } +static function EventListenerReturn OnShouldUnitPatrolUnderway(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject) +{ + local XGAIPlayer PlayerState; + local XComLWTuple Tuple; + local bool ShouldOverrideUnrevealedAI; + local XComGameState_Unit UnitState; + + PlayerState = XGAIPlayer(EventSource); + Tuple = XComLWTuple(EventData); + + ShouldOverrideUnrevealedAI = Tuple.Data[0].b; + UnitState = XComGameState_Unit(Tuple.Data[1].o); + + // Your code here + + Tuple.Data[0].b = ShouldOverrideUnrevealedAI; + + return ELR_NoInterrupt; +} + static function EventListenerReturn OnSitRepCheckAdditionalRequirements(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject) { local X2SitRepTemplate SitRepTemplate; ```
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.