Player can kill themself by firing HT guns

Issue #477 resolved
Andrew Theel created an issue

Firing the M3 HT or the Sdkfz 251 MG can kill the operator.

Comments (4)

  1. Colin Basnett

    Easy fix is to stop self-damage from projectiles. Unless, of course, this another problem where the Instigator is None?

  2. Matt Hands

    It's very odd that a bullet from a vehicle MG can somehow hit the firing player, but I can see how the bullet can now collide with the firing player's whip attachment.

    Before, any player in a vehicle had the collision disabled on its whip attachment, so nothing could hit it. But now, the new vehicle occupant collision system (which basically acts just like collision on an infantry pawn) means that a vehicle occupant in an exposed position has its whip collision enabled.

    Existing checks in bullet's ProcessTouch() function make sure we don't hit the Instigator or its Base or Owner, which usually prevents hits on a player's own whip. But for a VehicleWeaponPawn, the Instigator is the weapon pawn itself, not the player pawn (the DHPawn). So now we need to check against the 'Driver' of a weapon pawn.

    I've done it by setting a local 'InstigatorPlayer' variable, which is either the Instigator for an infantryman, or the 'Driver' of a weapon pawn. Then that gets used for checks instead of the Instigator. Any hit on a weapon pawn driver's causes an early exit from the function, but there are further safeguards later on too.

    So I'm not sure how a bullet can hit the firing player, but I'm confident any collision with the firing player's whip attachment will now be ignored, so it should cure this rare bug.

  3. Matt Hands

    Should be fixed in 7810635.

    Changes are well explained in function comments.

    Will close this and we can re-open if think the bug may still exist.

  4. Log in to comment