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 #1355

Closed Tedster59 closed 1 month ago

Tedster59 commented 2 months ago

fixes #1354.

This event allows mods to override the default behavior of XGAIPlayer.ShouldUnitPatrol.

Default behavior ties the patrol behavior to UnitState.IsUnrevealedAI meaning that units spotted by concealed XCOM units stop patrolling. This event allows this behavior to be overridden by mods. The original hook was present in the LW2 Highlander and X2CommunityHighlander, but was not ported to WOTCCommunityHighlander.

I have tested this hook with a dev build of LWOTC and it functions as expected.

github-actions[bot] commented 2 months 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..128a40b 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 class UnitState; + + PlayerState = XGAIPlayer(EventSource); + Tuple = XComLWTuple(EventData); + + ShouldOverrideUnrevealedAI = Tuple.Data[0].b; + UnitState = class(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.
Tedster59 commented 1 month ago

Closing for code cleanup and making new PR