mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-29 06:07: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 touch[MAX_GENTITIES];
|
||||||
int num;
|
int num;
|
||||||
int i;
|
int i;
|
||||||
|
bool bWasInTurretOrVehicle;
|
||||||
|
|
||||||
if (g_gametype->integer != GT_SINGLE_PLAYER && IsSpectator()) {
|
if (g_gametype->integer != GT_SINGLE_PLAYER && IsSpectator()) {
|
||||||
// Prevent using stuff while spectating
|
// Prevent using stuff while spectating
|
||||||
|
@ -3411,7 +3412,9 @@ void Player::DoUse(Event *ev)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pVehicle || m_pTurret) {
|
bWasInTurretOrVehicle = m_pVehicle || m_pTurret;
|
||||||
|
|
||||||
|
if (bWasInTurretOrVehicle) {
|
||||||
RemoveFromVehiclesAndTurretsInternal();
|
RemoveFromVehiclesAndTurretsInternal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3469,7 +3472,7 @@ void Player::DoUse(Event *ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < num && m_pVehicle) {
|
if (!bWasInTurretOrVehicle && m_pVehicle) {
|
||||||
//
|
//
|
||||||
// Added in 2.30
|
// Added in 2.30
|
||||||
// Make the vehicle also invincible if the player is invincible
|
// Make the vehicle also invincible if the player is invincible
|
||||||
|
@ -3480,6 +3483,16 @@ void Player::DoUse(Event *ev)
|
||||||
m_pVehicle->flags &= ~FL_GODMODE;
|
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)
|
void Player::TouchStuff(pmove_t *pm)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue