REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"))
{
- SELFPARAM();
MUTATOR_ONADD
{
g_nix_with_blaster = autocvar_g_nix_with_blaster;
it.ammo_fuel = start_ammo_fuel;
it.weapons = start_weapons;
if(!client_hasweapon(it, PS(it).m_weapon, true, false))
- PS(it).m_switchweapon = w_getbestweapon(self);
+ PS(it).m_switchweapon = w_getbestweapon(it);
});
}
RandomSelection_Init();
FOREACH(Weapons, it != WEP_Null, LAMBDA(
if(NIX_CanChooseWeapon(it.m_id))
- RandomSelection_Add(world, it.m_id, string_null, 1, (it.m_id != nix_weapon));
+ RandomSelection_Add(NULL, it.m_id, string_null, 1, (it.m_id != nix_weapon));
));
nix_nextweapon = RandomSelection_chosen_float;
}
// get weapon info
entity e = Weapons_from(nix_weapon);
- if(nix_nextchange != self.nix_lastchange_id) // this shall only be called once per round!
+ if(nix_nextchange != this.nix_lastchange_id) // this shall only be called once per round!
{
this.ammo_shells = this.ammo_nails = this.ammo_rockets = this.ammo_cells = this.ammo_plasma = this.ammo_fuel = 0;
else
Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
- WITHSELF(this, e.wr_resetplayer(e, 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
if(ent.classname == "target_items") // items triggers cannot work in nix (as they change weapons/ammo)
return true;
- return false;
}
MUTATOR_HOOKFUNCTION(nix, PlayerPreThink)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+
if(!intermission_running)
- if(!IS_DEAD(self))
- if(IS_PLAYER(self))
- NIX_GiveCurrentWeapon(this);
- return false;
+ if(!IS_DEAD(player))
+ if(IS_PLAYER(player))
+ NIX_GiveCurrentWeapon(player);
}
MUTATOR_HOOKFUNCTION(nix, PlayerSpawn)
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)
{
M_ARGV(0, string) = "NIX";
- return false;
}
#endif