}
MUTATOR_HOOKFUNCTION(ons, HavocBot_ChooseRole)
-{SELFPARAM();
- havocbot_ons_reset_role(self);
+{
+ entity bot = M_ARGV(0, entity);
+
+ havocbot_ons_reset_role(bot);
return true;
}
#define EV_NO_ARGS(i, o)
#pragma noref 1
-string ret_string;
#define MUTATOR_TYPES(_, x) \
_(x, bool) \
#pragma noref 0
-/** appends ":mutatorname" to ret_string for logging */
+/** appends ":mutatorname" to argument for logging */
#define EV_BuildMutatorsString(i, o) \
- /**/ i(string, ret_string) \
- /**/ o(string, ret_string) \
+ /** mutator string */ i(string, MUTATOR_ARGV_0_string) \
+ /**/ o(string, MUTATOR_ARGV_0_string) \
/**/
MUTATOR_HOOKABLE(BuildMutatorsString, EV_BuildMutatorsString);
/** appends ", Mutator name" to ret_string for display */
#define EV_BuildMutatorsPrettyString(i, o) \
- /**/ i(string, ret_string) \
- /**/ o(string, ret_string) \
+ /** mutator string */ i(string, MUTATOR_ARGV_0_string) \
+ /**/ o(string, MUTATOR_ARGV_0_string) \
/**/
MUTATOR_HOOKABLE(BuildMutatorsPrettyString, EV_BuildMutatorsPrettyString);
/** appends mutator string for displaying extra gameplay tips */
#define EV_BuildGameplayTipsString(i, o) \
- /**/ i(string, ret_string) \
- /**/ o(string, ret_string) \
+ /** tips string */ i(string, MUTATOR_ARGV_0_string) \
+ /**/ o(string, MUTATOR_ARGV_0_string) \
/**/
MUTATOR_HOOKABLE(BuildGameplayTipsString, EV_BuildGameplayTipsString);
MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":bloodloss");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":bloodloss");
}
MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Blood loss");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Blood loss");
}
#endif
MUTATOR_HOOKFUNCTION(buffs, VehicleEnter)
{
- vh_vehicle.buffs = vh_player.buffs;
- vh_player.buffs = 0;
- vh_vehicle.buff_time = max(0, vh_player.buff_time - time);
- vh_player.buff_time = 0;
- return false;
+ entity player = M_ARGV(0, entity);
+ entity veh = M_ARGV(1, entity);
+
+ veh.buffs = player.buffs;
+ player.buffs = 0;
+ veh.buff_time = max(0, player.buff_time - time);
+ player.buff_time = 0;
}
MUTATOR_HOOKFUNCTION(buffs, VehicleExit)
{
- vh_player.buffs = vh_player.oldbuffs = vh_vehicle.buffs;
- vh_vehicle.buffs = 0;
- vh_player.buff_time = time + vh_vehicle.buff_time;
- vh_vehicle.buff_time = 0;
- return false;
+ entity player = M_ARGV(0, entity);
+ entity veh = M_ARGV(1, entity);
+
+ player.buffs = player.oldbuffs = veh.buffs;
+ veh.buffs = 0;
+ player.buff_time = time + veh.buff_time;
+ veh.buff_time = 0;
}
MUTATOR_HOOKFUNCTION(buffs, PlayerRegen)
MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":Buffs");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Buffs");
}
MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Buffs");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Buffs");
}
void buffs_DelayedInit(entity this)
MUTATOR_HOOKFUNCTION(bugrigs, ClientConnect)
{
- SELFPARAM();
- stuffcmd(self, "cl_cmd settemp chase_active 1\n");
- return false;
+ entity player = M_ARGV(0, entity);
+
+ stuffcmd(player, "cl_cmd settemp chase_active 1\n");
}
MUTATOR_HOOKFUNCTION(bugrigs, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":bugrigs");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":bugrigs");
}
MUTATOR_HOOKFUNCTION(bugrigs, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Bug rigs");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Bug rigs");
}
#endif
MUTATOR_HOOKFUNCTION(campcheck, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":CampCheck");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":CampCheck");;
}
#endif
MUTATOR_HOOKFUNCTION(cloaked, BuildMutatorsPrettyString)
{
- if (!g_cts) ret_string = strcat(ret_string, ", Cloaked");
+ if (!g_cts) M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Cloaked");
}
#endif
MUTATOR_HOOKFUNCTION(hook, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":grappling_hook");
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":grappling_hook");
}
MUTATOR_HOOKFUNCTION(hook, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Hook");
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Hook");
}
MUTATOR_HOOKFUNCTION(hook, BuildGameplayTipsString)
{
- ret_string = strcat(ret_string, "\n\n^3grappling hook^8 is enabled, press 'e' to use it\n");
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3grappling hook^8 is enabled, press 'e' to use it\n");
}
MUTATOR_HOOKFUNCTION(hook, PlayerSpawn)
MUTATOR_HOOKFUNCTION(mutator_instagib, BotShouldAttack)
{
- if (checkentity.items & ITEM_Invisibility.m_itemid)
+ entity targ = M_ARGV(1, entity);
+
+ if (targ.items & ITEM_Invisibility.m_itemid)
return true;
return false;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, ItemTouch)
-{SELFPARAM();
- if(self.ammo_cells)
+{
+ entity item = M_ARGV(0, entity);
+ entity toucher = M_ARGV(1, entity);
+
+ if(item.ammo_cells)
{
// play some cool sounds ;)
- if (IS_CLIENT(other))
+ if (IS_CLIENT(toucher))
{
- if(other.health <= 5)
- Send_Notification(NOTIF_ONE, other, MSG_ANNCE, ANNCE_INSTAGIB_LASTSECOND);
- else if(other.health < 50)
- Send_Notification(NOTIF_ONE, other, MSG_ANNCE, ANNCE_INSTAGIB_NARROWLY);
+ if(toucher.health <= 5)
+ Send_Notification(NOTIF_ONE, toucher, MSG_ANNCE, ANNCE_INSTAGIB_LASTSECOND);
+ else if(toucher.health < 50)
+ Send_Notification(NOTIF_ONE, toucher, MSG_ANNCE, ANNCE_INSTAGIB_NARROWLY);
}
- if(other.health < 100)
- other.health = 100;
+ if(toucher.health < 100)
+ toucher.health = 100;
return MUT_ITEMTOUCH_CONTINUE;
}
- if(self.itemdef == ITEM_ExtraLife)
+ if(item.itemdef == ITEM_ExtraLife)
{
- other.armorvalue = bound(other.armorvalue, 999, other.armorvalue + autocvar_g_instagib_extralives);
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_EXTRALIVES);
+ toucher.armorvalue = bound(toucher.armorvalue, 999, toucher.armorvalue + autocvar_g_instagib_extralives);
+ Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_EXTRALIVES);
return MUT_ITEMTOUCH_PICKUP;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":instagib");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":instagib");
}
MUTATOR_HOOKFUNCTION(mutator_instagib, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", instagib");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", instagib");
}
MUTATOR_HOOKFUNCTION(mutator_instagib, SetModname)
{
- modname = "InstaGib";
+ M_ARGV(0, string) = "InstaGib";
return true;
}
MUTATOR_HOOKFUNCTION(invincibleprojectiles, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":InvincibleProjectiles");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":InvincibleProjectiles");
}
MUTATOR_HOOKFUNCTION(invincibleprojectiles, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Invincible Projectiles");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Invincible Projectiles");
}
#endif
}
MUTATOR_HOOKFUNCTION(itemstime, ClientConnect, CBC_ORDER_LAST)
-{SELFPARAM();
- if(IS_PLAYER(self))
+{
+ entity player = M_ARGV(0, entity);
+
+ if(IS_PLAYER(player))
{
// client became player on connection skipping putObserverInServer step
- if (IS_REAL_CLIENT(self))
+ if (IS_REAL_CLIENT(player))
if (warmup_stage)
- Item_ItemsTime_SetTimesForPlayer(self);
+ Item_ItemsTime_SetTimesForPlayer(player);
}
}
MUTATOR_HOOKFUNCTION(melee_only, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":MeleeOnly");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":MeleeOnly");
}
MUTATOR_HOOKFUNCTION(melee_only, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Melee Only Arena");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Melee Only Arena");
}
#endif
if(IS_PLAYER(frag_attacker))
if(IS_PLAYER(frag_target))
if(time < frag_target.midair_shieldtime)
- frag_damage = false;
+ M_ARGV(4, float) = 0;
return false;
}
MUTATOR_HOOKFUNCTION(midair, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":midair");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":midair");
}
MUTATOR_HOOKFUNCTION(midair, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Midair");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Midair");
}
#endif
MUTATOR_HOOKFUNCTION(multijump, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":multijump");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":multijump");
}
MUTATOR_HOOKFUNCTION(multijump, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Multi jump");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Multi jump");
}
#endif
MUTATOR_HOOKFUNCTION(nades, VehicleEnter)
{
- if(vh_player.nade)
- toss_nade(vh_player, true, '0 0 100', max(vh_player.nade.wait, time + 0.05));
+ entity player = M_ARGV(0, entity);
- return false;
+ if(player.nade)
+ toss_nade(player, true, '0 0 100', max(player.nade.wait, time + 0.05));
}
CLASS(NadeOffhand, OffhandWeapon)
MUTATOR_HOOKFUNCTION(nades, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":Nades");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Nades");
}
MUTATOR_HOOKFUNCTION(nades, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Nades");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Nades");
}
MUTATOR_HOOKFUNCTION(nades, BuildGameplayTipsString)
{
- ret_string = strcat(ret_string, "\n\n^3nades^8 are enabled, press 'g' to use them\n");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3nades^8 are enabled, press 'g' to use them\n");
}
#endif
MUTATOR_HOOKFUNCTION(nt, SetModname)
{
- modname = "NewToys";
- return 0;
+ M_ARGV(0, string) = "NewToys";
+ return false;
}
bool nt_IsNewToy(int w)
}
MUTATOR_HOOKFUNCTION(nt, SetWeaponreplace)
-{SELFPARAM();
+{
+ entity wep = M_ARGV(0, entity);
+ entity wepinfo = M_ARGV(1, entity);
+ string ret_string = M_ARGV(2, string);
+
// otherwise, we do replace
- if(self.new_toys)
+ if(wep.new_toys)
{
// map defined replacement:
- ret_string = self.new_toys;
+ ret_string = wep.new_toys;
}
else
{
// auto replacement:
- ret_string = nt_GetReplacement(other.netname, autocvar_g_new_toys_autoreplace);
+ ret_string = nt_GetReplacement(wepinfo.netname, autocvar_g_new_toys_autoreplace);
}
// apply regular weaponreplace
ret_string = W_Apply_Weaponreplace(ret_string);
- return 0;
+ M_ARGV(2, string) = ret_string;
}
MUTATOR_HOOKFUNCTION(nt, FilterItem)
MUTATOR_HOOKFUNCTION(nix, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":NIX");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":NIX");
}
MUTATOR_HOOKFUNCTION(nix, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", NIX");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", NIX");
}
MUTATOR_HOOKFUNCTION(nix, FilterItem)
MUTATOR_HOOKFUNCTION(nix, SetModname, CBC_ORDER_LAST)
{
- modname = "NIX";
+ M_ARGV(0, string) = "NIX";
return false;
}
#endif
MUTATOR_HOOKFUNCTION(ok, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":OK");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":OK");
}
MUTATOR_HOOKFUNCTION(ok, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Overkill");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Overkill");
}
MUTATOR_HOOKFUNCTION(ok, SetModname)
{
- modname = "Overkill";
+ M_ARGV(0, string) = "Overkill";
return true;
}
}
MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn)
-{SELFPARAM();
- if(self.owner == world && autocvar_g_physical_items <= 1)
+{
+ entity item = M_ARGV(0, entity);
+
+ if(item.owner == world && autocvar_g_physical_items <= 1)
return false;
- if (self.spawnflags & 1) // floating item
+ if (item.spawnflags & 1) // floating item
return false;
// The actual item can't be physical and trigger at the same time, so make it invisible and use a second entity for physics.
// Ugly hack, but unless SOLID_TRIGGER is gotten to work with MOVETYPE_PHYSICS in the engine it can't be fixed.
entity wep;
wep = spawn();
- _setmodel(wep, self.model);
- setsize(wep, self.mins, self.maxs);
- setorigin(wep, self.origin);
- wep.angles = self.angles;
- wep.velocity = self.velocity;
+ _setmodel(wep, item.model);
+ setsize(wep, item.mins, item.maxs);
+ setorigin(wep, item.origin);
+ wep.angles = item.angles;
+ wep.velocity = item.velocity;
- wep.owner = self;
+ wep.owner = item;
wep.solid = SOLID_CORPSE;
wep.movetype = MOVETYPE_PHYSICS;
wep.takedamage = DAMAGE_AIM;
wep.effects |= EF_NOMODELFLAGS; // disable the spinning
- wep.colormap = self.owner.colormap;
- wep.glowmod = self.owner.glowmod;
+ wep.colormap = item.owner.colormap;
+ wep.glowmod = item.owner.glowmod;
wep.damageforcescale = autocvar_g_physical_items_damageforcescale;
- wep.dphitcontentsmask = self.dphitcontentsmask;
- wep.cnt = (self.owner != world);
+ wep.dphitcontentsmask = item.dphitcontentsmask;
+ wep.cnt = (item.owner != world);
setthink(wep, physical_item_think);
wep.nextthink = time;
{
// fix the spawn origin
setorigin(wep, wep.origin + '0 0 1');
- entity oldself;
- oldself = self;
WITHSELF(wep, builtin_droptofloor());
}
wep.spawn_origin = wep.origin;
- wep.spawn_angles = self.angles;
+ wep.spawn_angles = item.angles;
- self.effects |= EF_NODRAW; // hide the original weapon
- self.movetype = MOVETYPE_FOLLOW;
- self.aiment = wep; // attach the original weapon
- self.SendEntity3 = func_null;
+ item.effects |= EF_NODRAW; // hide the original weapon
+ item.movetype = MOVETYPE_FOLLOW;
+ item.aiment = wep; // attach the original weapon
+ item.SendEntity3 = func_null;
return false;
}
MUTATOR_HOOKFUNCTION(pinata, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":Pinata");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Pinata");
}
MUTATOR_HOOKFUNCTION(pinata, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Piñata");
- return false;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Piñata");
}
#endif
MUTATOR_HOOKFUNCTION(random_gravity, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":RandomGravity");
- return 0;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":RandomGravity");
}
MUTATOR_HOOKFUNCTION(random_gravity, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Random gravity");
- return 0;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Random gravity");
}
#endif
MUTATOR_HOOKFUNCTION(rocketflying, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":RocketFlying");
- return 0;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":RocketFlying");
}
MUTATOR_HOOKFUNCTION(rocketflying, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Rocket Flying");
- return 0;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Rocket Flying");
}
#endif
REGISTER_MUTATOR(superspec, cvar("g_superspectate"));
#define _SSMAGIX "SUPERSPEC_OPTIONSFILE_V1"
-#define _ISLOCAL ((edict_num(1) == self) ? true : false)
+#define _ISLOCAL(ent) ((edict_num(1) == (ent)) ? true : false)
const float ASF_STRENGTH = BIT(0);
const float ASF_SHIELD = BIT(1);
string fn = "superspec-local.options";
float fh;
- if (!_ISLOCAL)
+ if (!_ISLOCAL(self))
{
if(self.crypto_idfp == "")
return;
}
MUTATOR_HOOKFUNCTION(superspec, ItemTouch)
-{SELFPARAM();
- entity _item = self;
+{
+ entity item = M_ARGV(0, entity);
+ entity toucher = M_ARGV(1, entity);
FOREACH_CLIENT(true, LAMBDA(
if(!IS_SPEC(it) && !IS_OBSERVER(it))
continue;
if(it.superspec_flags & SSF_ITEMMSG)
- if(superspec_filteritem(it, _item))
+ if(superspec_filteritem(it, item))
{
if(it.superspec_flags & SSF_VERBOSE)
- superspec_msg("", "", it, sprintf("Player %s^7 just picked up ^3%s\n", other.netname, _item.netname), 1);
+ superspec_msg("", "", it, sprintf("Player %s^7 just picked up ^3%s\n", toucher.netname, item.netname), 1);
else
- superspec_msg("", "", it, sprintf("Player %s^7 just picked up ^3%s\n^8(%s^8)\n", other.netname, _item.netname, _item.classname), 1);
- if((it.autospec_flags & ASF_SSIM) && it.enemy != other)
+ superspec_msg("", "", it, sprintf("Player %s^7 just picked up ^3%s\n^8(%s^8)\n", toucher.netname, item.netname, item.classname), 1);
+ if((it.autospec_flags & ASF_SSIM) && it.enemy != toucher)
{
- WITHSELF(it, superspec_Spectate(other));
+ WITHSELF(it, superspec_Spectate(toucher));
return MUT_ITEMTOUCH_CONTINUE;
}
}
- if((it.autospec_flags & ASF_SHIELD && _item.invincible_finished) ||
- (it.autospec_flags & ASF_STRENGTH && _item.strength_finished) ||
- (it.autospec_flags & ASF_MEGA_AR && _item.itemdef == ITEM_ArmorMega) ||
- (it.autospec_flags & ASF_MEGA_HP && _item.itemdef == ITEM_HealthMega) ||
- (it.autospec_flags & ASF_FLAG_GRAB && _item.classname == "item_flag_team"))
+ if((it.autospec_flags & ASF_SHIELD && item.invincible_finished) ||
+ (it.autospec_flags & ASF_STRENGTH && item.strength_finished) ||
+ (it.autospec_flags & ASF_MEGA_AR && item.itemdef == ITEM_ArmorMega) ||
+ (it.autospec_flags & ASF_MEGA_HP && item.itemdef == ITEM_HealthMega) ||
+ (it.autospec_flags & ASF_FLAG_GRAB && item.classname == "item_flag_team"))
{
- if((it.enemy != other) || IS_OBSERVER(it))
+ if((it.enemy != toucher) || IS_OBSERVER(it))
{
if(it.autospec_flags & ASF_OBSERVER_ONLY && !IS_OBSERVER(it))
{
if(it.superspec_flags & SSF_VERBOSE)
- superspec_msg("", "", it, sprintf("^8Ignored that ^7%s^8 grabbed %s^8 since the observer_only option is ON\n", other.netname, _item.netname), 2);
+ superspec_msg("", "", it, sprintf("^8Ignored that ^7%s^8 grabbed %s^8 since the observer_only option is ON\n", toucher.netname, item.netname), 2);
}
else
{
if(it.autospec_flags & ASF_SHOWWHAT)
- superspec_msg("", "", it, sprintf("^7Following %s^7 due to picking up %s\n", other.netname, _item.netname), 2);
+ superspec_msg("", "", it, sprintf("^7Following %s^7 due to picking up %s\n", toucher.netname, item.netname), 2);
- WITHSELF(it, superspec_Spectate(other));
+ WITHSELF(it, superspec_Spectate(toucher));
}
}
}
MUTATOR_HOOKFUNCTION(superspec, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":SS");
- return 0;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":SS");
}
MUTATOR_HOOKFUNCTION(superspec, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Super Spectators");
- return 0;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Super Spectators");
}
void superspec_hello(entity this)
}
MUTATOR_HOOKFUNCTION(superspec, ClientConnect)
-{SELFPARAM();
- if(!IS_REAL_CLIENT(self))
+{
+ entity player = M_ARGV(0, entity);
+
+ if(!IS_REAL_CLIENT(player))
return false;
string fn = "superspec-local.options";
float fh;
- self.superspec_flags = SSF_VERBOSE;
- self.superspec_itemfilter = "";
+ player.superspec_flags = SSF_VERBOSE;
+ player.superspec_itemfilter = "";
entity _hello = spawn();
- _hello.enemy = self;
+ _hello.enemy = player;
setthink(_hello, superspec_hello);
_hello.nextthink = time + 5;
- if (!_ISLOCAL)
+ if (!_ISLOCAL(player))
{
- if(self.crypto_idfp == "")
+ if(player.crypto_idfp == "")
return false;
- fn = sprintf("superspec-%s.options", uri_escape(self.crypto_idfp));
+ fn = sprintf("superspec-%s.options", uri_escape(player.crypto_idfp));
}
fh = fopen(fn, FILE_READ);
}
else
{
- self.autospec_flags = stof(fgets(fh));
- self.superspec_flags = stof(fgets(fh));
- self.superspec_itemfilter = strzone(fgets(fh));
+ player.autospec_flags = stof(fgets(fh));
+ player.superspec_flags = stof(fgets(fh));
+ player.superspec_itemfilter = strzone(fgets(fh));
}
fclose(fh);
}
MUTATOR_HOOKFUNCTION(vampire, BuildMutatorsString)
{
- ret_string = strcat(ret_string, ":Vampire");
- return 0;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Vampire");
}
MUTATOR_HOOKFUNCTION(vampire, BuildMutatorsPrettyString)
{
- ret_string = strcat(ret_string, ", Vampire");
- return 0;
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Vampire");
}
#endif
.float last_dmg;
MUTATOR_HOOKFUNCTION(vh, GrappleHookThink)
-{SELFPARAM();
- entity dmgent = ((SAME_TEAM(self.owner, self.aiment) && autocvar_g_vampirehook_teamheal) ? self.owner : self.aiment);
+{
+ entity thehook = M_ARGV(0, entity);
- if(IS_PLAYER(self.aiment))
- if(self.last_dmg < time)
- if(!STAT(FROZEN, self.aiment))
+ entity dmgent = ((SAME_TEAM(thehook.owner, thehook.aiment) && autocvar_g_vampirehook_teamheal) ? thehook.owner : thehook.aiment);
+
+ if(IS_PLAYER(thehook.aiment))
+ if(thehook.last_dmg < time)
+ if(!STAT(FROZEN, thehook.aiment))
if(time >= game_starttime)
- if(DIFF_TEAM(self.owner, self.aiment) || autocvar_g_vampirehook_teamheal)
- if(self.aiment.health > 0)
+ if(DIFF_TEAM(thehook.owner, thehook.aiment) || autocvar_g_vampirehook_teamheal)
+ if(thehook.aiment.health > 0)
if(autocvar_g_vampirehook_damage)
{
- self.last_dmg = time + autocvar_g_vampirehook_damagerate;
- self.owner.damage_dealt += autocvar_g_vampirehook_damage;
- Damage(dmgent, self, self.owner, autocvar_g_vampirehook_damage, WEP_HOOK.m_id, self.origin, '0 0 0');
- if(SAME_TEAM(self.owner, self.aiment))
- self.aiment.health = min(self.aiment.health + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max);
+ thehook.last_dmg = time + autocvar_g_vampirehook_damagerate;
+ thehook.owner.damage_dealt += autocvar_g_vampirehook_damage;
+ Damage(dmgent, thehook, thehook.owner, autocvar_g_vampirehook_damage, WEP_HOOK.m_id, thehook.origin, '0 0 0');
+ if(SAME_TEAM(thehook.owner, thehook.aiment))
+ thehook.aiment.health = min(thehook.aiment.health + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max);
else
- self.owner.health = min(self.owner.health + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max);
+ thehook.owner.health = min(thehook.owner.health + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max);
- if(dmgent == self.owner)
+ if(dmgent == thehook.owner)
dmgent.health -= autocvar_g_vampirehook_damage; // FIXME: friendly fire?!
}
-
- return false;
}
#endif
}
MUTATOR_CALLHOOK(FixPlayermodel, defaultmodel, defaultskin);
- defaultmodel = ret_string;
- defaultskin = ret_int;
+ defaultmodel = M_ARGV(0, string);
+ defaultskin = M_ARGV(1, int);
bool chmdl = false;
int oldskin;
int moveflag, tmp_moncount = 0;
string arg_lower = strtolower(argument);
moveflag = (argv(3)) ? stof(argv(3)) : 1; // follow owner if not defined
- ret_string = "Monster spawning is currently disabled by a mutator";
if (arg_lower == "list") { print_to(caller, monsterlist_reply); return; }
if (!autocvar_g_monsters) { print_to(caller, "Monsters are disabled"); return; }
if (autocvar_g_monsters_max <= 0 || autocvar_g_monsters_max_perplayer <= 0) { print_to(caller, "Monster spawning is disabled"); return; }
if (!IS_PLAYER(caller)) { print_to(caller, "You must be playing to spawn a monster"); return; }
- if (MUTATOR_CALLHOOK(AllowMobSpawning)) { print_to(caller, ret_string); return; }
+ if (MUTATOR_CALLHOOK(AllowMobSpawning, caller)) { print_to(caller, M_ARGV(1, string)); return; }
if (caller.vehicle) { print_to(caller, "You can't spawn monsters while driving a vehicle"); return; }
if (STAT(FROZEN, caller)) { print_to(caller, "You can't spawn monsters while frozen"); return; }
if (IS_DEAD(caller)) { print_to(caller, "You can't spawn monsters while dead"); return; }
case "butcher":
{
if (caller) { print_to(caller, "This command is not available to players"); return; }
- if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFO(ret_string, "\n"); return; }
+ if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFO(M_ARGV(0, string), "\n"); return; }
int tmp_remcount = 0;
string s = "";
MUTATOR_CALLHOOK(GetRecords, page, s);
- s = ret_string;
+ s = M_ARGV(1, string);
MapInfo_ClearTemps();
entity pull_entity = self.realowner;
float velocity_multiplier = 1;
MUTATOR_CALLHOOK(GrappleHookThink, self, tarzan, pull_entity, velocity_multiplier);
- tarzan = hook_tarzan;
- pull_entity = hook_pullentity;
- velocity_multiplier = hook_velmultiplier;
+ tarzan = M_ARGV(1, int);
+ pull_entity = M_ARGV(2, entity);
+ velocity_multiplier = M_ARGV(3, float);
if(self.state == 1)
{
s = ":gameinfo:mutators:LIST";
MUTATOR_CALLHOOK(BuildMutatorsString, s);
- s = ret_string;
+ s = M_ARGV(0, string);
// initialiation stuff, not good in the mutator system
if(!autocvar_g_use_ammunition)
FOREACH_CLIENT(IS_REAL_CLIENT(it) || (IS_BOT_CLIENT(it) && autocvar_sv_logscores_bots), LAMBDA(
s = strcat(":player:see-labels:", GetPlayerScoreString(it, 0), ":");
s = strcat(s, ftos(rint(time - it.jointime)), ":");
- if(IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it, s))
+ if(IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
s = strcat(s, ftos(it.team), ":");
else
s = strcat(s, "spectator:");
s = cvar_string("g_weaponarena");
MUTATOR_CALLHOOK(SetWeaponArena, s);
- s = ret_string;
+ s = M_ARGV(0, string);
if (s == "0" || s == "")
{
/**
* called when a player tries to spawn a monster
* return 1 to prevent spawning
+ * NOTE: requires reason if disallowed
*/
-MUTATOR_HOOKABLE(AllowMobSpawning, EV_NO_ARGS);
+ #define EV_AllowMobSpawning(i, o) \
+ /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** reason */ o(string, MUTATOR_ARGV_1_string) \
+ /**/
+MUTATOR_HOOKABLE(AllowMobSpawning, EV_AllowMobSpawning);
/** called when a player gets damaged to e.g. remove stuff he was carrying. */
#define EV_PlayerDamage_SplitHealthArmor(i, o) \
#define EV_SetModname(i, o) \
/** name of the mutator/mod if it warrants showing as such in the server browser */ \
- o(string, modname) \
+ /**/ o(string, MUTATOR_ARGV_0_string) \
/**/
MUTATOR_HOOKABLE(SetModname, EV_SetModname);
* return 1 to remove an item
*/
#define EV_Item_Spawn(i, o) \
- /** the item */ i(entity, __self) \
+ /** item */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
#define EV_SetWeaponreplace(i, o) \
- /** map entity */ i(entity, __self) \
- /** weapon info */ i(entity, other) \
- /**/ i(string, ret_string) \
- /**/ o(string, ret_string) \
+ /** map entity */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** weapon info */ i(entity, MUTATOR_ARGV_1_entity) \
+ /** replacement */ i(string, MUTATOR_ARGV_2_string) \
+ /**/ o(string, MUTATOR_ARGV_2_string) \
/**/
-//string ret_string;
MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
/** called when an item is about to respawn */
#define EV_Item_RespawnCountdown(i, o) \
- /**/ i(string, item_name) \
- /**/ o(string, item_name) \
- /**/ i(vector, item_color) \
- /**/ o(vector, item_color) \
+ /** item name */ i(string, MUTATOR_ARGV_0_string) \
+ /**/ o(string, MUTATOR_ARGV_0_string) \
+ /** item colour */ i(vector, MUTATOR_ARGV_1_vector) \
+ /**/ o(vector, MUTATOR_ARGV_1_vector) \
/**/
-string item_name;
-vector item_color;
MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
/** called when a bot checks a target to attack */
#define EV_BotShouldAttack(i, o) \
- /**/ i(entity, __self) \
- /**/ i(entity, checkentity) \
+ /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** target */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
-entity checkentity;
MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
/**
* allows you to strip a player of an item if they go through the teleporter to help prevent cheating
*/
#define EV_PortalTeleport(i, o) \
- /**/ i(entity, __self) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
* in a special manner using this hook
*/
#define EV_HelpMePing(i, o) \
- /** the player who pressed impulse 33 */ i(entity, __self) \
+ /** the player who pressed impulse 33 */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
* return true to remove the vehicle
*/
#define EV_VehicleSpawn(i, o) \
- /**/ i(entity, __self) \
+ /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(VehicleSpawn, EV_VehicleSpawn);
* allows mutators to set special settings in this event
*/
#define EV_VehicleEnter(i, o) \
- /** player */ i(entity, vh_player) \
- /** vehicle */ i(entity, vh_vehicle) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
-entity vh_player;
-entity vh_vehicle;
MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
/**
* return true to stop player from entering the vehicle
*/
#define EV_VehicleTouch(i, o) \
- /** vehicle */ i(entity, __self) \
- /** player */ i(entity, other) \
+ /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** player */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
* allows mutators to set special settings in this event
*/
#define EV_VehicleExit(i, o) \
- /** player */ i(entity, vh_player) \
- /** vehicle */ i(entity, vh_vehicle) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
/** called when a speedrun is aborted and the player is teleported back to start position */
#define EV_AbortSpeedrun(i, o) \
- /** player */ i(entity, __self) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
/** called at when a item is touched. Called early, can edit item properties. */
#define EV_ItemTouch(i, o) \
- /** item */ i(entity, __self) \
- /** player */ i(entity, other) \
+ /** item */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
/** called at when a player connect */
#define EV_ClientConnect(i, o) \
- /** player */ i(entity, __self) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
#define EV_HavocBot_ChooseRole(i, o) \
- /**/ i(entity, __self) \
+ /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
/** Called when getting the global parameters for a model */
#define EV_GetModelParams(i, o) \
- /** entity id */ i(string, checkmodel_input) \
- /** entity id */ i(string, checkmodel_command) \
+ /** input */ i(string, MUTATOR_ARGV_0_string) \
+ /** command */ i(string, MUTATOR_ARGV_1_string) \
/**/
-string checkmodel_input, checkmodel_command;
MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
/** called when a bullet has hit a target */
#define EV_FireBullet_Hit(i, o) \
- /**/ i(entity, __self) \
- /**/ i(entity, bullet_hit) \
- /**/ i(vector, bullet_startpos) \
- /**/ i(vector, bullet_endpos) \
- /**/ i(float, frag_damage) \
- /**/ o(float, frag_damage) \
- /**/
-entity bullet_hit;
-//vector bullet_hitloc; // the end pos matches the hit location, apparently
-vector bullet_startpos;
-vector bullet_endpos;
-float frag_damage;
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** targ */ i(entity, MUTATOR_ARGV_1_entity) \
+ /** start pos */ i(vector, MUTATOR_ARGV_2_vector) \
+ /** end pos */ i(vector, MUTATOR_ARGV_3_vector) \
+ /** damage */ i(float, MUTATOR_ARGV_4_float) \
+ /**/ o(float, MUTATOR_ARGV_4_float) \
+ /**/
MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
#define EV_FixPlayermodel(i, o) \
- /**/ i(string, ret_string) \
- /**/ o(string, ret_string) \
- /**/ i(int, ret_int) \
- /**/ o(int, ret_int) \
+ /** model */ i(string, MUTATOR_ARGV_0_string) \
+ /**/ o(string, MUTATOR_ARGV_0_string) \
+ /** skin */ i(int, MUTATOR_ARGV_1_int) \
+ /**/ o(int, MUTATOR_ARGV_1_int) \
/**/
-int ret_int;
MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
/** Return error to play frag remaining announcements */
MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
#define EV_GrappleHookThink(i, o) \
- /**/ i(entity, __self) \
- /**/ i(int, hook_tarzan) \
- /**/ o(int, hook_tarzan) \
- /**/ i(entity, hook_pullentity) \
- /**/ o(entity, hook_pullentity) \
- /**/ i(float, hook_velmultiplier) \
- /**/ o(float, hook_velmultiplier) \
- /**/
-int hook_tarzan;
-entity hook_pullentity;
-float hook_velmultiplier;
+ /** hook */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** tarzan */ i(int, MUTATOR_ARGV_1_int) \
+ /**/ o(int, MUTATOR_ARGV_1_int) \
+ /** pulling entity */ i(entity, MUTATOR_ARGV_2_entity) \
+ /**/ o(entity, MUTATOR_ARGV_2_entity) \
+ /** velocity multiplier */ i(float, MUTATOR_ARGV_3_float) \
+ /**/ o(float, MUTATOR_ARGV_3_float) \
+ /**/
MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
#define EV_BuffModel_Customize(i, o) \
- /**/ i(entity, __self) \
- /**/ i(entity, buff_player) \
+ /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** player */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
-entity buff_player;
MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
/** called at when a buff is touched. Called early, can edit buff properties. */
#define EV_BuffTouch(i, o) \
- /** item */ i(entity, __self) \
- /** player */ i(entity, other) \
+ /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** player */ i(entity, MUTATOR_ARGV_1_entity) \
/**/
MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
#define EV_GetRecords(i, o) \
- /**/ i(int, record_page) \
- /**/ i(string, ret_string) \
- /**/ o(string, ret_string) \
+ /** page */ i(int, MUTATOR_ARGV_1_int) \
+ /** record list */ i(string, MUTATOR_ARGV_1_string) \
+ /**/ o(string, MUTATOR_ARGV_1_string) \
/**/
-int record_page;
MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
#define EV_Race_FinalCheckpoint(i, o) \
- /**/ i(entity, race_player) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
-entity race_player;
MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
/** called when player triggered kill (or is changing teams), return error to not do anything */
MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
#define EV_GetPlayerStatus(i, o) \
- /**/ i(entity, set_player) \
- /**/ i(string, ret_string) \
- /**/ o(string, ret_string) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
-entity set_player;
MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
#define EV_SetWeaponArena(i, o) \
- /**/ i(string, ret_string) \
- /**/ o(string, ret_string) \
+ /** arena */ i(string, MUTATOR_ARGV_0_string) \
+ /**/ o(string, MUTATOR_ARGV_0_string) \
/**/
MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
* called when an admin tries to kill all monsters
* return 1 to prevent spawning
*/
-MUTATOR_HOOKABLE(AllowMobButcher, EV_NO_ARGS);
+#define EV_AllowMobButcher(i, o) \
+ /** reason */ o(string, MUTATOR_ARGV_0_string) \
+ /**/
+MUTATOR_HOOKABLE(AllowMobButcher, EV_AllowMobButcher);
MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
}
MUTATOR_HOOKFUNCTION(as, VehicleSpawn)
-{SELFPARAM();
- self.nextthink = time + 0.5;
+{
+ entity veh = M_ARGV(0, entity);
- return false;
+ veh.nextthink = time + 0.5;
}
MUTATOR_HOOKFUNCTION(as, HavocBot_ChooseRole)
-{SELFPARAM();
- havocbot_ast_reset_role(self);
+{
+ entity bot = M_ARGV(0, entity);
+
+ havocbot_ast_reset_role(bot);
return true;
}
MUTATOR_HOOKFUNCTION(ca, ClientConnect)
{
- SELFPARAM();
- TRANSMUTE(Observer, this);
+ entity player = M_ARGV(0, entity);
+
+ TRANSMUTE(Observer, player);
return true;
}
MUTATOR_HOOKFUNCTION(ca, GetPlayerStatus)
{
- return set_player.caplayer == 1;
+ entity player = M_ARGV(0, entity);
+
+ return player.caplayer == 1;
}
MUTATOR_HOOKFUNCTION(ca, SetWeaponArena)
{
// most weapons arena
- if (ret_string == "0" || ret_string == "") ret_string = "most";
+ if (M_ARGV(0, string) == "0" || M_ARGV(0, string) == "") M_ARGV(0, string) = "most";
}
#endif
}
MUTATOR_HOOKFUNCTION(ctf, PortalTeleport)
-{SELFPARAM();
- if(self.flagcarried)
- if(!autocvar_g_ctf_portalteleport)
- { ctf_Handle_Throw(self, world, DROP_NORMAL); }
+{
+ entity player = M_ARGV(0, entity);
- return false;
+ if(player.flagcarried)
+ if(!autocvar_g_ctf_portalteleport)
+ { ctf_Handle_Throw(player, world, DROP_NORMAL); }
}
MUTATOR_HOOKFUNCTION(ctf, PlayerUseKey)
}
MUTATOR_HOOKFUNCTION(ctf, HelpMePing)
-{SELFPARAM();
- if(self.wps_flagcarrier) // update the flagcarrier waypointsprite with "NEEDING HELP" notification
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.wps_flagcarrier) // update the flagcarrier waypointsprite with "NEEDING HELP" notification
{
- self.wps_helpme_time = time;
- WaypointSprite_HelpMePing(self.wps_flagcarrier);
+ player.wps_helpme_time = time;
+ WaypointSprite_HelpMePing(player.wps_flagcarrier);
}
else // create a normal help me waypointsprite
{
- WaypointSprite_Spawn(WP_Helpme, waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, self.team, self, wps_helpme, false, RADARICON_HELPME);
- WaypointSprite_Ping(self.wps_helpme);
+ WaypointSprite_Spawn(WP_Helpme, waypointsprite_deployed_lifetime, waypointsprite_limitedrange, player, FLAG_WAYPOINT_OFFSET, world, player.team, player, wps_helpme, false, RADARICON_HELPME);
+ WaypointSprite_Ping(player.wps_helpme);
}
return true;
MUTATOR_HOOKFUNCTION(ctf, VehicleEnter)
{
- if(vh_player.flagcarried)
+ entity player = M_ARGV(0, entity);
+ entity veh = M_ARGV(1, entity);
+
+ if(player.flagcarried)
{
- vh_player.flagcarried.nodrawtoclient = vh_player; // hide the flag from the driver
+ player.flagcarried.nodrawtoclient = player; // hide the flag from the driver
if(!autocvar_g_ctf_allow_vehicle_carry && !autocvar_g_ctf_allow_vehicle_touch)
{
- ctf_Handle_Throw(vh_player, world, DROP_NORMAL);
+ ctf_Handle_Throw(player, world, DROP_NORMAL);
}
else
{
- setattachment(vh_player.flagcarried, vh_vehicle, "");
- setorigin(vh_player.flagcarried, VEHICLE_FLAG_OFFSET);
- vh_player.flagcarried.scale = VEHICLE_FLAG_SCALE;
- //vh_player.flagcarried.angles = '0 0 0';
+ setattachment(player.flagcarried, veh, "");
+ setorigin(player.flagcarried, VEHICLE_FLAG_OFFSET);
+ player.flagcarried.scale = VEHICLE_FLAG_SCALE;
+ //player.flagcarried.angles = '0 0 0';
}
return true;
}
MUTATOR_HOOKFUNCTION(ctf, VehicleExit)
{
- if(vh_player.flagcarried)
+ entity player = M_ARGV(0, entity);
+
+ if(player.flagcarried)
{
- setattachment(vh_player.flagcarried, vh_player, "");
- setorigin(vh_player.flagcarried, FLAG_CARRY_OFFSET);
- vh_player.flagcarried.scale = FLAG_SCALE;
- vh_player.flagcarried.angles = '0 0 0';
- vh_player.flagcarried.nodrawtoclient = world;
+ setattachment(player.flagcarried, player, "");
+ setorigin(player.flagcarried, FLAG_CARRY_OFFSET);
+ player.flagcarried.scale = FLAG_SCALE;
+ player.flagcarried.angles = '0 0 0';
+ player.flagcarried.nodrawtoclient = world;
return true;
}
}
MUTATOR_HOOKFUNCTION(ctf, AbortSpeedrun)
-{SELFPARAM();
- if(self.flagcarried)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.flagcarried)
{
- Send_Notification(NOTIF_ALL, world, MSG_INFO, ((self.flagcarried.team) ? APP_TEAM_ENT(self.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN) : INFO_CTF_FLAGRETURN_ABORTRUN_NEUTRAL));
- ctf_RespawnFlag(self.flagcarried);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, ((player.flagcarried.team) ? APP_TEAM_ENT(player.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN) : INFO_CTF_FLAGRETURN_ABORTRUN_NEUTRAL));
+ ctf_RespawnFlag(player.flagcarried);
return true;
}
}
MUTATOR_HOOKFUNCTION(ctf, HavocBot_ChooseRole)
-{SELFPARAM();
- havocbot_ctf_reset_role(self);
+{
+ entity bot = M_ARGV(0, entity);
+
+ havocbot_ctf_reset_role(bot);
return true;
}
MUTATOR_HOOKFUNCTION(ctf, GetRecords)
{
+ int record_page = M_ARGV(0, int);
+ string ret_string = M_ARGV(1, string);
+
for(int i = record_page * 200; i < MapInfo_count && i < record_page * 200 + 200; ++i)
{
if (MapInfo_Get_ByID(i))
}
}
- return false;
+ M_ARGV(1, string) = ret_string;
}
bool superspec_Spectate(entity _player); // TODO
}
MUTATOR_HOOKFUNCTION(cts, ClientConnect)
-{SELFPARAM();
- race_PreparePlayer(this);
- self.race_checkpoint = -1;
+{
+ entity player = M_ARGV(0, entity);
+
+ race_PreparePlayer(player);
+ player.race_checkpoint = -1;
- if(IS_REAL_CLIENT(self))
+ if(IS_REAL_CLIENT(player))
{
string rr = CTS_RECORD;
- msg_entity = self;
+ msg_entity = player;
race_send_recordtime(MSG_ONE);
race_send_speedaward(MSG_ONE);
}
MUTATOR_HOOKFUNCTION(cts, HavocBot_ChooseRole)
-{SELFPARAM();
- self.havocbot_role = havocbot_role_cts;
+{
+ entity bot = M_ARGV(0, entity);
+
+ bot.havocbot_role = havocbot_role_cts;
return true;
}
MUTATOR_HOOKFUNCTION(cts, GetRecords)
{
+ int record_page = M_ARGV(0, int);
+ string ret_string = M_ARGV(1, string);
+
for(int i = record_page * 200; i < MapInfo_count && i < record_page * 200 + 200; ++i)
{
if(MapInfo_Get_ByID(i))
}
}
- return false;
+ M_ARGV(1, string) = ret_string;
}
void ClientKill_Now();
MUTATOR_HOOKFUNCTION(cts, Race_FinalCheckpoint)
{
- if(autocvar_g_cts_finish_kill_delay)
- CTS_ClientKill(race_player);
+ entity player = M_ARGV(0, entity);
- return false;
+ if(autocvar_g_cts_finish_kill_delay)
+ CTS_ClientKill(player);
}
MUTATOR_HOOKFUNCTION(cts, FixClientCvars)
}
MUTATOR_HOOKFUNCTION(dom, ClientConnect)
-{SELFPARAM();
- set_dom_state(self);
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ set_dom_state(player);
}
MUTATOR_HOOKFUNCTION(dom, HavocBot_ChooseRole)
-{SELFPARAM();
- self.havocbot_role = havocbot_role_dom;
+{
+ entity bot = M_ARGV(0, entity);
+
+ bot.havocbot_role = havocbot_role_dom;
return true;
}
}
MUTATOR_HOOKFUNCTION(ft, HavocBot_ChooseRole)
-{SELFPARAM();
- if (!IS_DEAD(self))
+{
+ entity bot = M_ARGV(0, entity);
+
+ if (!IS_DEAD(bot))
{
if (random() < 0.5)
- self.havocbot_role = havocbot_role_ft_freeing;
+ bot.havocbot_role = havocbot_role_ft_freeing;
else
- self.havocbot_role = havocbot_role_ft_offense;
+ bot.havocbot_role = havocbot_role_ft_offense;
}
return true;
MUTATOR_HOOKFUNCTION(ft, SetWeaponArena)
{
// most weapons arena
- if(ret_string == "0" || ret_string == "")
- ret_string = "most";
- return false;
+ if(M_ARGV(0, string) == "0" || M_ARGV(0, string) == "")
+ M_ARGV(0, string) = "most";
}
void freezetag_Initialize()
MUTATOR_HOOKFUNCTION(inv, BotShouldAttack)
{
- if(!IS_MONSTER(checkentity))
+ entity targ = M_ARGV(1, entity);
+
+ if(!IS_MONSTER(targ))
return true;
return false;
MUTATOR_HOOKFUNCTION(inv, AllowMobSpawning)
{
// monster spawning disabled during an invasion
+ M_ARGV(1, string) = "You cannot spawn monsters during an invasion!";
return true;
}
MUTATOR_HOOKFUNCTION(inv, AllowMobButcher)
{
- ret_string = "This command does not work during an invasion!";
+ M_ARGV(0, string) = "This command does not work during an invasion!";
return true;
}
}
MUTATOR_HOOKFUNCTION(ka, BotShouldAttack)
-{SELFPARAM();
+{
+ entity bot = M_ARGV(0, entity);
+ entity targ = M_ARGV(1, entity);
+
// if neither player has ball then don't attack unless the ball is on the ground
- if(!checkentity.ballcarried && !self.ballcarried && ka_ball.owner)
+ if(!targ.ballcarried && !bot.ballcarried && ka_ball.owner)
return true;
return false;
}
MUTATOR_HOOKFUNCTION(ka, HavocBot_ChooseRole)
-{SELFPARAM();
- if (self.ballcarried)
- self.havocbot_role = havocbot_role_ka_carrier;
+{
+ entity bot = M_ARGV(0, entity);
+
+ if (bot.ballcarried)
+ bot.havocbot_role = havocbot_role_ka_carrier;
else
- self.havocbot_role = havocbot_role_ka_collector;
+ bot.havocbot_role = havocbot_role_ka_collector;
return true;
}
MUTATOR_HOOKFUNCTION(kh, HavocBot_ChooseRole)
{
- SELFPARAM();
- if(IS_DEAD(self))
+ entity bot = M_ARGV(0, entity);
+
+ if(IS_DEAD(bot))
return true;
float r = random() * 3;
if (r < 1)
- self.havocbot_role = havocbot_role_kh_offense;
+ bot.havocbot_role = havocbot_role_kh_offense;
else if (r < 2)
- self.havocbot_role = havocbot_role_kh_defense;
+ bot.havocbot_role = havocbot_role_kh_defense;
else
- self.havocbot_role = havocbot_role_kh_freelancer;
+ bot.havocbot_role = havocbot_role_kh_freelancer;
return true;
}
}
MUTATOR_HOOKFUNCTION(lms, ClientConnect)
-{SELFPARAM();
- TRANSMUTE(Player, self);
+{
+ entity player = M_ARGV(0, entity);
+
+ TRANSMUTE(Player, player);
campaign_bots_may_start = true;
- if(PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
+ if(PlayerScore_Add(player, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
{
- PlayerScore_Add(self, SP_LMS_RANK, 666);
- self.frags = FRAGS_SPECTATOR;
+ PlayerScore_Add(player, SP_LMS_RANK, 666);
+ player.frags = FRAGS_SPECTATOR;
}
-
- return false;
}
MUTATOR_HOOKFUNCTION(lms, PlayerPreThink)
}
MUTATOR_HOOKFUNCTION(lms, ItemTouch)
-{SELFPARAM();
- if(self.itemdef == ITEM_ExtraLife)
+{
+ entity item = M_ARGV(0, entity);
+ entity toucher = M_ARGV(1, entity);
+
+ if(item.itemdef == ITEM_ExtraLife)
{
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_EXTRALIVES);
- PlayerScore_Add(other, SP_LMS_LIVES, autocvar_g_lms_extra_lives);
+ Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_EXTRALIVES);
+ PlayerScore_Add(toucher, SP_LMS_LIVES, autocvar_g_lms_extra_lives);
return MUT_ITEMTOUCH_PICKUP;
}
}
MUTATOR_HOOKFUNCTION(rc, ClientConnect)
-{SELFPARAM();
- race_PreparePlayer(this);
- self.race_checkpoint = -1;
+{
+ entity player = M_ARGV(0, entity);
+
+ race_PreparePlayer(player);
+ player.race_checkpoint = -1;
string rr = RACE_RECORD;
- if(IS_REAL_CLIENT(self))
+ if(IS_REAL_CLIENT(player))
{
- msg_entity = self;
+ msg_entity = player;
race_send_recordtime(MSG_ONE);
race_send_speedaward(MSG_ONE);
}
MUTATOR_HOOKFUNCTION(rc, HavocBot_ChooseRole)
-{SELFPARAM();
- self.havocbot_role = havocbot_role_race;
+{
+ entity bot = M_ARGV(0, entity);
+
+ bot.havocbot_role = havocbot_role_race;
return true;
}
MUTATOR_HOOKFUNCTION(rc, GetRecords)
{
+ int record_page = M_ARGV(0, int);
+ string ret_string = M_ARGV(1, string);
+
for(int i = record_page * 200; i < MapInfo_count && i < record_page * 200 + 200; ++i)
{
if(MapInfo_Get_ByID(i))
}
}
- return false;
+ M_ARGV(1, string) = ret_string;
}
MUTATOR_HOOKFUNCTION(rc, FixClientCvars)
{
s = GetPlayerScoreString(it, 1);
s = strcat(s, IS_REAL_CLIENT(it) ? ":human" : ":bot");
- ret_string = string_null;
- if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it, s))
+ if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it))
s = strcat(s, ":spectator");
- if (ret_string) s = strcat(s, ret_string);
}
else
{
- ret_string = string_null;
- if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it, s))
+ if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
s = GetPlayerScoreString(it, 2);
else
s = "-666";
- if (ret_string) s = strcat(s, ret_string);
}
if(it.clientstatus)
string s, modifications, motd;
MUTATOR_CALLHOOK(BuildMutatorsPrettyString, "");
- modifications = ret_string;
+ modifications = M_ARGV(0, string);
if(g_weaponarena)
{
string mutator_msg = "";
MUTATOR_CALLHOOK(BuildGameplayTipsString, mutator_msg);
- mutator_msg = ret_string;
+ mutator_msg = M_ARGV(0, string);
s = strcat(s, mutator_msg); // trust that the mutator will do proper formatting
string s = W_Apply_Weaponreplace(e.netname);
MUTATOR_CALLHOOK(SetWeaponreplace, this, e, s);
- s = ret_string;
+ s = M_ARGV(2, string);
if (s == "")
{
remove(this);
fireBullet_last_hit = hit;
yoda = 0;
MUTATOR_CALLHOOK(FireBullet_Hit, this, hit, start, end, damage);
- damage = frag_damage;
+ damage = M_ARGV(4, float);
float g = accuracy_isgooddamage(this, hit);
Damage(hit, this, this, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
// calculate hits for ballistic weapons