REGISTER_MUTATOR(nades, cvar("g_nades"));
.float nade_time_primed;
+.float nade_lifetime;
.entity nade_spawnloc;
+
void nade_timer_think(entity this)
{
- this.skin = 8 - (this.owner.wait - time) / (autocvar_g_nades_nade_lifetime / 10);
+ this.skin = 8 - (this.owner.wait - time) / (this.owner.nade_lifetime / 10);
this.nextthink = time;
if(!this.owner || wasfreed(this.owner))
delete(this);
if(!pushdeltatime) return;
// div0: ticrate independent, 1 = identity (not 20)
- toucher.velocity = toucher.velocity * pow(autocvar_g_nades_entrap_strength, pushdeltatime);
+ toucher.velocity = toucher.velocity * (autocvar_g_nades_entrap_strength ** pushdeltatime);
#ifdef SVQC
UpdateCSQCProjectile(toucher);
IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this,
{
- RemoveGrapplingHook(it.realowner);
+ RemoveHook(it);
});
delete(this);
if(autocvar_g_nades_pickup)
if(time >= this.spawnshieldtime)
if(!toucher.nade && this.health == this.max_health) // no boosted shot pickups, thank you very much
- if(!STAT(FROZEN, toucher))
if(CanThrowNade(toucher)) // prevent some obvious things, like dead players
if(IS_REAL_CLIENT(toucher)) // above checks for IS_PLAYER, don't need to do it here
{
{
IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this,
{
- RemoveGrapplingHook(it.realowner);
+ RemoveHook(it);
});
delete(this);
return;
if(this.health == this.max_health)
{
sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
- this.nextthink = max(time + autocvar_g_nades_nade_lifetime, time);
+ this.nextthink = max(time + this.nade_lifetime, time);
setthink(this, nade_beep);
}
makevectors(e.v_angle);
// NOTE: always throw from first weapon entity?
- W_SetupShot(e, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0);
+ W_SetupShot(e, _nade.weaponentity_fld, false, false, SND_Null, CH_WEAPON_A, 0);
Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
if(Nades_from(n.nade_type) == NADE_TYPE_Null)
n.nade_type = NADE_TYPE_NORMAL.m_id;
+ .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+
setmodel(n, MDL_PROJECTILE_NADE);
//setattachment(n, player, "bip01 l hand");
n.exteriormodeltoclient = player;
setthink(n, nade_beep);
n.nextthink = max(n.wait - 3, time);
n.projectiledeathtype = DEATH_NADE.m_id;
+ n.weaponentity_fld = weaponentity;
+ n.nade_lifetime = ntime;
setmodel(fn, MDL_NADE_VIEW);
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
setattachment(fn, player.(weaponentity), "");
fn.realowner = fn.owner = player;
fn.colormod = Nades_from(n.nade_type).m_color;
fn.glowmod = player.glowmod;
setthink(fn, SUB_Remove);
fn.nextthink = n.wait;
+ fn.weaponentity_fld = weaponentity;
player.nade = n;
player.fake_nade = fn;
if(this.vehicle)
return false;
- if(gameover)
- return false;
-
if(IS_DEAD(this))
return false;
entity held_nade = player.nade;
if (held_nade)
{
- player.nade_timer = bound(0, (time - held_nade.nade_time_primed) / autocvar_g_nades_nade_lifetime, 1);
+ player.nade_timer = bound(0, (time - held_nade.nade_time_primed) / held_nade.nade_lifetime, 1);
// LOG_TRACEF("%d %d", player.nade_timer, time - held_nade.nade_time_primed);
makevectors(player.angles);
held_nade.velocity = player.velocity;
nades_RemoveBonus(frag_target);
}
-MUTATOR_HOOKFUNCTION(nades, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(nades, Damage_Calculate)
{
entity frag_inflictor = M_ARGV(0, entity);
entity frag_attacker = M_ARGV(1, entity);