-
Notifications
You must be signed in to change notification settings - Fork 70
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
Issue #1084 - Allow choosing target tile for meleeing adjacent targets #1106
Issue #1084 - Allow choosing target tile for meleeing adjacent targets #1106
Conversation
Hmm I just realized |
Okay, I generally got it working, the only problem is that now I'm unable to attack from the tile the attacker is standing on. I.e. the situation is reversed, previously you could only attack from the original tile, now you can attack from every tile except the original one. The tile the attacker is standing on is selected by default, but once you move the cursor from it, you cannot return, until you cancel out ability target. I think some piece of logic somewhere disallows attacking from the original tile, because that tile is occupied, and doesn't check that it's occupied by the unit itself. Currently looking for that logic. |
Traced the problem to |
Apparently |
Disregard the previous comment, it was only one place. Should be working now. Note: I've added support only for mouse targeting, I don't know if the controller targeting requires special handling in this regard and don't plan to do a single thing about it. |
Note to self: investigate maybe using this: // Find all adjacent tiles to target that are valid for melee attacking. This only looks at tiles adjacent to the target. |
The moment I started looking into it, I realized that this function only takes a unit as the potential target, so it wouldn't work for destructible objects like alien relay. The code that is currently in this PR does work in this case. In theory I could try using the As such, I think current implementation should stand. |
Current version of this PR does not properly interact with large units, like Sectopods, working on a fix. |
…attack tile for adjacent targets.
7bbb8c7
to
d1b4137
Compare
Current code can probably be further optimized, particularly this cycle:
The There is also some overlap, as one adjacent tile can be adjacent to multiple associated tiles. If the Destructible occupies several levels vertically, then we end up collecting and testing adjacent tiles that hang in the air as well. I'm inclined to keep the code as is, as it seems to work just fine, and arguably the native function will run faster than any pre-validation logic we can run in Unreal Script anyway. |
X2WOTCCommunityHighlander/Src/XComGame/Classes/X2MeleePathingPawn.uc
Outdated
Show resolved
Hide resolved
@Xymanek done everything you asked. |
Additional test cases to verify:
|
X2WOTCCommunityHighlander/Src/XComGame/Classes/X2MeleePathingPawn.uc
Outdated
Show resolved
Hide resolved
X2WOTCCommunityHighlander/Src/XComGame/Classes/X2MeleePathingPawn.uc
Outdated
Show resolved
Hide resolved
…awn.uc Co-authored-by: Xymanek <xymanek@outlook.com>
…awn.uc Co-authored-by: Xymanek <xymanek@outlook.com>
Targeting on very mild slopes like this roof works fine: https://imgur.com/SnuqQat And I already tested it multiple times for Sectopods, but here's a retest: https://imgur.com/a/e8AWSN3 However, you were right to be concerned about slopes: https://imgur.com/a/3mheYs2 |
Fixes #1084
Also adds a couple helper methods into CHHelpers to be used by this issue or mods.
I've traced the problem to
X2MeleePathingPawn::UpdateMeleeTarget()
, which calls very nativeclass'X2AbilityTarget_MovingMelee'.static.SelectAttackTile()
.When melee-ing adjacent targets,
SelectAttackTile()
only writes one tile into thePossibleTiles
out array.I suggest addressing this issue by inserting custom unreal script logic that will run in case
SelectAttackTile()
gives only one tile. Said custom logic will simply take a look at the target, and insert more tiles into thePossibleTiles
array.If it sounds good, I could use some help in setting up that custom logic so that we only insert tiles that are actually reachable by the soldier.