MUTATOR_HOOKFUNCTION(nb, PlayerSpawn)
{
- SELFPARAM();
- this.metertime = 0;
+ entity player = M_ARGV(0, entity);
+
+ player.metertime = 0;
.entity weaponentity = weaponentities[0];
- this.(weaponentity).weapons = '0 0 0';
+ player.(weaponentity).weapons = '0 0 0';
if (nexball_mode & NBM_BASKETBALL)
- this.weapons |= WEPSET(NEXBALL);
+ player.weapons |= WEPSET(NEXBALL);
else
- this.weapons = '0 0 0';
+ player.weapons = '0 0 0';
return false;
}
}
MUTATOR_HOOKFUNCTION(ons, PlayerSpawn)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+
if(!round_handler_IsRoundStarted())
{
- self.player_blocked = true;
+ player.player_blocked = true;
return false;
}
l.sprite.SendFlags |= 16;
}
- if(ons_stalemate) { Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); }
+ if(ons_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); }
if ( autocvar_g_onslaught_spawn_choose )
- if ( self.ons_spawn_by )
- if ( ons_Teleport(self,self.ons_spawn_by,autocvar_g_onslaught_teleport_radius,false) )
+ if ( player.ons_spawn_by )
+ if ( ons_Teleport(player,player.ons_spawn_by,autocvar_g_onslaught_teleport_radius,false) )
{
- self.ons_spawn_by = world;
+ player.ons_spawn_by = world;
return false;
}
{
float random_target = autocvar_g_onslaught_spawn_at_controlpoints_random;
entity tmp_entity, closest_target = world;
- vector spawn_loc = self.ons_deathloc;
+ vector spawn_loc = player.ons_deathloc;
// new joining player or round reset, don't bother checking
if(spawn_loc == '0 0 0') { return false; }
for(tmp_entity = ons_worldcplist; tmp_entity; tmp_entity = tmp_entity.ons_worldcpnext)
{
- if(SAME_TEAM(tmp_entity, self))
+ 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)
iteration_scale -= i / 10;
loc = closest_target.origin + '0 0 96' * iteration_scale;
loc += ('0 1 0' * random()) * 128 * iteration_scale;
- tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, self);
+ 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
if(trace_fraction == 1.0 && !trace_startsolid)
{
- setorigin(self, loc);
- self.angles = normalize(loc - closest_target.origin) * RAD2DEG;
+ setorigin(player, loc);
+ player.angles = normalize(loc - closest_target.origin) * RAD2DEG;
return false;
}
}
{
float random_target = autocvar_g_onslaught_spawn_at_generator_random;
entity tmp_entity, closest_target = world;
- vector spawn_loc = self.ons_deathloc;
+ vector spawn_loc = player.ons_deathloc;
// new joining player or round reset, don't bother checking
if(spawn_loc == '0 0 0') { return false; }
RandomSelection_Add(tmp_entity, 0, string_null, 1, 1);
else
{
- if(SAME_TEAM(tmp_entity, self))
+ if(SAME_TEAM(tmp_entity, player))
if(vlen(tmp_entity.origin - spawn_loc) <= vlen(closest_target.origin - spawn_loc) || closest_target == world)
closest_target = tmp_entity;
}
iteration_scale -= i / 10;
loc = closest_target.origin + '0 0 128' * iteration_scale;
loc += ('0 1 0' * random()) * 256 * iteration_scale;
- tracebox(loc, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), loc, MOVE_NORMAL, self);
+ 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
if(trace_fraction == 1.0 && !trace_startsolid)
{
- setorigin(self, loc);
- self.angles = normalize(loc - closest_target.origin) * RAD2DEG;
+ setorigin(player, loc);
+ player.angles = normalize(loc - closest_target.origin) * RAD2DEG;
return false;
}
}
MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn)
{
- SELFPARAM();
- self.spider_slowness = 0;
+ entity player = M_ARGV(0, entity);
+
+ player.spider_slowness = 0;
return false;
}
return false;
}
-MUTATOR_HOOKFUNCTION(buffs,PlayerSpawn)
-{SELFPARAM();
- self.buffs = 0;
+MUTATOR_HOOKFUNCTION(buffs, PlayerSpawn)
+{
+ entity player = M_ARGV(0, entity);
+
+ player.buffs = 0;
// reset timers here to prevent them continuing after re-spawn
- self.buff_disability_time = 0;
- self.buff_disability_effect_time = 0;
+ player.buff_disability_time = 0;
+ player.buff_disability_effect_time = 0;
return false;
}
}
MUTATOR_HOOKFUNCTION(campcheck, PlayerSpawn)
-{SELFPARAM();
- self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
- self.campcheck_traveled_distance = 0;
+{
+ entity player = M_ARGV(0, entity);
- return false;
+ player.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
+ player.campcheck_traveled_distance = 0;
}
MUTATOR_HOOKFUNCTION(campcheck, BuildMutatorsString)
MUTATOR_HOOKFUNCTION(hook, PlayerSpawn)
{
- SELFPARAM();
- self.offhand = OFFHAND_HOOK;
+ entity player = M_ARGV(0, entity);
+
+ player.offhand = OFFHAND_HOOK;
}
MUTATOR_HOOKFUNCTION(hook, FilterItem)
}
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerSpawn)
-{SELFPARAM();
- self.effects |= EF_FULLBRIGHT;
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ player.effects |= EF_FULLBRIGHT;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPreThink)
}
MUTATOR_HOOKFUNCTION(itemstime, PlayerSpawn)
-{SELFPARAM();
+{
if (warmup_stage) return;
- Item_ItemsTime_ResetTimesForPlayer(self);
+ entity player = M_ARGV(0, entity);
+
+ Item_ItemsTime_ResetTimesForPlayer(player);
}
#endif
}
MUTATOR_HOOKFUNCTION(midair, PlayerSpawn)
-{SELFPARAM();
- if(IS_BOT_CLIENT(self))
- self.bot_moveskill = 0; // disable bunnyhopping
+{
+ entity player = M_ARGV(0, entity);
+
+ if(IS_BOT_CLIENT(player))
+ player.bot_moveskill = 0; // disable bunnyhopping
return false;
}
MUTATOR_HOOKFUNCTION(nades, PutClientInServer)
{
- SELFPARAM();
- nades_RemoveBonus(self);
+ entity player = M_ARGV(0, entity);
+
+ nades_RemoveBonus(player);
}
float nade_customize(entity this)
}
MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+
if(autocvar_g_nades_spawn)
- self.nade_refire = time + autocvar_g_spawnshieldtime;
+ player.nade_refire = time + autocvar_g_spawnshieldtime;
else
- self.nade_refire = time + autocvar_g_nades_nade_refire;
+ player.nade_refire = time + autocvar_g_nades_nade_refire;
if(autocvar_g_nades_bonus_client_select)
- self.nade_type = self.cvar_cl_nade_type;
+ player.nade_type = player.cvar_cl_nade_type;
- self.nade_timer = 0;
+ player.nade_timer = 0;
- if (!self.offhand) self.offhand = OFFHAND_NADE;
+ if (!player.offhand) player.offhand = OFFHAND_NADE;
- if(self.nade_spawnloc)
+ if(player.nade_spawnloc)
{
- setorigin(self, self.nade_spawnloc.origin);
- self.nade_spawnloc.cnt -= 1;
+ setorigin(player, player.nade_spawnloc.origin);
+ player.nade_spawnloc.cnt -= 1;
- if(self.nade_spawnloc.cnt <= 0)
+ if(player.nade_spawnloc.cnt <= 0)
{
- remove(self.nade_spawnloc);
- self.nade_spawnloc = world;
+ remove(player.nade_spawnloc);
+ player.nade_spawnloc = world;
}
}
});
}
- return 0;
+ return false;
}
bool NIX_CanChooseWeapon(int wpn)
nix_nextweapon = RandomSelection_chosen_float;
}
-void NIX_GiveCurrentWeapon()
-{SELFPARAM();
+void NIX_GiveCurrentWeapon(entity this)
+{
float dt;
if(!nix_nextweapon)
if(nix_nextchange != self.nix_lastchange_id) // this shall only be called once per round!
{
- self.ammo_shells = self.ammo_nails = self.ammo_rockets = self.ammo_cells = self.ammo_plasma = self.ammo_fuel = 0;
+ this.ammo_shells = this.ammo_nails = this.ammo_rockets = this.ammo_cells = this.ammo_plasma = this.ammo_fuel = 0;
- if(self.items & IT_UNLIMITED_WEAPON_AMMO)
+ if(this.items & IT_UNLIMITED_WEAPON_AMMO)
{
switch(e.ammo_field)
{
- case ammo_shells: self.ammo_shells = autocvar_g_pickup_shells_max; break;
- case ammo_nails: self.ammo_nails = autocvar_g_pickup_nails_max; break;
- case ammo_rockets: self.ammo_rockets = autocvar_g_pickup_rockets_max; break;
- case ammo_cells: self.ammo_cells = autocvar_g_pickup_cells_max; break;
- case ammo_plasma: self.ammo_plasma = autocvar_g_pickup_plasma_max; break;
- case ammo_fuel: self.ammo_fuel = autocvar_g_pickup_fuel_max; break;
+ case ammo_shells: this.ammo_shells = autocvar_g_pickup_shells_max; break;
+ case ammo_nails: this.ammo_nails = autocvar_g_pickup_nails_max; break;
+ case ammo_rockets: this.ammo_rockets = autocvar_g_pickup_rockets_max; break;
+ case ammo_cells: this.ammo_cells = autocvar_g_pickup_cells_max; break;
+ case ammo_plasma: this.ammo_plasma = autocvar_g_pickup_plasma_max; break;
+ case ammo_fuel: this.ammo_fuel = autocvar_g_pickup_fuel_max; break;
}
}
else
{
switch(e.ammo_field)
{
- case ammo_shells: self.ammo_shells = autocvar_g_balance_nix_ammo_shells; break;
- case ammo_nails: self.ammo_nails = autocvar_g_balance_nix_ammo_nails; break;
- case ammo_rockets: self.ammo_rockets = autocvar_g_balance_nix_ammo_rockets; break;
- case ammo_cells: self.ammo_cells = autocvar_g_balance_nix_ammo_cells; break;
- case ammo_plasma: self.ammo_plasma = autocvar_g_balance_nix_ammo_plasma; break;
- case ammo_fuel: self.ammo_fuel = autocvar_g_balance_nix_ammo_fuel; break;
+ case ammo_shells: this.ammo_shells = autocvar_g_balance_nix_ammo_shells; break;
+ case ammo_nails: this.ammo_nails = autocvar_g_balance_nix_ammo_nails; break;
+ case ammo_rockets: this.ammo_rockets = autocvar_g_balance_nix_ammo_rockets; break;
+ case ammo_cells: this.ammo_cells = autocvar_g_balance_nix_ammo_cells; break;
+ case ammo_plasma: this.ammo_plasma = autocvar_g_balance_nix_ammo_plasma; break;
+ case ammo_fuel: this.ammo_fuel = autocvar_g_balance_nix_ammo_fuel; break;
}
}
- self.nix_nextincr = time + autocvar_g_balance_nix_incrtime;
+ this.nix_nextincr = time + autocvar_g_balance_nix_incrtime;
if(dt >= 1 && dt <= 5)
- self.nix_lastinfotime = -42;
+ this.nix_lastinfotime = -42;
else
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
- e.wr_resetplayer(e, self);
+ WITHSELF(this, e.wr_resetplayer(e, this));
// all weapons must be fully loaded when we spawn
if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
- self.(weapon_load[nix_weapon]) = e.reloading_ammo;
+ this.(weapon_load[nix_weapon]) = e.reloading_ammo;
// vortex too
if(WEP_CVAR(vortex, charge))
{
if(WEP_CVAR_SEC(vortex, chargepool))
- self.vortex_chargepool_ammo = 1;
- self.vortex_charge = WEP_CVAR(vortex, charge_start);
+ this.vortex_chargepool_ammo = 1;
+ this.vortex_charge = WEP_CVAR(vortex, charge_start);
}
// set last change info
- self.nix_lastchange_id = nix_nextchange;
+ this.nix_lastchange_id = nix_nextchange;
}
- if(self.nix_lastinfotime != dt)
+ if(this.nix_lastinfotime != dt)
{
- self.nix_lastinfotime = dt; // initial value 0 should count as "not seen"
+ this.nix_lastinfotime = dt; // initial value 0 should count as "not seen"
if(dt >= 1 && dt <= 5)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_COUNTDOWN, nix_nextweapon, dt);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_NIX_COUNTDOWN, nix_nextweapon, dt);
}
- if(!(self.items & IT_UNLIMITED_WEAPON_AMMO) && time > self.nix_nextincr)
+ if(!(this.items & IT_UNLIMITED_WEAPON_AMMO) && time > this.nix_nextincr)
{
switch(e.ammo_field)
{
- case ammo_shells: self.ammo_shells += autocvar_g_balance_nix_ammoincr_shells; break;
- case ammo_nails: self.ammo_nails += autocvar_g_balance_nix_ammoincr_nails; break;
- case ammo_rockets: self.ammo_rockets += autocvar_g_balance_nix_ammoincr_rockets; break;
- case ammo_cells: self.ammo_cells += autocvar_g_balance_nix_ammoincr_cells; break;
- case ammo_plasma: self.ammo_plasma += autocvar_g_balance_nix_ammoincr_plasma; break;
- case ammo_fuel: self.ammo_fuel += autocvar_g_balance_nix_ammoincr_fuel; break;
+ case ammo_shells: this.ammo_shells += autocvar_g_balance_nix_ammoincr_shells; break;
+ case ammo_nails: this.ammo_nails += autocvar_g_balance_nix_ammoincr_nails; break;
+ case ammo_rockets: this.ammo_rockets += autocvar_g_balance_nix_ammoincr_rockets; break;
+ case ammo_cells: this.ammo_cells += autocvar_g_balance_nix_ammoincr_cells; break;
+ case ammo_plasma: this.ammo_plasma += autocvar_g_balance_nix_ammoincr_plasma; break;
+ case ammo_fuel: this.ammo_fuel += autocvar_g_balance_nix_ammoincr_fuel; break;
}
- self.nix_nextincr = time + autocvar_g_balance_nix_incrtime;
+ this.nix_nextincr = time + autocvar_g_balance_nix_incrtime;
}
- self.weapons = '0 0 0';
+ this.weapons = '0 0 0';
if(g_nix_with_blaster)
- self.weapons |= WEPSET(BLASTER);
- self.weapons |= e.m_wepset;
+ this.weapons |= WEPSET(BLASTER);
+ this.weapons |= e.m_wepset;
Weapon w = Weapons_from(nix_weapon);
- if(PS(self).m_switchweapon != w)
- if(!client_hasweapon(self, PS(self).m_switchweapon, true, false))
+ if(PS(this).m_switchweapon != w)
+ if(!client_hasweapon(this, PS(this).m_switchweapon, true, false))
{
- if(client_hasweapon(self, w, true, false))
- W_SwitchWeapon(self, w);
+ if(client_hasweapon(this, w, true, false))
+ W_SwitchWeapon(this, w);
}
}
MUTATOR_HOOKFUNCTION(nix, ForbidThrowCurrentWeapon)
{
- return 1; // no throwing in NIX
+ return true; // no throwing in NIX
}
MUTATOR_HOOKFUNCTION(nix, BuildMutatorsString)
{
ret_string = strcat(ret_string, ":NIX");
- return 0;
+ return false;
}
MUTATOR_HOOKFUNCTION(nix, BuildMutatorsPrettyString)
{
ret_string = strcat(ret_string, ", NIX");
- return 0;
+ return false;
}
MUTATOR_HOOKFUNCTION(nix, FilterItem)
case ITEM_ArmorLarge.m_itemid:
case ITEM_ArmorMega.m_itemid:
if (autocvar_g_nix_with_healtharmor)
- return 0;
+ return false;
break;
case ITEM_Strength.m_itemid:
case ITEM_Shield.m_itemid:
if (autocvar_g_nix_with_powerups)
- return 0;
+ return false;
break;
}
- return 1; // delete all other items
+ return true; // delete all other items
}
MUTATOR_HOOKFUNCTION(nix, OnEntityPreSpawn)
{SELFPARAM();
if(self.classname == "target_items") // items triggers cannot work in nix (as they change weapons/ammo)
- return 1;
- return 0;
+ return true;
+ return false;
}
MUTATOR_HOOKFUNCTION(nix, PlayerPreThink)
if(!intermission_running)
if(!IS_DEAD(self))
if(IS_PLAYER(self))
- NIX_GiveCurrentWeapon();
- return 0;
+ NIX_GiveCurrentWeapon(this);
+ return false;
}
MUTATOR_HOOKFUNCTION(nix, PlayerSpawn)
-{SELFPARAM();
- self.nix_lastchange_id = -1;
- NIX_GiveCurrentWeapon(); // overrides the weapons you got when spawning
- self.items |= IT_UNLIMITED_SUPERWEAPONS;
- return 0;
+{
+ entity player = M_ARGV(0, entity);
+
+ player.nix_lastchange_id = -1;
+ NIX_GiveCurrentWeapon(player); // overrides the weapons you got when spawning
+ player.items |= IT_UNLIMITED_SUPERWEAPONS;
+ return false;
}
MUTATOR_HOOKFUNCTION(nix, SetModname, CBC_ORDER_LAST)
{
modname = "NIX";
- return 0;
+ return false;
}
#endif
}
MUTATOR_HOOKFUNCTION(ok, PlayerSpawn)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+
if(autocvar_g_overkill_ammo_charge)
{
- FOREACH(Weapons, it != WEP_Null, LAMBDA(self.ammo_charge[it.m_id] = autocvar_g_overkill_ammo_charge_limit));
+ FOREACH(Weapons, it != WEP_Null, LAMBDA(player.ammo_charge[it.m_id] = autocvar_g_overkill_ammo_charge_limit));
- self.ok_use_ammocharge = 1;
- self.ok_notice_time = time;
+ player.ok_use_ammocharge = 1;
+ player.ok_notice_time = time;
}
else
- self.ok_use_ammocharge = 0;
+ player.ok_use_ammocharge = 0;
// if player changed their weapon while dead, don't switch to their death weapon
- if(self.impulse)
- self.ok_lastwep = 0;
+ if(player.impulse)
+ player.ok_lastwep = 0;
- self.ok_pauseregen_finished = time + 2;
+ player.ok_pauseregen_finished = time + 2;
return false;
}
MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score)
{SELFPARAM();
if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && self.cvar_cl_spawn_near_teammate))
- return 0;
+ return false;
spawn_spot.msnt_lookat = world;
if(!teamplay)
- return 0;
+ return false;
RandomSelection_Init();
FOREACH_CLIENT(IS_PLAYER(it) && it != self && SAME_TEAM(it, self) && !IS_DEAD(it), LAMBDA(
else if(self.team == spawn_spot.team)
spawn_score.x += SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM; // prefer same team, if we can't find a spawn near teammate
- return 0;
+ return false;
}
MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
-{SELFPARAM();
+{
if(!teamplay) { return false; }
+ entity player = M_ARGV(0, entity);
int num_red = 0, num_blue = 0, num_yellow = 0, num_pink = 0;
FOREACH_CLIENT(IS_PLAYER(it),
return false; // at least 1 team has only 1 player, let's not give the bigger team too much of an advantage!
// Note: when entering this, fixangle is already set.
- if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && self.cvar_cl_spawn_near_teammate))
+ if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && player.cvar_cl_spawn_near_teammate))
{
if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death)
- self.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
+ player.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
entity best_mate = world;
vector best_spot = '0 0 0';
if((autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health >= 0 && it.health >= autocvar_g_balance_health_regenstable) || autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health == 0)
if(!IS_DEAD(it))
if(it.msnt_timer < time)
- if(SAME_TEAM(self, it))
+ if(SAME_TEAM(player, it))
if(time > it.spawnshieldtime) // spawn shielding
if(STAT(FROZEN, it) == 0)
- if(it != self)
+ if(it != player)
{
tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - '0 0 100', MOVE_NOMONSTERS, it);
if(trace_fraction != 1.0)
{
if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath)
{
- dist = vlen(trace_endpos - self.msnt_deathloc);
+ dist = vlen(trace_endpos - player.msnt_deathloc);
if(dist < best_dist || best_dist == 0)
{
best_dist = dist;
}
else
{
- setorigin(self, trace_endpos);
- self.angles = it.angles;
- self.angles_z = 0; // never spawn tilted even if the spot says to
+ setorigin(player, trace_endpos);
+ player.angles = it.angles;
+ player.angles_z = 0; // never spawn tilted even if the spot says to
it.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
- return 0;
+ return false;
}
}
}
if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath)
if(best_dist)
{
- setorigin(self, best_spot);
- self.angles = best_mate.angles;
- self.angles_z = 0; // never spawn tilted even if the spot says to
+ setorigin(player, best_spot);
+ player.angles = best_mate.angles;
+ player.angles_z = 0; // never spawn tilted even if the spot says to
best_mate.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
}
}
else if(spawn_spot.msnt_lookat)
{
- self.angles = vectoangles(spawn_spot.msnt_lookat.origin - self.origin);
- self.angles_x = -self.angles.x;
- self.angles_z = 0; // never spawn tilted even if the spot says to
+ player.angles = vectoangles(spawn_spot.msnt_lookat.origin - player.origin);
+ player.angles_x = -player.angles.x;
+ player.angles_z = 0; // never spawn tilted even if the spot says to
/*
- sprint(self, "You should be looking at ", spawn_spot.msnt_lookat.netname, "^7.\n");
- sprint(self, "distance: ", vtos(spawn_spot.msnt_lookat.origin - self.origin), "\n");
- sprint(self, "angles: ", vtos(self.angles), "\n");
+ sprint(player, "You should be looking at ", spawn_spot.msnt_lookat.netname, "^7.\n");
+ sprint(player, "distance: ", vtos(spawn_spot.msnt_lookat.origin - player.origin), "\n");
+ sprint(player, "angles: ", vtos(player.angles), "\n");
*/
}
- return 0;
+ return false;
}
MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerDies)
{
frag_target.msnt_deathloc = frag_target.origin;
- return 0;
+ return false;
}
REPLICATE(cvar_cl_spawn_near_teammate, bool, "cl_spawn_near_teammate");
// WEAPONTODO: rename the cvars
REGISTER_MUTATOR(weaponarena_random, true);
-MUTATOR_HOOKFUNCTION(weaponarena_random, PlayerSpawn) {
- SELFPARAM();
+MUTATOR_HOOKFUNCTION(weaponarena_random, PlayerSpawn)
+{
if (!g_weaponarena_random) return;
- if (g_weaponarena_random_with_blaster) this.weapons &= ~WEPSET(BLASTER);
- W_RandomWeapons(this, g_weaponarena_random);
- if (g_weaponarena_random_with_blaster) this.weapons |= WEPSET(BLASTER);
+ entity player = M_ARGV(0, entity);
+
+ if (g_weaponarena_random_with_blaster) player.weapons &= ~WEPSET(BLASTER);
+ W_RandomWeapons(player, g_weaponarena_random);
+ if (g_weaponarena_random_with_blaster) player.weapons |= WEPSET(BLASTER);
}
#endif
Unfreeze(this);
- MUTATOR_CALLHOOK(PlayerSpawn, spot);
+ MUTATOR_CALLHOOK(PlayerSpawn, this, spot);
if (autocvar_spawn_debug)
{
/** */
#define EV_PutClientInServer(i, o) \
- /** client wanting to spawn */ i(entity, __self) \
+ /** client wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer);
/** called when a player spawns as player, after shared setup, before his weapon is chosen (so items may be changed in here) */
#define EV_PlayerSpawn(i, o) \
- /** spot that was used, or world */ i(entity, spawn_spot) \
+ /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** spot that was used, or world */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
-entity spawn_spot;
MUTATOR_HOOKABLE(PlayerSpawn, EV_PlayerSpawn);
/** called in reset_map */
/** _x is priority, _y is "distance" */ i(vector, spawn_score) \
/**/ o(vector, spawn_score) \
/**/
+entity spawn_spot;
vector spawn_score;
MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
// mutator hooks
MUTATOR_HOOKFUNCTION(as, PlayerSpawn)
-{SELFPARAM();
- if(self.team == assault_attacker_team)
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_ATTACKING);
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.team == assault_attacker_team)
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_ASSAULT_ATTACKING);
else
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_DEFENDING);
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_ASSAULT_DEFENDING);
return false;
}
MUTATOR_HOOKFUNCTION(ca, PlayerSpawn)
{
- SELFPARAM();
- this.caplayer = 1;
+ entity player = M_ARGV(0, entity);
+
+ player.caplayer = 1;
if (!warmup_stage)
eliminatedPlayers.SendFlags |= 1;
}
MUTATOR_HOOKFUNCTION(ca, PutClientInServer)
{
- SELFPARAM();
- if (!allowed_to_spawn && IS_PLAYER(this)) // this is true even when player is trying to join
+ entity player = M_ARGV(0, entity);
+
+ if (!allowed_to_spawn && IS_PLAYER(player)) // this is true even when player is trying to join
{
- TRANSMUTE(Observer, this);
- if (this.jointime != time && !this.caplayer) // not when connecting
+ TRANSMUTE(Observer, player);
+ if (player.jointime != time && !player.caplayer) // not when connecting
{
- this.caplayer = 0.5;
- Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CA_JOIN_LATE);
+ player.caplayer = 0.5;
+ Send_Notification(NOTIF_ONE_ONLY, player, MSG_INFO, INFO_CA_JOIN_LATE);
}
}
}
}
MUTATOR_HOOKFUNCTION(cts, PlayerSpawn)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+ entity spawn_spot = M_ARGV(1, entity);
+
if(spawn_spot.target == "")
// Emergency: this wasn't a real spawnpoint. Can this ever happen?
- race_PreparePlayer(this);
+ race_PreparePlayer(player);
// if we need to respawn, do it right
- self.race_respawn_checkpoint = self.race_checkpoint;
- self.race_respawn_spotref = spawn_spot;
+ player.race_respawn_checkpoint = player.race_checkpoint;
+ player.race_respawn_spotref = spawn_spot;
- self.race_place = 0;
+ player.race_place = 0;
return false;
}
MUTATOR_HOOKFUNCTION(cts, PutClientInServer)
-{SELFPARAM();
- if(IS_PLAYER(self))
+{
+ entity player = M_ARGV(0, entity);
+
+ if(IS_PLAYER(player))
if(!gameover)
{
- if(self.killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
- race_PreparePlayer(this);
+ if(player.killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
+ race_PreparePlayer(player);
else // respawn
- race_RetractPlayer(this);
+ race_RetractPlayer(player);
- race_AbandonRaceCheck(self);
+ race_AbandonRaceCheck(player);
}
return false;
}
}
MUTATOR_HOOKFUNCTION(dom, PlayerSpawn)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+
if(domination_roundbased)
if(!round_handler_IsRoundStarted())
- self.player_blocked = 1;
+ player.player_blocked = 1;
else
- self.player_blocked = 0;
+ player.player_blocked = 0;
return false;
}
}
MUTATOR_HOOKFUNCTION(ft, PlayerSpawn)
-{SELFPARAM();
- if(self.freezetag_frozen_timeout == -1) // if PlayerSpawn is called by reset_map_players
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.freezetag_frozen_timeout == -1) // if PlayerSpawn is called by reset_map_players
return 1; // do nothing, round is starting right now
- if(self.freezetag_frozen_timeout == -2) // player was dead
+ if(player.freezetag_frozen_timeout == -2) // player was dead
{
- freezetag_Freeze(world);
+ WITHSELF(player, freezetag_Freeze(world));
return 1;
}
if(round_handler_IsActive())
if(round_handler_IsRoundStarted())
{
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_FREEZETAG_SPAWN_LATE);
- freezetag_Freeze(world);
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_SPAWN_LATE);
+ WITHSELF(player, freezetag_Freeze(world));
}
return 1;
}
MUTATOR_HOOKFUNCTION(inv, PlayerSpawn)
-{SELFPARAM();
- self.bot_attack = false;
+{
+ entity player = M_ARGV(0, entity);
+
+ player.bot_attack = false;
return false;
}
}
MUTATOR_HOOKFUNCTION(lms, PutClientInServer)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+
// player is dead and becomes observer
// FIXME fix LMS scoring for new system
- if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
+ if(PlayerScore_Add(player, SP_LMS_RANK, 0) > 0)
{
- TRANSMUTE(Observer, self);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_LMS_NOLIVES);
+ TRANSMUTE(Observer, player);
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_LMS_NOLIVES);
}
}
}
MUTATOR_HOOKFUNCTION(rc, PlayerSpawn)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+ entity spawn_spot = M_ARGV(1, entity);
+
if(spawn_spot.target == "")
// Emergency: this wasn't a real spawnpoint. Can this ever happen?
- race_PreparePlayer(this);
+ race_PreparePlayer(player);
// if we need to respawn, do it right
- self.race_respawn_checkpoint = self.race_checkpoint;
- self.race_respawn_spotref = spawn_spot;
+ player.race_respawn_checkpoint = player.race_checkpoint;
+ player.race_respawn_spotref = spawn_spot;
- self.race_place = 0;
+ player.race_place = 0;
return false;
}
MUTATOR_HOOKFUNCTION(rc, PutClientInServer)
-{SELFPARAM();
- if(IS_PLAYER(self))
+{
+ entity player = M_ARGV(0, entity);
+
+ if(IS_PLAYER(player))
if(!gameover)
{
- if(self.killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
- race_PreparePlayer(this);
+ if(player.killcount == FRAGS_SPECTATOR /* initial spawn */ || g_race_qualifying) // spawn
+ race_PreparePlayer(player);
else // respawn
- race_RetractPlayer(this);
+ race_RetractPlayer(player);
- race_AbandonRaceCheck(self);
+ race_AbandonRaceCheck(player);
}
return false;
}