+#include "mutator_nades.qh"
+#include "../_all.qh"
+
+#include "mutator.qh"
+
+#include "gamemode_keyhunt.qh"
+#include "gamemode_freezetag.qh"
+#include "../../common/nades.qh"
+#include "../../common/monsters/spawn.qh"
+#include "../../common/monsters/sv_monsters.qh"
+
+.float lifetime;
+
.entity nade_spawnloc;
void nade_timer_think()
void nade_burn_spawn(entity _nade)
{
- CSQCProjectile(_nade, true, Nade_ProjectileFromID(_nade.nade_type, true), true);
+ CSQCProjectile(_nade, true, NADES[_nade.nade_type].m_projectile[true], true);
}
void nade_spawn(entity _nade)
_nade.effects |= EF_LOWPRECISION;
- CSQCProjectile(_nade, true, Nade_ProjectileFromID(_nade.nade_type, false), true);
+ CSQCProjectile(_nade, true, NADES[_nade.nade_type].m_projectile[false], true);
}
void napalm_damage(float dist, float damage, float edgedamage, float burntime)
d = damage + (edgedamage - damage) * (d / dist);
Fire_AddDamage(RandomSelection_chosen_ent, self.realowner, d * burntime, burntime, self.projectiledeathtype | HITTYPE_BOUNCE);
//trailparticles(self, particleeffectnum("fireball_laser"), self.origin, RandomSelection_chosen_ent.fireball_impactvec);
- pointparticles(particleeffectnum("fireball_laser"), self.origin, RandomSelection_chosen_ent.fireball_impactvec - self.origin, 1);
+ Send_Effect("fireball_laser", self.origin, RandomSelection_chosen_ent.fireball_impactvec - self.origin, 1);
}
}
void nade_ice_freeze(entity freezefield, entity frost_target, float freeze_time)
{
frost_target.frozen_by = freezefield.realowner;
- pointparticles(particleeffectnum("electro_impact"), frost_target.origin, '0 0 0', 1);
+ Send_Effect("electro_impact", frost_target.origin, '0 0 0', 1);
Freeze(frost_target, 1/freeze_time, 3, false);
if(frost_target.ballcarried)
if(g_keepaway) { ka_DropEvent(frost_target); }
case NUM_TEAM_4: expef = "nade_pink_explode"; break;
default: expef = "nade_neutral_explode"; break;
}
- pointparticles(particleeffectnum(expef), self.origin + '0 0 1', '0 0 0', 1);
+ Send_Effect(expef, self.origin + '0 0 1', '0 0 0', 1);
sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
RadiusDamage(self, self.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
randomp.x = randomr*cos(randomw);
randomp.y = randomr*sin(randomw);
randomp.z = 1;
- pointparticles(particleeffectnum("electro_muzzleflash"), self.origin + randomp, '0 0 0', 1);
+ Send_Effect("electro_muzzleflash", self.origin + randomp, '0 0 0', 1);
if(time >= self.nade_special_time)
{
self.nade_special_time = time+0.7;
- pointparticles(particleeffectnum("electro_impact"), self.origin, '0 0 0', 1);
- pointparticles(particleeffectnum("icefield"), self.origin, '0 0 0', 1);
+ Send_Effect("electro_impact", self.origin, '0 0 0', 1);
+ Send_Effect("icefield", self.origin, '0 0 0', 1);
}
makevectors(self.realowner.angles);
- entity oldself = self;
- self = self.realowner;
- MUTATOR_CALLHOOK(PortalTeleport);
- self.realowner = self;
- self = oldself;
+ MUTATOR_CALLHOOK(PortalTeleport, self.realowner);
- TeleportPlayer(self, self.realowner, locout, self.realowner.mangle, v_forward * vlen(self.realowner.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
+ TeleportPlayer(self, self.realowner, locout, self.realowner.angles, v_forward * vlen(self.realowner.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
}
void nade_spawn_boom()
{
float maxhealth;
float health_factor;
- if(IS_PLAYER(other) || (other.flags & FL_MONSTER))
+ if(IS_PLAYER(other) || IS_MONSTER(other))
if(other.deadflag == DEAD_NO)
if(!other.frozen)
{
}
if ( health_factor > 0 )
{
- maxhealth = (other.flags & FL_MONSTER) ? other.max_health : g_pickup_healthmega_max;
+ maxhealth = (IS_MONSTER(other)) ? other.max_health : g_pickup_healthmega_max;
if ( other.health < maxhealth )
{
if ( self.nade_show_particles )
- pointparticles(particleeffectnum("healing_fx"), other.origin, '0 0 0', 1);
+ Send_Effect("healing_fx", other.origin, '0 0 0', 1);
other.health = min(other.health+health_factor, maxhealth);
}
other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
}
- if ( IS_REAL_CLIENT(other) || (other.vehicle_flags & VHF_ISVEHICLE) )
+ if ( IS_REAL_CLIENT(other) || IS_VEHICLE(other) )
{
- entity show_red = (other.vehicle_flags & VHF_ISVEHICLE) ? other.owner : other;
+ entity show_red = (IS_VEHICLE(other)) ? other.owner : other;
show_red.stat_healing_orb = time+0.1;
show_red.stat_healing_orb_alpha = 0.75 * (self.ltime - time) / self.healer_lifetime;
}
void nade_boom()
{
string expef;
- float nade_blast = 1;
+ bool nade_blast = true;
- switch ( self.nade_type )
+ switch ( NADES[self.nade_type] )
{
case NADE_TYPE_NAPALM:
nade_blast = autocvar_g_nades_napalm_blast;
expef = "explosion_medium";
break;
case NADE_TYPE_ICE:
- nade_blast = 0;
+ nade_blast = false;
expef = "electro_combo"; // hookbomb_explode electro_combo bigplasma_impact
break;
case NADE_TYPE_TRANSLOCATE:
- nade_blast = 0;
+ nade_blast = false;
expef = "";
break;
case NADE_TYPE_MONSTER:
case NADE_TYPE_SPAWN:
- nade_blast = 0;
+ nade_blast = false;
switch(self.realowner.team)
{
case NUM_TEAM_1: expef = "spawn_event_red"; break;
}
break;
case NADE_TYPE_HEAL:
- nade_blast = 0;
+ nade_blast = false;
expef = "spawn_event_red";
break;
}
if(expef != "")
- pointparticles(particleeffectnum(expef), findbetterlocation(self.origin, 8), '0 0 0', 1);
+ Send_Effect(expef, findbetterlocation(self.origin, 8), '0 0 0', 1);
sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM);
sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
}
if(self.takedamage)
- switch ( self.nade_type )
+ switch ( NADES[self.nade_type] )
{
case NADE_TYPE_NAPALM: nade_napalm_boom(); break;
case NADE_TYPE_ICE: nade_ice_boom(); break;
self.nextthink = max(self.wait, time);
}
-void nade_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
return;
}
- if(self.nade_type == NADE_TYPE_TRANSLOCATE || self.nade_type == NADE_TYPE_SPAWN)
+ if(self.nade_type == NADE_TYPE_TRANSLOCATE.m_id || self.nade_type == NADE_TYPE_SPAWN.m_id)
return;
if(DEATH_ISWEAPON(deathtype, WEP_BLASTER))
self.health -= damage;
- if ( self.nade_type != NADE_TYPE_HEAL || IS_PLAYER(attacker) )
+ if ( self.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
self.realowner = attacker;
if(self.health <= 0)
_nade.toss_time = time;
_nade.solid = SOLID_CORPSE; //((_nade.nade_type == NADE_TYPE_TRANSLOCATE) ? SOLID_CORPSE : SOLID_BBOX);
- if(_nade.nade_type == NADE_TYPE_TRANSLOCATE || _nade.nade_type == NADE_TYPE_SPAWN)
+ if(_nade.nade_type == NADE_TYPE_TRANSLOCATE.m_id || _nade.nade_type == NADE_TYPE_SPAWN.m_id)
_nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
else
_nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
{
//self.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
if(!self.traileffectnum)
- self.traileffectnum = particleeffectnum(Nade_TrailEffect(Nade_ProjectileFromID(self.nade_type, false), self.team));
+ self.traileffectnum = particleeffectnum(Nade_TrailEffect(NADES[self.nade_type].m_projectile[false], self.team));
self.alpha = 1;
}
n.pokenade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
}
- n.nade_type = bound(1, n.nade_type, NADE_TYPE_LAST);
+ n.nade_type = bound(1, n.nade_type, NADES_COUNT);
setmodel(n, "models/weapons/v_ok_grenade.md3");
//setattachment(n, self, "bip01 l hand");
n.exteriormodeltoclient = self;
n.customizeentityforclient = nade_customize;
- n.traileffectnum = particleeffectnum(Nade_TrailEffect(Nade_ProjectileFromID(n.nade_type, false), self.team));
- n.colormod = Nade_Color(n.nade_type);
+ n.traileffectnum = particleeffectnum(Nade_TrailEffect(NADES[n.nade_type].m_projectile[false], self.team));
+ n.colormod = NADES[n.nade_type].m_color;
n.realowner = self;
n.colormap = self.colormap;
n.glowmod = self.glowmod;
setmodel(fn, "models/weapons/h_ok_grenade.iqm");
setattachment(fn, self.weaponentity, "");
fn.realowner = fn.owner = self;
- fn.colormod = Nade_Color(n.nade_type);
+ fn.colormod = NADES[n.nade_type].m_color;
fn.colormap = self.colormap;
fn.glowmod = self.glowmod;
fn.think = SUB_Remove;
self.pokenade_type = autocvar_g_nades_pokenade_monster_type;
}
- self.nade_type = bound(1, self.nade_type, NADE_TYPE_LAST);
+ self.nade_type = bound(1, self.nade_type, NADES_COUNT);
if(self.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max)
nades_GiveBonus(self, time_score / autocvar_g_nades_bonus_score_max);
{
Unfreeze(frag_target);
frag_target.health = autocvar_g_freezetag_revive_nade_health;
- pointparticles(particleeffectnum("iceorglass"), frag_target.origin, '0 0 0', 3);
+ Send_Effect("iceorglass", frag_target.origin, '0 0 0', 3);
frag_damage = 0;
frag_force = '0 0 0';
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVED_NADE, frag_target.netname);