void nade_spawn_boom(entity this)
{
+ entity player = this.realowner;
entity spawnloc = new(nade_spawn_loc);
setorigin(spawnloc, this.origin);
- setsize(spawnloc, this.realowner.mins, this.realowner.maxs);
+ setsize(spawnloc, player.mins, player.maxs);
set_movetype(spawnloc, MOVETYPE_NONE);
spawnloc.solid = SOLID_NOT;
- spawnloc.drawonlytoclient = this.realowner;
+ spawnloc.drawonlytoclient = player;
spawnloc.effects = EF_STARDUST;
spawnloc.cnt = autocvar_g_nades_spawn_count;
- if(this.realowner.nade_spawnloc)
- {
- delete(this.realowner.nade_spawnloc);
- this.realowner.nade_spawnloc = NULL;
- }
+ if(player.nade_spawnloc)
+ delete(player.nade_spawnloc);
- this.realowner.nade_spawnloc = spawnloc;
+ player.nade_spawnloc = spawnloc;
}
void nades_orb_think(entity this)
entity _nade = e.nade;
e.nade = NULL;
- delete(e.fake_nade);
+ if(e.fake_nade)
+ delete(e.fake_nade);
e.fake_nade = NULL;
Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
void nade_prime(entity this)
{
- if(autocvar_g_nades_bonus_only)
- if(!STAT(NADE_BONUS, this))
+ if(autocvar_g_nades_bonus_only && !STAT(NADE_BONUS, this))
return; // only allow bonus nades
+ // TODO: handle old nade if it exists?
if(this.nade)
delete(this.nade);
+ this.nade = NULL;
if(this.fake_nade)
delete(this.fake_nade);
+ this.fake_nade = NULL;
int ntype;
string pntype = this.pokenade_type;
bool CanThrowNade(entity this)
{
- if(this.vehicle)
- return false;
-
- if(IS_DEAD(this))
- return false;
-
- if (!autocvar_g_nades)
- return false; // allow turning them off mid match
-
- if (weaponLocked(this))
- return false;
-
- if (!IS_PLAYER(this))
- return false;
-
- return true;
+ return !(this.vehicle || !autocvar_g_nades || IS_DEAD(this) || !IS_PLAYER(this) || weaponLocked(this));
}
.bool nade_altbutton;