Base: stop item_pickups when toucher is in a vehicle.

Also auto-call Weapons_Release() when we're without health.
This commit is contained in:
Marco Cawthorne 2022-04-28 12:33:32 -07:00
parent 70f32c97a4
commit 9969be8d27
Signed by: eukara
GPG Key ID: C196CD8BA993248A
2 changed files with 15 additions and 1 deletions

View File

@ -17,10 +17,17 @@
void
item_pickup::Touch(entity eToucher)
{
player pl = (player)eToucher;
if (eToucher.classname != "player") {
return;
}
/* don't allow players inside vehicles to pick anything up by accident */
if (eToucher.flags & FL_INVEHICLE || pl.vehicle) {
return;
}
/* don't remove if AddItem fails */
if (Weapons_AddItem((base_player)eToucher, id, m_iClip) == FALSE) {
return;
@ -63,7 +70,6 @@ item_pickup::Respawn(void)
SetOrigin(GetSpawnOrigin());
/* At some points, the item id might not yet be set */
if (m_oldModel) {
SetModel(m_oldModel);
}
@ -75,6 +81,9 @@ item_pickup::Respawn(void)
if (!m_iWasDropped) {
m_iClip = -1;
} else {
if (time > 30.0f)
Sound_Play(this, CHAN_ITEM, "item.respawn");
}
if (!m_bFloating) {

View File

@ -36,6 +36,11 @@ Game_Input(player pl)
pl.impulse = 0;
#endif
if (pl.health <= 0) {
Weapons_Release(pl);
return;
}
if (input_buttons & INPUT_BUTTON0)
Weapons_Primary(pl);
else if (input_buttons & INPUT_BUTTON4)