// score rule declarations
const int ST_ONS_CAPS = 1;
-const int SP_ONS_CAPS = 4;
-const int SP_ONS_TAKES = 6;
#endif
#endif
// CaptureShield Functions
// =======================
-bool ons_CaptureShield_Customize(entity this)
+bool ons_CaptureShield_Customize(entity this, entity client)
{
- entity e = WaypointSprite_getviewentity(other);
+ entity e = WaypointSprite_getviewentity(client);
if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, e.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return false; }
if(SAME_TEAM(this, e)) { return false; }
return true;
}
-void ons_CaptureShield_Touch(entity this)
+void ons_CaptureShield_Touch(entity this, entity toucher)
{
- if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, other.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return; }
- if(!IS_PLAYER(other)) { return; }
- if(SAME_TEAM(other, this)) { return; }
+ if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, toucher.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return; }
+ if(!IS_PLAYER(toucher)) { return; }
+ if(SAME_TEAM(toucher, this)) { return; }
vector mymid = (this.absmin + this.absmax) * 0.5;
- vector othermid = (other.absmin + other.absmax) * 0.5;
+ vector theirmid = (toucher.absmin + toucher.absmax) * 0.5;
- Damage(other, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(othermid - mymid) * ons_captureshield_force);
+ Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(theirmid - mymid) * ons_captureshield_force);
- if(IS_REAL_CLIENT(other))
+ if(IS_REAL_CLIENT(toucher))
{
- play2(other, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
+ play2(toucher, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
if(this.enemy.classname == "onslaught_generator")
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED);
+ Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED);
else
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED);
+ Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED);
}
}
settouch(shield, ons_CaptureShield_Touch);
setcefc(shield, ons_CaptureShield_Customize);
shield.effects = EF_ADDITIVE;
- shield.movetype = MOVETYPE_NOCLIP;
+ set_movetype(shield, MOVETYPE_NOCLIP);
shield.solid = SOLID_TRIGGER;
shield.avelocity = '7 0 11';
shield.scale = 1;
{
entity l;
// first check if the game has ended
- LOG_DEBUG("--- updatelinks ---\n");
+ LOG_DEBUG("--- updatelinks ---");
// mark generators as being shielded and networked
for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
{
if (l.iscaptured)
- LOG_DEBUG(strcat(etos(l), " (generator) belongs to team ", ftos(l.team), "\n"));
+ LOG_DEBUG(etos(l), " (generator) belongs to team ", ftos(l.team));
else
- LOG_DEBUG(strcat(etos(l), " (generator) is destroyed\n"));
+ LOG_DEBUG(etos(l), " (generator) is destroyed");
l.islinked = l.iscaptured;
l.isshielded = l.iscaptured;
l.sprite.SendFlags |= 16;
l.isshielded = true;
int i;
for(i = 0; i < 17; ++i) { l.isgenneighbor[i] = false; l.iscpneighbor[i] = false; }
- LOG_DEBUG(strcat(etos(l), " (point) belongs to team ", ftos(l.team), "\n"));
+ LOG_DEBUG(etos(l), " (point) belongs to team ", ftos(l.team));
l.sprite.SendFlags |= 16;
}
// flow power outward from the generators through the network
{
stop = false;
l.goalentity.islinked = true;
- LOG_DEBUG(strcat(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)\n"));
+ LOG_DEBUG(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)");
}
else if (!l.enemy.islinked)
{
stop = false;
l.enemy.islinked = true;
- LOG_DEBUG(strcat(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)\n"));
+ LOG_DEBUG(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)");
}
}
}
{
if(DIFF_TEAM(l.goalentity, l.enemy))
{
- LOG_DEBUG(strcat(etos(l), " (link) is unshielding ", etos(l.enemy), " (point) because its team does not match ", etos(l.goalentity), " (point)\n"));
+ LOG_DEBUG(etos(l), " (link) is unshielding ", etos(l.enemy), " (point) because its team does not match ", etos(l.goalentity), " (point)");
l.enemy.isshielded = false;
}
if(l.goalentity.classname == "onslaught_generator")
{
if(DIFF_TEAM(l.goalentity, l.enemy))
{
- LOG_DEBUG(strcat(etos(l), " (link) is unshielding ", etos(l.goalentity), " (point) because its team does not match ", etos(l.enemy), " (point)\n"));
+ LOG_DEBUG(etos(l), " (link) is unshielding ", etos(l.goalentity), " (point) because its team does not match ", etos(l.enemy), " (point)");
l.goalentity.isshielded = false;
}
if(l.enemy.classname == "onslaught_generator")
{
if (l.isshielded)
{
- LOG_DEBUG(strcat(etos(l), " (generator) is shielded\n"));
+ LOG_DEBUG(etos(l), " (generator) is shielded");
l.takedamage = DAMAGE_NO;
l.bot_attack = false;
}
else
{
- LOG_DEBUG(strcat(etos(l), " (generator) is not shielded\n"));
+ LOG_DEBUG(etos(l), " (generator) is not shielded");
l.takedamage = DAMAGE_AIM;
l.bot_attack = true;
}
{
if (l.isshielded)
{
- LOG_DEBUG(strcat(etos(l), " (point) is shielded\n"));
+ LOG_DEBUG(etos(l), " (point) is shielded");
if (l.goalentity)
{
l.goalentity.takedamage = DAMAGE_NO;
}
else
{
- LOG_DEBUG(strcat(etos(l), " (point) is not shielded\n"));
+ LOG_DEBUG(etos(l), " (point) is not shielded");
if (l.goalentity)
{
l.goalentity.takedamage = DAMAGE_AIM;
}
ons_ControlPoint_UpdateSprite(l);
}
- l = findchain(classname, "ons_captureshield");
- while(l)
+ FOREACH_ENTITY_CLASS("ons_captureshield", true,
{
- l.team = l.enemy.team;
- l.colormap = l.enemy.colormap;
- l = l.chain;
- }
+ it.team = it.enemy.team;
+ it.colormap = it.enemy.colormap;
+ });
}
void ons_DelayedLinkSetup(entity this)
{
- this.goalentity = find(world, targetname, this.target);
- this.enemy = find(world, targetname, this.target2);
+ this.goalentity = find(NULL, targetname, this.target);
+ this.enemy = find(NULL, targetname, this.target2);
if(!this.goalentity) { objerror(this, "can not find target\n"); }
if(!this.enemy) { objerror(this, "can not find target2\n"); }
- LOG_DEBUG(strcat(etos(this.goalentity), " linked with ", etos(this.enemy), "\n"));
+ LOG_DEBUG(etos(this.goalentity), " linked with ", etos(this.enemy));
this.SendFlags |= 3;
setthink(this, ons_Link_CheckUpdate);
this.nextthink = time;
{
sound(this, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_CPDESTROYED), this.owner.message, attacker.netname);
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_CPDESTROYED), this.owner.message, attacker.netname);
PlayerScore_Add(attacker, SP_ONS_TAKES, 1);
PlayerScore_Add(attacker, SP_SCORE, 10);
- this.owner.goalentity = world;
+ this.owner.goalentity = NULL;
this.owner.islinked = false;
this.owner.iscaptured = false;
this.owner.team = 0;
setmodel_fixsize(this.owner, MDL_ONS_CP_PAD1);
//setsize(this, '-32 -32 0', '32 32 8');
- remove(this);
+ delete(this);
}
this.SendFlags |= CPSF_STATUS;
if(IS_PLAYER(this.owner.ons_toucher))
{
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ONSLAUGHT_CAPTURE, this.owner.ons_toucher.netname, this.owner.message);
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ONSLAUGHT_CAPTURE, this.owner.ons_toucher.netname, this.owner.message);
Send_Notification(NOTIF_ALL_EXCEPT, this.owner.ons_toucher, MSG_CENTER, APP_TEAM_NUM(this.owner.ons_toucher.team, CENTER_ONS_CAPTURE), this.owner.message);
Send_Notification(NOTIF_ONE, this.owner.ons_toucher, MSG_CENTER, CENTER_ONS_CAPTURE, this.owner.message);
PlayerScore_Add(this.owner.ons_toucher, SP_ONS_CAPS, 1);
PlayerTeamScore_AddScore(this.owner.ons_toucher, 10);
}
- this.owner.ons_toucher = world;
+ this.owner.ons_toucher = NULL;
onslaught_updatelinks();
}
}
-void ons_ControlPoint_Touch(entity this)
+void ons_ControlPoint_Touch(entity this, entity toucher)
{
- entity toucher = other;
int attackable;
if(IS_VEHICLE(toucher) && toucher.owner)
void ons_ControlPoint_Reset(entity this)
{
if(this.goalentity)
- remove(this.goalentity);
+ delete(this.goalentity);
- this.goalentity = world;
+ this.goalentity = NULL;
this.team = 0;
this.colormap = 1024;
this.iscaptured = false;
this.islinked = false;
this.isshielded = true;
setthink(this, ons_ControlPoint_Think);
- this.ons_toucher = world;
+ this.ons_toucher = NULL;
this.nextthink = time + ONS_CP_THINKRATE;
setmodel_fixsize(this, MDL_ONS_CP_PAD1);
cp.netname = "Control point";
cp.team = 0;
cp.solid = SOLID_BBOX;
- cp.movetype = MOVETYPE_NONE;
+ set_movetype(cp, MOVETYPE_NONE);
settouch(cp, ons_ControlPoint_Touch);
setthink(cp, ons_ControlPoint_Think);
cp.nextthink = time + ONS_CP_THINKRATE;
if((cp.spawnflags & 1) || cp.noalign) // don't drop to floor, just stay at fixed location
{
cp.noalign = true;
- cp.movetype = MOVETYPE_NONE;
+ set_movetype(cp, MOVETYPE_NONE);
}
else // drop to floor, automatically find a platform and set that as spawn origin
{
setorigin(cp, cp.origin + '0 0 20');
cp.noalign = false;
droptofloor(cp);
- cp.movetype = MOVETYPE_TOSS;
+ set_movetype(cp, MOVETYPE_TOSS);
}
// waypointsprites
else
{
if (attacker == this)
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME));
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME));
else
{
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED));
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED));
PlayerScore_Add(attacker, SP_SCORE, 100);
}
this.iscaptured = false;
}
-void onslaught_generator_touch(entity this)
+void onslaught_generator_touch(entity this, entity toucher)
{
- if ( IS_PLAYER(other) )
- if ( SAME_TEAM(this,other) )
+ if ( IS_PLAYER(toucher) )
+ if ( SAME_TEAM(this,toucher) )
if ( this.iscaptured )
{
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_TELEPORT);
+ Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT);
}
}
gen.classname = "onslaught_generator";
gen.solid = SOLID_BBOX;
gen.team_saved = teamnumber;
- gen.movetype = MOVETYPE_NONE;
+ set_movetype(gen, MOVETYPE_NONE);
gen.lasthealth = gen.max_health = gen.health = autocvar_g_onslaught_gen_health;
gen.takedamage = DAMAGE_AIM;
gen.bot_attack = true;
if (!wpforenemy_announced)
{
- Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT);
- sound(world, CH_INFO, SND_ONS_GENERATOR_DECAY, VOL_BASE, ATTEN_NONE);
+ Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT);
+ sound(NULL, CH_INFO, SND_ONS_GENERATOR_DECAY, VOL_BASE, ATTEN_NONE);
wpforenemy_announced = true;
}
if(winner_team > 0)
{
- Send_Notification(NOTIF_ALL, world, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_WIN));
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_ROUND_TEAM_WIN));
+ Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_WIN));
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_ROUND_TEAM_WIN));
TeamScore_AddToTeam(winner_team, ST_ONS_CAPS, +1);
}
else if(winner_team == -1)
{
- Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_TIED);
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_TIED);
+ Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_TIED);
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_TIED);
}
ons_stalemate = false;
void havocbot_goalrating_ons_offenseitems(entity this, float ratingscale, vector org, float sradius)
{
- entity head;
- float t, c;
bool needarmor = false, needweapons = false;
// Needs armor/health?
needarmor = true;
// Needs weapons?
- c = 0;
+ int c = 0;
FOREACH(Weapons, it != WEP_Null, {
if(this.weapons & (it.m_wepset))
if(++c >= 4)
if(!needweapons && !needarmor)
return;
- LOG_DEBUG(strcat(this.netname, " needs weapons ", ftos(needweapons) , "\n"));
- LOG_DEBUG(strcat(this.netname, " needs armor ", ftos(needarmor) , "\n"));
+ LOG_DEBUG(this.netname, " needs weapons ", ftos(needweapons));
+ LOG_DEBUG(this.netname, " needs armor ", ftos(needarmor));
// See what is around
- head = findchainfloat(bot_pickup, true);
- while (head)
+ FOREACH_ENTITY_FLOAT(bot_pickup, true,
{
// gather health and armor only
- if (head.solid)
- if ( ((head.health || head.armorvalue) && needarmor) || (head.weapons && needweapons ) )
- if (vlen(head.origin - org) < sradius)
+ if (it.solid)
+ if ( ((it.health || it.armorvalue) && needarmor) || (it.weapons && needweapons ) )
+ if (vdist(it.origin - org, <, sradius))
{
- t = head.bot_pickupevalfunc(this, head);
+ int t = it.bot_pickupevalfunc(this, it);
if (t > 0)
- navigation_routerating(this, head, t * ratingscale, 500);
+ navigation_routerating(this, it, t * ratingscale, 500);
}
- head = head.chain;
- }
+ });
}
void havocbot_role_ons_setrole(entity this, int role)
{
- LOG_DEBUG(strcat(this.netname," switched to "));
+ LOG_DEBUG(this.netname," switched to ");
switch(role)
{
case HAVOCBOT_ONS_ROLE_DEFENSE:
this.havocbot_role_timeout = 0;
break;
}
- LOG_DEBUG("\n");
+ LOG_DEBUG("");
}
void havocbot_goalrating_ons_controlpoints_attack(entity this, float ratingscale)
// We'll consider only the best case
bestvalue = 99999999999;
- cp = world;
+ cp = NULL;
for(cp1 = ons_worldcplist; cp1; cp1 = cp1.ons_worldcpnext)
{
if (!cp1.wpconsidered)
if (!cp)
return;
- LOG_DEBUG(strcat(this.netname, " chose cp ranked ", ftos(bestvalue), "\n"));
+ LOG_DEBUG(this.netname, " chose cp ranked ", ftos(bestvalue));
if(cp.goalentity)
{
// Should be attacked
// Rate waypoints near it
found = false;
- best = world;
+ best = NULL;
bestvalue = 99999999999;
for(radius=0; radius<1000 && !found; radius+=500)
{
{
navigation_routerating(this, cp, ratingscale, 10000);
}
- LOG_DEBUG(strcat(this.netname, " found an attackable controlpoint at ", vtos(cp.origin) ,"\n"));
+ LOG_DEBUG(this.netname, " found an attackable controlpoint at ", vtos(cp.origin));
}
else
{
// Should be touched
- LOG_DEBUG(strcat(this.netname, " found a touchable controlpoint at ", vtos(cp.origin) ,"\n"));
+ LOG_DEBUG(this.netname, " found a touchable controlpoint at ", vtos(cp.origin));
found = false;
// Look for auto generated waypoint
// Should be attacked
// Rate waypoints near it
found = false;
- bestwp = world;
+ bestwp = NULL;
best = 99999999999;
for(wp=findradius(g.origin,400); wp; wp=wp.chain)
if(bestwp)
{
- LOG_DEBUG("waypoints found around generator\n");
+ LOG_DEBUG("waypoints found around generator");
navigation_routerating(this, bestwp, ratingscale, 10000);
bestwp.cnt += 1;
}
else
{
- LOG_DEBUG("generator found without waypoints around\n");
+ LOG_DEBUG("generator found without waypoints around");
// if there aren't waypoints near the generator go straight to it
navigation_routerating(this, g, ratingscale, 10000);
this.havocbot_attack_time = 0;
if(IS_DEAD(this))
return;
- this.havocbot_ons_target = world;
+ this.havocbot_ons_target = NULL;
// TODO: Defend control points or generator if necessary
*/
entity ons_Nearest_ControlPoint(entity this, vector pos, float max_dist)
{
- entity tmp_entity, closest_target = world;
- tmp_entity = findchain(classname, "onslaught_controlpoint");
- while(tmp_entity)
+ entity closest_target = NULL;
+ FOREACH_ENTITY_CLASS("onslaught_controlpoint", true,
{
- if(SAME_TEAM(tmp_entity, this))
- if(tmp_entity.iscaptured)
- if(max_dist <= 0 || vdist(tmp_entity.origin - pos, <=, max_dist))
- if(vlen2(tmp_entity.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == world)
- closest_target = tmp_entity;
- tmp_entity = tmp_entity.chain;
- }
- tmp_entity = findchain(classname, "onslaught_generator");
- while(tmp_entity)
+ if(SAME_TEAM(it, this))
+ if(it.iscaptured)
+ if(max_dist <= 0 || vdist(it.origin - pos, <=, max_dist))
+ if(vlen2(it.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == NULL)
+ closest_target = it;
+ });
+ FOREACH_ENTITY_CLASS("onslaught_generator", true,
{
- if(SAME_TEAM(tmp_entity, this))
- if(max_dist <= 0 || vdist(tmp_entity.origin - pos, <, max_dist))
- if(vlen2(tmp_entity.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == world)
- closest_target = tmp_entity;
- tmp_entity = tmp_entity.chain;
- }
+ if(SAME_TEAM(it, this))
+ if(max_dist <= 0 || vdist(it.origin - pos, <, max_dist))
+ if(vlen2(it.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == NULL)
+ closest_target = it;
+ });
return closest_target;
}
*/
entity ons_Nearest_ControlPoint_2D(entity this, vector pos, float max_dist)
{
- entity tmp_entity, closest_target = world;
+ entity closest_target = NULL;
vector delta;
float smallest_distance = 0, distance;
- tmp_entity = findchain(classname, "onslaught_controlpoint");
- while(tmp_entity)
+ FOREACH_ENTITY_CLASS("onslaught_controlpoint", true,
{
- delta = tmp_entity.origin - pos;
+ delta = it.origin - pos;
delta_z = 0;
distance = vlen(delta);
- if(SAME_TEAM(tmp_entity, this))
- if(tmp_entity.iscaptured)
+ if(SAME_TEAM(it, this))
+ if(it.iscaptured)
if(max_dist <= 0 || distance <= max_dist)
- if(closest_target == world || distance <= smallest_distance )
+ if(closest_target == NULL || distance <= smallest_distance )
{
- closest_target = tmp_entity;
+ closest_target = it;
smallest_distance = distance;
}
-
- tmp_entity = tmp_entity.chain;
- }
- tmp_entity = findchain(classname, "onslaught_generator");
- while(tmp_entity)
+ });
+ FOREACH_ENTITY_CLASS("onslaught_generator", true,
{
- delta = tmp_entity.origin - pos;
+ delta = it.origin - pos;
delta_z = 0;
distance = vlen(delta);
- if(SAME_TEAM(tmp_entity, this))
+ if(SAME_TEAM(it, this))
if(max_dist <= 0 || distance <= max_dist)
- if(closest_target == world || distance <= smallest_distance )
+ if(closest_target == NULL || distance <= smallest_distance )
{
- closest_target = tmp_entity;
+ closest_target = it;
smallest_distance = distance;
}
-
- tmp_entity = tmp_entity.chain;
- }
+ });
return closest_target;
}
*/
int ons_Count_SelfControlPoints(entity this)
{
- entity tmp_entity;
- tmp_entity = findchain(classname, "onslaught_controlpoint");
int n = 0;
- while(tmp_entity)
+ FOREACH_ENTITY_CLASS("onslaught_controlpoint", true,
{
- if(SAME_TEAM(tmp_entity, this))
- if(tmp_entity.iscaptured)
+ if(SAME_TEAM(it, this))
+ if(it.iscaptured)
n++;
- tmp_entity = tmp_entity.chain;
- }
- tmp_entity = findchain(classname, "onslaught_generator");
- while(tmp_entity)
+ });
+ FOREACH_ENTITY_CLASS("onslaught_generator", true,
{
- if(SAME_TEAM(tmp_entity, this))
+ if(SAME_TEAM(it, this))
n++;
- tmp_entity = tmp_entity.chain;
- }
+ });
return n;
}
tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
if(trace_fraction == 1.0 && !trace_startsolid)
{
- traceline(tele_target.origin, loc, MOVE_NOMONSTERS, tele_target); // double check to make sure we're not spawning outside the world
+ traceline(tele_target.origin, loc, MOVE_NOMONSTERS, tele_target); // double check to make sure we're not spawning outside the NULL
if(trace_fraction == 1.0 && !trace_startsolid)
{
if ( tele_effects )
FOREACH_CLIENT(IS_PLAYER(it), {
it.ons_roundlost = false;
it.ons_deathloc = '0 0 0';
- WITHSELF(it, PutClientInServer());
+ PutClientInServer(it);
});
return false;
}
if ( player.ons_spawn_by )
if ( ons_Teleport(player,player.ons_spawn_by,autocvar_g_onslaught_teleport_radius,false) )
{
- player.ons_spawn_by = world;
+ player.ons_spawn_by = NULL;
return false;
}
if(random() <= autocvar_g_onslaught_spawn_at_controlpoints_chance)
{
float random_target = autocvar_g_onslaught_spawn_at_controlpoints_random;
- entity tmp_entity, closest_target = world;
+ entity tmp_entity, closest_target = NULL;
vector spawn_loc = player.ons_deathloc;
// new joining player or round reset, don't bother checking
if(SAME_TEAM(tmp_entity, player))
if(random_target)
RandomSelection_Add(tmp_entity, 0, string_null, 1, 1);
- else if(vlen(tmp_entity.origin - spawn_loc) <= vlen(closest_target.origin - spawn_loc) || closest_target == world)
+ else if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL)
closest_target = tmp_entity;
}
tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
if(trace_fraction == 1.0 && !trace_startsolid)
{
- traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the world
+ traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the NULL
if(trace_fraction == 1.0 && !trace_startsolid)
{
setorigin(player, loc);
if(random() <= autocvar_g_onslaught_spawn_at_generator_chance)
{
float random_target = autocvar_g_onslaught_spawn_at_generator_random;
- entity tmp_entity, closest_target = world;
+ entity tmp_entity, closest_target = NULL;
vector spawn_loc = player.ons_deathloc;
// new joining player or round reset, don't bother checking
else
{
if(SAME_TEAM(tmp_entity, player))
- if(vlen(tmp_entity.origin - spawn_loc) <= vlen(closest_target.origin - spawn_loc) || closest_target == world)
+ if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == NULL)
closest_target = tmp_entity;
}
}
tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, player);
if(trace_fraction == 1.0 && !trace_startsolid)
{
- traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the world
+ traceline(closest_target.origin, loc, MOVE_NOMONSTERS, closest_target); // double check to make sure we're not spawning outside the NULL
if(trace_fraction == 1.0 && !trace_startsolid)
{
setorigin(player, loc);
{
entity mon = M_ARGV(0, entity);
- entity e = find(world, targetname, mon.target);
- if (e != world)
+ entity e = find(NULL, targetname, mon.target);
+ if (e != NULL)
mon.team = e.team;
}
{
entity own = this.owner;
- if(!own) { remove(this); return; }
+ if(!own) { delete(this); return; }
if(own.targetname)
{
- entity e = find(world, target, own.targetname);
- if(e != world)
+ entity e = find(NULL, target, own.targetname);
+ if(e != NULL)
{
own.team = e.team;
}
}
- remove(this);
+ delete(this);
}
MUTATOR_HOOKFUNCTION(ons, MonsterSpawn)
{
entity own = this.owner;
- if(!own) { remove(this); return; }
+ if(!own) { delete(this); return; }
if(own.targetname)
{
- entity e = find(world, target, own.targetname);
- if(e != world)
+ entity e = find(NULL, target, own.targetname);
+ if(e != NULL)
{
own.team = e.team;
own.active = ACTIVE_NOT;
}
}
- remove(this);
+ delete(this);
}
MUTATOR_HOOKFUNCTION(ons, TurretSpawn)
entity closest_target = ons_Nearest_ControlPoint_2D(player, pos, autocvar_g_onslaught_click_radius);
- if ( closest_target == world )
+ if ( closest_target == NULL )
{
sprint(player, "\nNo control point found\n");
return true;
// ONS uses somewhat backwards linking.
if(turret.target)
{
- entity e = find(world, targetname, turret.target);
- if (e != world)
+ entity e = find(NULL, targetname, turret.target);
+ if (e != NULL)
turret.team = e.team;
}
*/
spawnfunc(onslaught_link)
{
- if(!g_onslaught) { remove(this); return; }
+ if(!g_onslaught) { delete(this); return; }
if (this.target == "" || this.target2 == "")
objerror(this, "target and target2 must be set\n");
spawnfunc(onslaught_controlpoint)
{
- if(!g_onslaught) { remove(this); return; }
+ if(!g_onslaught) { delete(this); return; }
ons_ControlPoint_Setup(this);
}
*/
spawnfunc(onslaught_generator)
{
- if(!g_onslaught) { remove(this); return; }
+ if(!g_onslaught) { delete(this); return; }
if(!this.team) { objerror(this, "team must be set"); }
ons_GeneratorSetup(this);
// scoreboard setup
void ons_ScoreRules()
{
- CheckAllowedTeams(world);
- ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), SFL_SORT_PRIO_PRIMARY, 0, true);
+ CheckAllowedTeams(NULL);
+ int teams = 0;
+ if(c1 >= 0) teams |= BIT(0);
+ if(c2 >= 0) teams |= BIT(1);
+ if(c3 >= 0) teams |= BIT(2);
+ if(c4 >= 0) teams |= BIT(3);
+ ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
ScoreInfo_SetLabel_TeamScore (ST_ONS_CAPS, "destroyed", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore(SP_ONS_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
+ ScoreInfo_SetLabel_PlayerScore(SP_ONS_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
ScoreInfo_SetLabel_PlayerScore(SP_ONS_TAKES, "takes", 0);
ScoreRules_basics_end();
}
g_onslaught = true;
ons_captureshield_force = autocvar_g_onslaught_shield_force;
- InitializeEntity(world, ons_DelayedInit, INITPRIO_GAMETYPE);
+ InitializeEntity(NULL, ons_DelayedInit, INITPRIO_GAMETYPE);
}
#endif