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:
parent
70f32c97a4
commit
9969be8d27
2 changed files with 15 additions and 1 deletions
|
@ -17,10 +17,17 @@
|
||||||
void
|
void
|
||||||
item_pickup::Touch(entity eToucher)
|
item_pickup::Touch(entity eToucher)
|
||||||
{
|
{
|
||||||
|
player pl = (player)eToucher;
|
||||||
|
|
||||||
if (eToucher.classname != "player") {
|
if (eToucher.classname != "player") {
|
||||||
return;
|
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 */
|
/* don't remove if AddItem fails */
|
||||||
if (Weapons_AddItem((base_player)eToucher, id, m_iClip) == FALSE) {
|
if (Weapons_AddItem((base_player)eToucher, id, m_iClip) == FALSE) {
|
||||||
return;
|
return;
|
||||||
|
@ -63,7 +70,6 @@ item_pickup::Respawn(void)
|
||||||
SetOrigin(GetSpawnOrigin());
|
SetOrigin(GetSpawnOrigin());
|
||||||
|
|
||||||
/* At some points, the item id might not yet be set */
|
/* At some points, the item id might not yet be set */
|
||||||
|
|
||||||
if (m_oldModel) {
|
if (m_oldModel) {
|
||||||
SetModel(m_oldModel);
|
SetModel(m_oldModel);
|
||||||
}
|
}
|
||||||
|
@ -75,6 +81,9 @@ item_pickup::Respawn(void)
|
||||||
|
|
||||||
if (!m_iWasDropped) {
|
if (!m_iWasDropped) {
|
||||||
m_iClip = -1;
|
m_iClip = -1;
|
||||||
|
} else {
|
||||||
|
if (time > 30.0f)
|
||||||
|
Sound_Play(this, CHAN_ITEM, "item.respawn");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_bFloating) {
|
if (!m_bFloating) {
|
||||||
|
|
|
@ -36,6 +36,11 @@ Game_Input(player pl)
|
||||||
pl.impulse = 0;
|
pl.impulse = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (pl.health <= 0) {
|
||||||
|
Weapons_Release(pl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (input_buttons & INPUT_BUTTON0)
|
if (input_buttons & INPUT_BUTTON0)
|
||||||
Weapons_Primary(pl);
|
Weapons_Primary(pl);
|
||||||
else if (input_buttons & INPUT_BUTTON4)
|
else if (input_buttons & INPUT_BUTTON4)
|
||||||
|
|
Loading…
Reference in a new issue