-
Notifications
You must be signed in to change notification settings - Fork 136
bugfix: Undetected mines can now be approached when using a disarm weapon #1883
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
base: main
Are you sure you want to change the base?
bugfix: Undetected mines can now be approached when using a disarm weapon #1883
Conversation
|
LGTM |
Caball009
left a comment
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.
Tested and works. Looks good to me.
| return STATE_FAILURE; | ||
| } | ||
| } | ||
| if( victim->testStatus( OBJECT_STATUS_STEALTHED ) && !victim->testStatus( OBJECT_STATUS_DETECTED ) && !victim->testStatus( OBJECT_STATUS_DISGUISED ) ) |
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 same condition also exists in AIAttackPursueTargetState::updateInternal. Does that need similar treatment?
| return STATE_FAILURE; // If obj is stealthed, can no longer approach. | ||
| #else | ||
| const Bool isTargetingMine = weapon && weapon->getDamageType() == DAMAGE_DISARM && | ||
| (victim->isKindOf(KINDOF_MINE) || victim->isKindOf(KINDOF_BOOBY_TRAP) || victim->isKindOf(KINDOF_DEMOTRAP)); |
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.
If the damage type is DAMAGE_DISARM, do we even need to test for the target kindof? We assume that all object kinds can be approached if they can be disarmed, no?
| (victim->isKindOf(KINDOF_MINE) || victim->isKindOf(KINDOF_BOOBY_TRAP) || victim->isKindOf(KINDOF_DEMOTRAP)); | ||
|
|
||
| if (!isTargetingMine) | ||
| return STATE_FAILURE; // If obj is stealthed, can no longer approach - unless we're targeting a mine! |
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.
I suggest move the EA comment up like so:
// If obj is stealthed, can no longer approach
// TheSuperHackers @bugfix Except when disarming stealthed mine-like objects
Fixes #1874
This change allows undetected mines to be approached when using a disarm weapon.
In the retail game, a worker or dozer refuses to perform a mine disarming command if there are undetected mines at the targeted location. This is because there is no logic in the
AIAttackApproachTargetState(entered when a weapon is out of range) to accommodate the special-case mine disarming behaviour, and the state returns a fail if the target is stealthed and undetected irrespective of the initial command's success.Before
The worker does not proceed to disarm mines
MINE_FAIL.mp4
After
The worker proceeds to disarm mines
MINE_SUCCESS.mp4