mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Reset the player state when using a turret
This prevents the player from using the turret + hold their weapon to crouch and become impossible to hit
This commit is contained in:
parent
88ac49c0c9
commit
dfd04f0d41
1 changed files with 15 additions and 2 deletions
|
@ -3400,6 +3400,7 @@ void Player::DoUse(Event *ev)
|
|||
int touch[MAX_GENTITIES];
|
||||
int num;
|
||||
int i;
|
||||
bool bWasInTurretOrVehicle;
|
||||
|
||||
if (g_gametype->integer != GT_SINGLE_PLAYER && IsSpectator()) {
|
||||
// Prevent using stuff while spectating
|
||||
|
@ -3411,7 +3412,9 @@ void Player::DoUse(Event *ev)
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_pVehicle || m_pTurret) {
|
||||
bWasInTurretOrVehicle = m_pVehicle || m_pTurret;
|
||||
|
||||
if (bWasInTurretOrVehicle) {
|
||||
RemoveFromVehiclesAndTurretsInternal();
|
||||
return;
|
||||
}
|
||||
|
@ -3469,7 +3472,7 @@ void Player::DoUse(Event *ev)
|
|||
}
|
||||
}
|
||||
|
||||
if (i < num && m_pVehicle) {
|
||||
if (!bWasInTurretOrVehicle && m_pVehicle) {
|
||||
//
|
||||
// Added in 2.30
|
||||
// Make the vehicle also invincible if the player is invincible
|
||||
|
@ -3480,6 +3483,16 @@ void Player::DoUse(Event *ev)
|
|||
m_pVehicle->flags &= ~FL_GODMODE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bWasInTurretOrVehicle && (m_pVehicle || m_pTurret)) {
|
||||
//
|
||||
// Added in OPM
|
||||
// Reset the legs and torso state.
|
||||
// This prevents players from using a turret and hold the weapon fire
|
||||
// to crouch with their weapon and become impossible to hit
|
||||
currentState_Legs = statemap_Legs->FindState("STAND");
|
||||
currentState_Torso = statemap_Torso->FindState("STAND");
|
||||
}
|
||||
}
|
||||
|
||||
void Player::TouchStuff(pmove_t *pm)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue