item_pickup: Call respawn item sound in a separate method for sanity's sake
This commit is contained in:
parent
22d5b36d1c
commit
3a37d21257
2 changed files with 15 additions and 14 deletions
|
@ -21,11 +21,12 @@ class item_pickup:NSRenderableEntity
|
|||
int m_iClip;
|
||||
int m_iWasDropped;
|
||||
int id;
|
||||
void(void) item_pickup;
|
||||
void item_pickup(void);
|
||||
|
||||
virtual void(void) Spawned;
|
||||
virtual void(entity) Touch;
|
||||
virtual void(int i) SetItem;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(int) SetFloating;
|
||||
virtual void Spawned(void);
|
||||
virtual void Touch(entity);
|
||||
virtual void SetItem(int i);
|
||||
virtual void Respawn(void);
|
||||
virtual void SetFloating(int);
|
||||
virtual void PickupRespawn(void);
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ void item_pickup::Touch(entity eToucher)
|
|||
Destroy();
|
||||
} else {
|
||||
Disappear();
|
||||
ScheduleThink(Respawn, 30.0f);
|
||||
ScheduleThink(PickupRespawn, 30.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,13 @@ void item_pickup::SetFloating(int i)
|
|||
m_bFloating = rint(bound(0, m_bFloating, 1));
|
||||
}
|
||||
|
||||
void
|
||||
item_pickup::PickupRespawn(void)
|
||||
{
|
||||
Respawn();
|
||||
Sound_Play(this, CHAN_ITEM, "item.respawn");
|
||||
}
|
||||
|
||||
void item_pickup::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
|
@ -65,13 +72,6 @@ void item_pickup::Respawn(void)
|
|||
SetSize([-16,-16,0], [16,16,16]);
|
||||
ReleaseThink();
|
||||
|
||||
if (!m_iWasDropped && cvar("sv_playerslots") > 1) {
|
||||
if (!real_owner && time > 30.0f)
|
||||
Sound_Play(this, CHAN_ITEM, "item.respawn");
|
||||
|
||||
m_iClip = -1;
|
||||
}
|
||||
|
||||
if (!m_bFloating) {
|
||||
DropToFloor();
|
||||
SetMovetype(MOVETYPE_TOSS);
|
||||
|
|
Loading…
Reference in a new issue