X2CommunityCore / X2WOTCCommunityHighlander

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

Eteam_One, ETeam_Two, Resistance, Aliens not adding each other to CachedKnownUnitRef List #619

Open RedDoby opened 5 years ago

RedDoby commented 5 years ago

I am sure everyone has noticed this. When the aliens and third parties are in a battle, they get into flanked positions and stand out in the open. I dug into it and found the code that's causing this. With this fix they treat each other as respectable opponents and use cover and normal behavior positioning now. I am not able to send any pull requests so I will just add the pastebin.

Changes to AI Unit Data: https://pastebin.com/UVhKhiiU Changes to Behavior: https://pastebin.com/hUAwKKN7

MrNiceUK commented 5 years ago

I volunteer to make a PR for this...

RedDoby commented 5 years ago

Just for consistency, you may want to use a Player Check instead of Team (since maybe multi-player will support this?) when checking for XCom here in GetAbsoluteKnowledgeUnitList: if (EnemyPlayerState.GetTeam() == ETeam_XCom)

RealityMachina commented 5 years ago

Continuing a discussion from discord, this is a list of every usage of GetEnemyPlayer() in the base game, in case a new usage of GetEnemyPlayers to accommodate additional teams may also be wanted to improve on the eTeam_One/eTeam_Two functionality while we're making sure the game knows how to accomodate the additional teams for the AI:

As a side note re: XGBattle's GetEnemySquad, XGPlayer calls upon that function as well in a XGSquadNativeBase event. However as this is an event that's from the native base class XGPlayerNativeBase, this could be used in a wide variety of places in native code.

RedDoby commented 4 years ago

Just a note, in GetAbsoluteKnowledgeUnitList the lost do need to be included as enemy players. Not only is this list used for movement positioning, it's all used for targeting in some cases (one example is melee targeting).