if(e.frozen)
return false;
if(!IS_PLAYER(e))
- return ((e.flags & FL_MONSTER) && e.health < e.max_health);
+ return (IS_MONSTER(e) && e.health < e.max_health);
if(e.items & IT_INVINCIBLE)
return false;
//if(trace_ent != targ)
//return false;
- if(targ.vehicle_flags & VHF_ISVEHICLE)
+ if(IS_VEHICLE(targ))
if(!((get_monsterinfo(ent.monsterid)).spawnflags & MON_FLAG_RANGED))
return false; // melee attacks are useless against vehicles
if(IS_SPEC(targ) || IS_OBSERVER(targ))
return false; // enemy is a spectator
- if(!(targ.vehicle_flags & VHF_ISVEHICLE))
+ if(!IS_VEHICLE(targ))
if(targ.deadflag != DEAD_NO || ent.deadflag != DEAD_NO || targ.health <= 0 || ent.health <= 0)
return false; // enemy/self is dead
if(targ.monster_owner == ent)
return false; // don't attack our pet
- if(!(targ.vehicle_flags & VHF_ISVEHICLE))
+ if(!IS_VEHICLE(targ))
if(targ.flags & FL_NOTARGET)
return false; // enemy can't be targeted
return;
if(self.enemy != other)
- if(!(other.flags & FL_MONSTER))
+ if(!IS_MONSTER(other))
if(monster_isvalidtarget(other, self))
self.enemy = other;
}
#ifdef SVQC
if (!other.iscreature)
return;
- if (other.vehicle_flags & VHF_ISVEHICLE)
+ if(IS_VEHICLE(other))
return;
#endif
#ifdef CSQC
if(!other.vehicle.teleportable)
return;
- if(other.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
+ if(IS_TURRET(other))
return;
if(other.deadflag != DEAD_NO)
new_dir = WarpZone_TransformVelocity(WarpZone_trace_transform, new_dir);
float is_player = (
- trace_ent.classname == "player"
+ IS_PLAYER(trace_ent)
||
trace_ent.classname == "body"
||
- (trace_ent.flags & FL_MONSTER)
+ IS_MONSTER(trace_ent)
);
if(trace_ent && trace_ent.takedamage && (is_player || WEP_CVAR(arc, beam_nonplayerdamage)))
te_customflash(targpos, 40, 2, '1 1 1');
#endif
- is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || (trace_ent.flags & FL_MONSTER));
+ is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || IS_MONSTER(trace_ent));
if((trace_fraction < 1) // if trace is good, apply the damage and remove self if necessary
&& (trace_ent.takedamage == DAMAGE_AIM)
//te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5);
//te_customflash(targpos, 40, 2, '1 1 1');
- is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || (trace_ent.flags & FL_MONSTER));
+ is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || IS_MONSTER(trace_ent));
if((trace_fraction < 1) // if trace is good, apply the damage and remove self
&& (trace_ent.takedamage == DAMAGE_AIM)
WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 100, MOVE_NORMAL, self);
if(!autocvar_g_monsters_edit) { sprint(self, "Monster property editing is not enabled.\n"); return; }
- if(trace_ent.flags & FL_MONSTER)
+ if(IS_MONSTER(trace_ent))
{
if(trace_ent.realowner != self) { sprint(self, "That monster does not belong to you.\n"); return; }
switch(argv(1))
makevectors(self.v_angle);
WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 100, MOVE_NORMAL, self);
- if(trace_ent.flags & FL_MONSTER)
+ if(IS_MONSTER(trace_ent))
{
if(trace_ent.realowner != self)
{
void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypoint)
{
- if(!IS_PLAYER(targ) && !(targ.flags & FL_MONSTER)) // only specified entities can be freezed
+ if(!IS_PLAYER(targ) && !IS_MONSTER(targ)) // only specified entities can be freezed
return;
if(targ.frozen)
return;
- float targ_maxhealth = ((targ.flags & FL_MONSTER) ? targ.max_health : start_health);
+ float targ_maxhealth = ((IS_MONSTER(targ)) ? targ.max_health : start_health);
targ.frozen = frozen_type;
targ.revive_progress = ((frozen_type == 3) ? 1 : 0);
if(targ != attacker)
{
entity victim;
- if((targ.vehicle_flags & VHF_ISVEHICLE) && targ.owner)
+ if(IS_VEHICLE(targ) && targ.owner)
victim = targ.owner;
else
victim = targ;
- if(IS_PLAYER(victim) || (victim.turrcaps_flags & TFL_TURRCAPS_ISTURRET) || (victim.flags & FL_MONSTER))
+ if(IS_PLAYER(victim) || IS_TURRET(victim) || IS_MONSTER(victim))
{
if(DIFF_TEAM(victim, attacker) && !victim.frozen)
{
#define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
#define IS_NOT_A_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
+#define IS_MONSTER(v) (v.flags & FL_MONSTER)
+#define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
+#define IS_TURRET(v) (v.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
+
#define FOR_EACH_CLIENTSLOT(v) for(v = world; (v = nextent(v)) && (num_for_edict(v) <= maxclients); )
#define FOR_EACH_CLIENT(v) FOR_EACH_CLIENTSLOT(v) if(IS_CLIENT(v))
#define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if(IS_REAL_CLIENT(v))
void ctf_Handle_Return(entity flag, entity player)
{
// messages and sounds
- if(player.flags & FL_MONSTER)
+ if(IS_MONSTER(player))
{
Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(flag, INFO_CTF_RETURN_MONSTER_), player.monster_name);
}
if(trace_dphitcontents & (DPCONTENTS_PLAYERCLIP | DPCONTENTS_MONSTERCLIP)) { return; }
entity toucher = other, tmp_entity;
- bool is_not_monster = (!(toucher.flags & FL_MONSTER)), num_perteam = 0;
+ bool is_not_monster = (!IS_MONSTER(toucher)), num_perteam = 0;
// automatically kill the flag and return it if it touched lava/slime/nodrop surfaces
if(ITEM_TOUCH_NEEDKILL())
// special touch behaviors
if(toucher.frozen) { return; }
- else if(toucher.vehicle_flags & VHF_ISVEHICLE)
+ else if(IS_VEHICLE(toucher))
{
if(autocvar_g_ctf_allow_vehicle_touch && toucher.owner)
toucher = toucher.owner; // the player is actually the vehicle owner, not other
else
return; // do nothing
}
- else if(toucher.flags & FL_MONSTER)
+ else if(IS_MONSTER(toucher))
{
if(!autocvar_g_ctf_allow_monster_touch)
return; // do nothing
MUTATOR_HOOKFUNCTION(invasion_BotShouldAttack)
{
- if(!(checkentity.flags & FL_MONSTER))
+ if(!IS_MONSTER(checkentity))
return true;
return false;
MUTATOR_HOOKFUNCTION(invasion_AccuracyTargetValid)
{
- if(frag_target.flags & FL_MONSTER)
+ if(IS_MONSTER(frag_target))
return MUT_ACCADD_INVALID;
return MUT_ACCADD_INDIFFERENT;
}
if(DEATH_WEAPONOF(frag_deathtype) != WEP_ARC)
if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype))
if(frag_target.deadflag == DEAD_NO)
- if(IS_PLAYER(frag_target) || (frag_target.flags & FL_MONSTER))
+ if(IS_PLAYER(frag_target) || IS_MONSTER(frag_target))
if(frag_attacker != frag_target)
if(!frag_target.frozen)
if(frag_target.takedamage)
{
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 )
}
- 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;
}
entity oldself = self;
entity targ = ((frag_attacker) ? frag_attacker : frag_target);
- if(self.flags & FL_MONSTER)
+ if(IS_MONSTER(self))
{
remove(other); // remove default item
other = world;
{
if (self.movetype == MOVETYPE_NOCLIP) { continue; }
- float vehic = (self.vehicle_flags & VHF_ISVEHICLE);
+ float vehic = IS_VEHICLE(self);
float projectile = (self.flags & FL_PROJECTILE);
- float monster = (self.flags & FL_MONSTER);
+ float monster = IS_MONSTER(self);
if (self.watertype <= CONTENT_WATER && self.waterlevel > 0) // workaround a retarded bug made by id software :P (yes, it's that old of a bug)
{
return -5;
// Cant touch this
- if(e_target.vehicle_flags & VHF_ISVEHICLE)
+ if(IS_VEHICLE(e_target))
{
if (e_target.vehicle_health <= 0)
return -6;
e = nextent(world);
while (e)
{
- if (e.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
+ if(IS_TURRET(e))
{
load_unit_settings(e,e.cvar_basename,1);
if(e.turret_postthink)
if((teamplay && trace_ent.team == pilot.team) || !teamplay)
{
- if(trace_ent.vehicle_flags & VHF_ISVEHICLE)
+ if(IS_VEHICLE(trace_ent))
{
if(autocvar_g_vehicle_bumblebee_healgun_sps && trace_ent.vehicle_health <= trace_ent.tur_health)
trace_ent.vehicle_shield = min(trace_ent.vehicle_shield + autocvar_g_vehicle_bumblebee_healgun_sps * frametime, trace_ent.tur_head.tur_health);
trace_ent.health = min(trace_ent.health + autocvar_g_vehicle_bumblebee_healgun_hps * frametime, autocvar_g_vehicle_bumblebee_healgun_hmax);
}
- else if(trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
+ else if(IS_TURRET(trace_ent))
{
if(trace_ent.health <= trace_ent.tur_health && autocvar_g_vehicle_bumblebee_healgun_hps)
trace_ent.health = min(trace_ent.health + autocvar_g_vehicle_bumblebee_healgun_hps * frametime, trace_ent.tur_health);
if(trace_ent.deadflag != DEAD_NO)
trace_ent = world;
if(!(
- (trace_ent.vehicle_flags & VHF_ISVEHICLE) ||
- (trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET) ||
+ IS_VEHICLE(trace_ent) ||
+ IS_TURRET(trace_ent) ||
(trace_ent.takedamage == DAMAGE_TARGETDRONE)
)) { trace_ent = world; }
}
if(IS_PLAYER(e))
return true;
- if(e.flags & FL_MONSTER)
+ if(IS_MONSTER(e))
return true;
return false;
org = player.origin + player.view_ofs;
traceline_antilag_force(player, org, org + screenforward * MAX_SHOT_DISTANCE, MOVE_NORMAL, player, lag);
- if(IS_CLIENT(trace_ent) || (trace_ent.flags & FL_MONSTER))
+ if(IS_CLIENT(trace_ent) || IS_MONSTER(trace_ent))
{
antilag_takeback(trace_ent, time - lag);
hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);