void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, string pntype);
void nade_pickup(entity this, entity thenade)
{
- spawn_held_nade(this, thenade.realowner, thenade.wait - time, thenade.nade_type, thenade.pokenade_type);
+ spawn_held_nade(this, thenade.realowner, autocvar_g_nades_pickup_time, thenade.nade_type, thenade.pokenade_type);
// set refire so player can't even
this.nade_refire = time + autocvar_g_nades_nade_refire;
return; // no self impacts
if(autocvar_g_nades_pickup)
- if(!other.nade)
+ if(time >= self.spawnshieldtime)
+ if(!other.nade && self.health == self.max_health) // no boosted shot pickups, thank you very much
if(IS_REAL_CLIENT(other) && IS_PLAYER(other))
{
nade_pickup(other, self);
nade_burn_spawn(this);
}
-void toss_nade(entity e, vector _velocity, float _time)
+void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
{SELFPARAM();
if(e.nade == world)
return;
else
_nade.velocity = W_CalculateProjectileVelocity(e.velocity, _velocity, true);
+ if(set_owner)
+ _nade.realowner = e;
+
_nade.touch = nade_touch;
+ _nade.spawnshieldtime = time + 0.1; // prevent instantly picking up again
_nade.health = autocvar_g_nades_nade_health;
_nade.max_health = _nade.health;
_nade.takedamage = DAMAGE_AIM;
_nade.customizeentityforclient = func_null;
_nade.exteriormodeltoclient = world;
_nade.traileffectnum = 0;
- _nade.realowner = e;
_nade.teleportable = true;
_nade.pushable = true;
_nade.gravity = 1;
float nade_customize()
{SELFPARAM();
//if(IS_SPEC(other)) { return false; }
- if(other == self.realowner || (IS_SPEC(other) && other.enemy == self.realowner))
+ if(other == self.exteriormodeltoclient || (IS_SPEC(other) && other.enemy == self.exteriormodeltoclient))
{
// somewhat hide the model, but keep the glow
//self.effects = 0;
float _force = time - held_nade.nade_time_primed;
_force /= autocvar_g_nades_nade_lifetime;
_force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
- toss_nade(self, (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05) * _force, 0);
+ toss_nade(self, true, (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05) * _force, 0);
}
}
}
MUTATOR_HOOKFUNCTION(nades, VehicleEnter)
{
if(vh_player.nade)
- toss_nade(vh_player, '0 0 100', max(vh_player.nade.wait, time + 0.05));
+ toss_nade(vh_player, true, '0 0 100', max(vh_player.nade.wait, time + 0.05));
return false;
}
held_nade.angles_y = player.angles.y;
if (time + 0.1 >= held_nade.wait)
- toss_nade(player, '0 0 0', time + 0.05);
+ toss_nade(player, false, '0 0 0', time + 0.05);
}
if (!CanThrowNade()) return;
float _force = time - held_nade.nade_time_primed;
_force /= autocvar_g_nades_nade_lifetime;
_force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
- toss_nade(player, (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1) * _force, 0);
+ toss_nade(player, false, (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1) * _force, 0);
}
}
}
{
if(frag_target.nade)
if(!STAT(FROZEN, frag_target) || !autocvar_g_freezetag_revive_nade)
- toss_nade(frag_target, '0 0 100', max(frag_target.nade.wait, time + 0.05));
+ toss_nade(frag_target, true, '0 0 100', max(frag_target.nade.wait, time + 0.05));
float killcount_bonus = ((frag_attacker.killcount >= 1) ? bound(0, autocvar_g_nades_bonus_score_minor * frag_attacker.killcount, autocvar_g_nades_bonus_score_medium) : autocvar_g_nades_bonus_score_minor);
MUTATOR_HOOKFUNCTION(nades, DropSpecialItems)
{
if(frag_target.nade)
- toss_nade(frag_target, '0 0 0', time + 0.05);
+ toss_nade(frag_target, true, '0 0 0', time + 0.05);
return false;
}