From: Mario Date: Fri, 10 Jun 2016 06:51:57 +0000 (+1000) Subject: Fix up more mutator hooks X-Git-Tag: xonotic-v0.8.2~866 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e9b0f3859726cfc5f17ba0a046147404fb79f5be;p=xonotic%2Fxonotic-data.pk3dir.git Fix up more mutator hooks --- diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index 2889b182c..a7528d5a1 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -1048,19 +1048,25 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPhysics) } MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon) -{SELFPARAM(); - return PS(self).m_weapon == WEP_NEXBALL; +{ + entity player = M_ARGV(0, entity); + + return PS(player).m_weapon == WEP_NEXBALL; } MUTATOR_HOOKFUNCTION(nb, ForbidDropCurrentWeapon) -{SELFPARAM(); - return PS(self).m_weapon == WEP_MORTAR; // TODO: what is this for? +{ + entity player = M_ARGV(0, entity); + + return PS(player).m_weapon == WEP_MORTAR; // TODO: what is this for? } MUTATOR_HOOKFUNCTION(nb, FilterItem) -{SELFPARAM(); - if(self.classname == "droppedweapon") - if(self.weapon == WEP_NEXBALL.m_id) +{ + entity item = M_ARGV(0, entity); + + if(item.classname == "droppedweapon") + if(item.weapon == WEP_NEXBALL.m_id) return true; return false; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc index d7a615b87..fad837f40 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc @@ -1972,9 +1972,9 @@ MUTATOR_HOOKFUNCTION(ons, MonsterSpawn) void ons_TurretSpawn_Delayed(entity this) { - entity own = self.owner; + entity own = this.owner; - if(!own) { remove(self); return; } + if(!own) { remove(this); return; } if(own.targetname) { @@ -1988,13 +1988,15 @@ void ons_TurretSpawn_Delayed(entity this) } } - remove(self); + remove(this); } MUTATOR_HOOKFUNCTION(ons, TurretSpawn) -{SELFPARAM(); +{ + entity turret = M_ARGV(0, entity); + entity e = spawn(); - e.owner = self; + e.owner = turret; InitializeEntity(e, ons_TurretSpawn_Delayed, INITPRIO_FINDTARGET); return false; diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index 134971766..b97124a39 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -717,18 +717,19 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerUseKey, CBC_ORDER_FIRST) } MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon) -{SELFPARAM(); +{ if(MUTATOR_RETURNVALUE || gameover) { return false; } + entity player = M_ARGV(0, entity); - if(self.buffs & BUFF_SWAPPER.m_itemid) + if(player.buffs & BUFF_SWAPPER.m_itemid) { float best_distance = autocvar_g_buffs_swapper_range; entity closest = world; FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( if(!IS_DEAD(it) && !STAT(FROZEN, it) && !it.vehicle) - if(DIFF_TEAM(it, self)) + if(DIFF_TEAM(it, player)) { - float test = vlen2(self.origin - it.origin); + float test = vlen2(player.origin - it.origin); if(test <= best_distance * best_distance) { best_distance = sqrt(test); @@ -741,18 +742,18 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon) { vector my_org, my_vel, my_ang, their_org, their_vel, their_ang; - my_org = self.origin; - my_vel = self.velocity; - my_ang = self.angles; + my_org = player.origin; + my_vel = player.velocity; + my_ang = player.angles; their_org = closest.origin; their_vel = closest.velocity; their_ang = closest.angles; Drop_Special_Items(closest); - MUTATOR_CALLHOOK(PortalTeleport, self); // initiate flag dropper + MUTATOR_CALLHOOK(PortalTeleport, player); // initiate flag dropper - setorigin(self, their_org); + setorigin(player, their_org); setorigin(closest, my_org); closest.velocity = my_vel; @@ -760,25 +761,25 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon) closest.fixangle = true; closest.oldorigin = my_org; closest.oldvelocity = my_vel; - self.velocity = their_vel; - self.angles = their_ang; - self.fixangle = true; - self.oldorigin = their_org; - self.oldvelocity = their_vel; - - // set pusher so self gets the kill if they fall into void - closest.pusher = self; + player.velocity = their_vel; + player.angles = their_ang; + player.fixangle = true; + player.oldorigin = their_org; + player.oldvelocity = their_vel; + + // set pusher so player gets the kill if they fall into void + closest.pusher = player; closest.pushltime = time + autocvar_g_maxpushtime; closest.istypefrag = PHYS_INPUT_BUTTON_CHAT(closest); Send_Effect(EFFECT_ELECTRO_COMBO, their_org, '0 0 0', 1); Send_Effect(EFFECT_ELECTRO_COMBO, my_org, '0 0 0', 1); - sound(self, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM); + sound(player, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM); sound(closest, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NORM); // TODO: add a counter to handle how many times one can teleport, and a delay to prevent spam - self.buffs = 0; + player.buffs = 0; return true; } } @@ -803,28 +804,33 @@ MUTATOR_HOOKFUNCTION(buffs, MakePlayerObserver) { entity player = M_ARGV(0, enti MUTATOR_HOOKFUNCTION(buffs, ClientDisconnect) { entity player = M_ARGV(0, entity); return buffs_RemovePlayer(player); } MUTATOR_HOOKFUNCTION(buffs, CustomizeWaypoint) -{SELFPARAM(); - entity e = WaypointSprite_getviewentity(other); +{ + entity wp = M_ARGV(0, entity); + entity player = M_ARGV(1, entity); + + entity e = WaypointSprite_getviewentity(player); // if you have the invisibility powerup, sprites ALWAYS are restricted to your team // but only apply this to real players, not to spectators - if((self.owner.flags & FL_CLIENT) && (self.owner.buffs & BUFF_INVISIBLE.m_itemid) && (e == other)) - if(DIFF_TEAM(self.owner, e)) + if((wp.owner.flags & FL_CLIENT) && (wp.owner.buffs & BUFF_INVISIBLE.m_itemid) && (e == player)) + if(DIFF_TEAM(wp.owner, e)) return true; return false; } MUTATOR_HOOKFUNCTION(buffs, OnEntityPreSpawn, CBC_ORDER_LAST) -{SELFPARAM(); +{ + entity ent = M_ARGV(0, entity); + if(autocvar_g_buffs_replace_powerups) - switch(self.classname) + switch(ent.classname) { case "item_strength": case "item_invincible": { entity e = spawn(); - buff_SpawnReplacement(e, self); + buff_SpawnReplacement(e, ent); return true; } } diff --git a/qcsrc/common/mutators/mutator/hook/hook.qc b/qcsrc/common/mutators/mutator/hook/hook.qc index 3dbce74f2..3875f887f 100644 --- a/qcsrc/common/mutators/mutator/hook/hook.qc +++ b/qcsrc/common/mutators/mutator/hook/hook.qc @@ -36,8 +36,9 @@ MUTATOR_HOOKFUNCTION(hook, PlayerSpawn) MUTATOR_HOOKFUNCTION(hook, FilterItem) { - SELFPARAM(); - return self.weapon == WEP_HOOK.m_id; + entity item = M_ARGV(0, entity); + + return item.weapon == WEP_HOOK.m_id; } #endif diff --git a/qcsrc/common/mutators/mutator/instagib/instagib.qc b/qcsrc/common/mutators/mutator/instagib/instagib.qc index 89f98ade7..ec96d4626 100644 --- a/qcsrc/common/mutators/mutator/instagib/instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/instagib.qc @@ -375,48 +375,53 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, SetStartItems) } MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem) -{SELFPARAM(); - if(self.classname == "item_cells") +{ + entity item = M_ARGV(0, entity); + + if(item.classname == "item_cells") return true; // no normal cells? - if(self.weapon == WEP_VAPORIZER.m_id && self.classname == "droppedweapon") + if(item.weapon == WEP_VAPORIZER.m_id && item.classname == "droppedweapon") { - self.ammo_cells = autocvar_g_instagib_ammo_drop; + item.ammo_cells = autocvar_g_instagib_ammo_drop; return false; } - if(self.weapon == WEP_DEVASTATOR.m_id || self.weapon == WEP_VORTEX.m_id) + if(item.weapon == WEP_DEVASTATOR.m_id || item.weapon == WEP_VORTEX.m_id) { entity e = spawn(); - setorigin(e, self.origin); - e.noalign = self.noalign; - e.cnt = self.cnt; - e.team = self.team; + setorigin(e, item.origin); + e.noalign = item.noalign; + e.cnt = item.cnt; + e.team = item.team; e.spawnfunc_checked = true; WITHSELF(e, spawnfunc_item_minst_cells(e)); return true; } - if(self.flags & FL_POWERUP) + if(item.flags & FL_POWERUP) return false; - if(self.ammo_cells > autocvar_g_instagib_ammo_drop && self.classname != "item_minst_cells") - self.ammo_cells = autocvar_g_instagib_ammo_drop; + if(item.ammo_cells > autocvar_g_instagib_ammo_drop && item.classname != "item_minst_cells") + item.ammo_cells = autocvar_g_instagib_ammo_drop; - if(self.ammo_cells && !self.weapon) + if(item.ammo_cells && !item.weapon) return false; return true; } MUTATOR_HOOKFUNCTION(mutator_instagib, CustomizeWaypoint) -{SELFPARAM(); - entity e = WaypointSprite_getviewentity(other); +{ + entity wp = M_ARGV(0, entity); + entity player = M_ARGV(1, entity); + + entity e = WaypointSprite_getviewentity(player); // if you have the invisibility powerup, sprites ALWAYS are restricted to your team // but only apply this to real players, not to spectators - if((self.owner.flags & FL_CLIENT) && (self.owner.items & ITEM_Invisibility.m_itemid) && (e == other)) - if(DIFF_TEAM(self.owner, e)) + if((wp.owner.flags & FL_CLIENT) && (wp.owner.items & ITEM_Invisibility.m_itemid) && (e == player)) + if(DIFF_TEAM(wp.owner, e)) return true; return false; @@ -463,10 +468,11 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, ItemTouch) } MUTATOR_HOOKFUNCTION(mutator_instagib, OnEntityPreSpawn) -{SELFPARAM(); +{ if (!autocvar_g_powerups) { return false; } + entity ent = M_ARGV(0, entity); // Can't use .itemdef here - if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.classname == "item_health_mega")) + if (!(ent.classname == "item_strength" || ent.classname == "item_invincible" || ent.classname == "item_health_mega")) return false; entity e = spawn(); @@ -480,9 +486,9 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, OnEntityPreSpawn) setthink(e, instagib_speed); e.nextthink = time + 0.1; - e.spawnflags = self.spawnflags; - e.noalign = self.noalign; - setorigin(e, self.origin); + e.spawnflags = ent.spawnflags; + e.noalign = ent.noalign; + setorigin(e, ent.origin); return true; } diff --git a/qcsrc/common/mutators/mutator/melee_only/melee_only.qc b/qcsrc/common/mutators/mutator/melee_only/melee_only.qc index 5b03f46ec..ac67ea7cc 100644 --- a/qcsrc/common/mutators/mutator/melee_only/melee_only.qc +++ b/qcsrc/common/mutators/mutator/melee_only/melee_only.qc @@ -15,8 +15,10 @@ MUTATOR_HOOKFUNCTION(melee_only, ForbidThrowCurrentWeapon) } MUTATOR_HOOKFUNCTION(melee_only, FilterItem) -{SELFPARAM(); - switch (self.items) +{ + entity item = M_ARGV(0, entity); + + switch (item.items) { case ITEM_HealthSmall.m_itemid: case ITEM_ArmorSmall.m_itemid: diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 112b2ca01..0c458e379 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -1139,9 +1139,10 @@ NadeOffhand OFFHAND_NADE; STATIC_INIT(OFFHAND_NADE) { OFFHAND_NADE = NEW(NadeOff MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST) { - SELFPARAM(); - if (self.offhand != OFFHAND_NADE || (self.weapons & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) { - nades_CheckThrow(); + entity player = M_ARGV(0, entity); + + if (player.offhand != OFFHAND_NADE || (player.weapons & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) { + WITHSELF(player, nades_CheckThrow()); return true; } return false; diff --git a/qcsrc/common/mutators/mutator/new_toys/new_toys.qc b/qcsrc/common/mutators/mutator/new_toys/new_toys.qc index 014c22508..236bb136f 100644 --- a/qcsrc/common/mutators/mutator/new_toys/new_toys.qc +++ b/qcsrc/common/mutators/mutator/new_toys/new_toys.qc @@ -216,11 +216,13 @@ MUTATOR_HOOKFUNCTION(nt, SetWeaponreplace) } MUTATOR_HOOKFUNCTION(nt, FilterItem) -{SELFPARAM(); - if(nt_IsNewToy(self.weapon) && autocvar_g_new_toys_use_pickupsound) { - self.item_pickupsound = string_null; - self.item_pickupsound_ent = SND_WEAPONPICKUP_NEW_TOYS; +{ + entity item = M_ARGV(0, entity); + + if(nt_IsNewToy(item.weapon) && autocvar_g_new_toys_use_pickupsound) { + item.item_pickupsound = string_null; + item.item_pickupsound_ent = SND_WEAPONPICKUP_NEW_TOYS; } - return 0; + return false; } #endif diff --git a/qcsrc/common/mutators/mutator/nix/nix.qc b/qcsrc/common/mutators/mutator/nix/nix.qc index 5a4df3ea4..025851939 100644 --- a/qcsrc/common/mutators/mutator/nix/nix.qc +++ b/qcsrc/common/mutators/mutator/nix/nix.qc @@ -231,8 +231,10 @@ MUTATOR_HOOKFUNCTION(nix, BuildMutatorsPrettyString) } MUTATOR_HOOKFUNCTION(nix, FilterItem) -{SELFPARAM(); - switch (self.items) +{ + entity item = M_ARGV(0, entity); + + switch (item.items) { case ITEM_HealthSmall.m_itemid: case ITEM_HealthMedium.m_itemid: @@ -256,8 +258,10 @@ MUTATOR_HOOKFUNCTION(nix, FilterItem) } MUTATOR_HOOKFUNCTION(nix, OnEntityPreSpawn) -{SELFPARAM(); - if(self.classname == "target_items") // items triggers cannot work in nix (as they change weapons/ammo) +{ + entity ent = M_ARGV(0, entity); + + if(ent.classname == "target_items") // items triggers cannot work in nix (as they change weapons/ammo) return true; return false; } diff --git a/qcsrc/common/mutators/mutator/overkill/overkill.qc b/qcsrc/common/mutators/mutator/overkill/overkill.qc index fc41bbc3d..1ab051ce2 100644 --- a/qcsrc/common/mutators/mutator/overkill/overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/overkill.qc @@ -296,19 +296,21 @@ void self_spawnfunc_weapon_hmg(entity this) { spawnfunc_weapon_hmg(this); } void self_spawnfunc_weapon_rpc(entity this) { spawnfunc_weapon_rpc(this); } MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn) -{SELFPARAM(); +{ + entity ent = M_ARGV(0, entity); + if(autocvar_g_powerups) if(autocvar_g_overkill_powerups_replace) { - if(self.classname == "item_strength") + if(ent.classname == "item_strength") { entity wep = new(weapon_hmg); - setorigin(wep, self.origin); + setorigin(wep, ent.origin); setmodel(wep, MDL_OK_HMG); wep.ok_item = true; - wep.noalign = self.noalign; - wep.cnt = self.cnt; - wep.team = self.team; + wep.noalign = ent.noalign; + wep.cnt = ent.cnt; + wep.team = ent.team; wep.respawntime = autocvar_g_overkill_superguns_respawn_time; wep.pickup_anyway = true; wep.spawnfunc_checked = true; @@ -317,15 +319,15 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn) return true; } - if(self.classname == "item_invincible") + if(ent.classname == "item_invincible") { entity wep = new(weapon_rpc); - setorigin(wep, self.origin); + setorigin(wep, ent.origin); setmodel(wep, MDL_OK_RPC); wep.ok_item = true; - wep.noalign = self.noalign; - wep.cnt = self.cnt; - wep.team = self.team; + wep.noalign = ent.noalign; + wep.cnt = ent.cnt; + wep.team = ent.team; wep.respawntime = autocvar_g_overkill_superguns_respawn_time; wep.pickup_anyway = true; wep.spawnfunc_checked = true; @@ -339,11 +341,13 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn) } MUTATOR_HOOKFUNCTION(ok, FilterItem) -{SELFPARAM(); - if(self.ok_item) +{ + entity item = M_ARGV(0, entity); + + if(item.ok_item) return false; - switch(self.items) + switch(item.items) { case ITEM_HealthMega.m_itemid: return !(autocvar_g_overkill_100h_anyway); case ITEM_ArmorMega.m_itemid: return !(autocvar_g_overkill_100a_anyway); diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index b2b1d973b..be7dbb8ae 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -971,13 +971,15 @@ float turret_firecheck() return 1; } -bool turret_checkfire() -{SELFPARAM(); - bool ret = false; // dummy - if(MUTATOR_CALLHOOK(Turret_CheckFire, ret)) - return ret_bool; +bool turret_checkfire(entity this) +{ + if(MUTATOR_CALLHOOK(Turret_CheckFire, this)) + return M_ARGV(1, bool); + + bool ret = false; + WITHSELF(this, ret = this.turret_firecheckfunc()); - return self.turret_firecheckfunc(); + return ret; } void turret_fire() @@ -1055,7 +1057,7 @@ void turret_think(entity this) turret_do_updates(self); - if (turret_checkfire()) + if (turret_checkfire(self)) turret_fire(); } } @@ -1079,7 +1081,7 @@ void turret_think(entity this) turret_do_updates(self); // Fire? - if (turret_checkfire()) + if (turret_checkfire(self)) turret_fire(); } else @@ -1099,7 +1101,7 @@ void turret_think(entity this) turret_do_updates(self); // Fire! - if (turret_checkfire()) + if (turret_checkfire(self)) turret_fire(); Turret tur = get_turretinfo(self.m_id); @@ -1161,7 +1163,7 @@ void turret_think(entity this) turret_do_updates(self); // Fire? - if (turret_checkfire()) + if (turret_checkfire(self)) turret_fire(); } diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 7eaf978a9..e667812aa 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -274,8 +274,7 @@ string formatmessage(entity this, string msg) default: { MUTATOR_CALLHOOK(FormatMessage, this, escape, replacement, msg); - escape = format_escape; - replacement = format_replacement; + replacement = M_ARGV(2, string); break; } } diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 143627180..9591efbf2 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -107,26 +107,23 @@ MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy); /** called when formatting a chat message to replace fancy functions */ #define EV_FormatMessage(i, o) \ - /**/ i(entity, __self) \ - /**/ i(string, format_escape) \ - /**/ i(string, format_replacement) \ - /**/ o(string, format_replacement) \ - /**/ i(string, format_message) \ - /**/ -string format_escape; -string format_replacement; -string format_message; + /** player */ i(entity, MUTATOR_ARGV_0_entity) \ + /** escape */ i(string, MUTATOR_ARGV_1_string) \ + /** replacement */ i(string, MUTATOR_ARGV_2_string) \ + /**/ o(string, MUTATOR_ARGV_2_string) \ + /** message */ i(string, MUTATOR_ARGV_3_string) \ + /**/ MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage); /** returns true if throwing the current weapon shall not be allowed */ #define EV_ForbidThrowCurrentWeapon(i, o) \ - /**/ i(entity, __self) \ + /** player */ i(entity, MUTATOR_ARGV_0_entity) \ /**/ MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_ForbidThrowCurrentWeapon); /** returns true if dropping the current weapon shall not be allowed at any time including death */ #define EV_ForbidDropCurrentWeapon(i, o) \ - /**/ i(entity, __self) \ + /** player */ i(entity, MUTATOR_ARGV_0_entity) \ /**/ MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon); @@ -154,8 +151,8 @@ MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS); /** called every frame. customizes the waypoint for spectators */ #define EV_CustomizeWaypoint(i, o) \ - /** waypoint */ i(entity, __self) \ - /** player; other.enemy = spectator */ i(entity, other) \ + /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \ + /** player; other.enemy = spectator */ i(entity, MUTATOR_ARGV_1_entity) \ /**/ MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint); @@ -164,33 +161,32 @@ MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint); * return error to request removal */ #define EV_FilterItem(i, o) \ - /** the current item */ i(entity, __self) \ + /** item */ i(entity, MUTATOR_ARGV_0_entity) \ /**/ MUTATOR_HOOKABLE(FilterItem, EV_FilterItem); /** return error to request removal */ #define EV_TurretSpawn(i, o) \ - /** turret */ i(entity, __self) \ + /** turret */ i(entity, MUTATOR_ARGV_0_entity) \ /**/ MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn); /** return error to not attack */ #define EV_TurretFire(i, o) \ - /** turret */ i(entity, __self) \ + /** turret */ i(entity, MUTATOR_ARGV_0_entity) \ /**/ MUTATOR_HOOKABLE(TurretFire, EV_TurretFire); /** return error to not attack */ #define EV_Turret_CheckFire(i, o) \ - /**/ i(bool, ret_bool) \ - /**/ o(bool, ret_bool) \ + /** turret */ i(entity, MUTATOR_ARGV_0_entity) \ + /** to fire or not to fire */ o(bool, MUTATOR_ARGV_1_bool) \ /**/ -bool ret_bool; MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire); /** return error to prevent entity spawn, or modify the entity */ #define EV_OnEntityPreSpawn(i, o) \ - /** turret */ i(entity, __self) \ + /** entity */ i(entity, MUTATOR_ARGV_0_entity) \ /**/ MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_OnEntityPreSpawn); diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qc b/qcsrc/server/mutators/mutator/gamemode_assault.qc index ca1779486..a377d0368 100644 --- a/qcsrc/server/mutators/mutator/gamemode_assault.qc +++ b/qcsrc/server/mutators/mutator/gamemode_assault.qc @@ -625,9 +625,11 @@ MUTATOR_HOOKFUNCTION(as, PlayerSpawn) } MUTATOR_HOOKFUNCTION(as, TurretSpawn) -{SELFPARAM(); - if(!self.team || self.team == MAX_SHOT_DISTANCE) - self.team = 5; // this gets reversed when match starts? +{ + entity turret = M_ARGV(0, entity); + + if(!turret.team || turret.team == MAX_SHOT_DISTANCE) + turret.team = 5; // this gets reversed when match starts? return false; } @@ -674,8 +676,9 @@ MUTATOR_HOOKFUNCTION(as, ReadLevelCvars) MUTATOR_HOOKFUNCTION(as, OnEntityPreSpawn) { - SELFPARAM(); - switch(self.classname) + entity ent = M_ARGV(0, entity); + + switch(ent.classname) { case "info_player_team1": case "info_player_team2": diff --git a/qcsrc/server/mutators/mutator/gamemode_ca.qc b/qcsrc/server/mutators/mutator/gamemode_ca.qc index ff011b59d..ffb231e7b 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ca.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ca.qc @@ -347,7 +347,7 @@ MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver) MUTATOR_HOOKFUNCTION(ca, ForbidThrowCurrentWeapon) { - return 1; + return true; } MUTATOR_HOOKFUNCTION(ca, GiveFragsForKill, CBC_ORDER_FIRST) @@ -394,9 +394,10 @@ MUTATOR_HOOKFUNCTION(ca, PlayerDamage_Calculate) MUTATOR_HOOKFUNCTION(ca, FilterItem) { - SELFPARAM(); + entity item = M_ARGV(0, entity); + if (autocvar_g_powerups <= 0) - if (this.flags & FL_POWERUP) + if (item.flags & FL_POWERUP) return true; if (autocvar_g_pickup_items <= 0) diff --git a/qcsrc/server/mutators/mutator/gamemode_cts.qc b/qcsrc/server/mutators/mutator/gamemode_cts.qc index cbe6544c4..9bc20a396 100644 --- a/qcsrc/server/mutators/mutator/gamemode_cts.qc +++ b/qcsrc/server/mutators/mutator/gamemode_cts.qc @@ -354,8 +354,10 @@ MUTATOR_HOOKFUNCTION(cts, ForbidThrowCurrentWeapon) } MUTATOR_HOOKFUNCTION(cts, FilterItem) -{SELFPARAM(); - if(self.classname == "droppedweapon") +{ + entity item = M_ARGV(0, entity); + + if(item.classname == "droppedweapon") return true; return false; diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index cfd4f9612..5bf26c4b8 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -376,9 +376,11 @@ MUTATOR_HOOKFUNCTION(inv, MonsterSpawn) } MUTATOR_HOOKFUNCTION(inv, OnEntityPreSpawn) -{SELFPARAM(); - if(startsWith(self.classname, "monster_")) - if(!(self.spawnflags & MONSTERFLAG_SPAWNED)) +{ + entity ent = M_ARGV(0, entity); + + if(startsWith(ent.classname, "monster_")) + if(!(ent.spawnflags & MONSTERFLAG_SPAWNED)) return true; return false; diff --git a/qcsrc/server/mutators/mutator/gamemode_lms.qc b/qcsrc/server/mutators/mutator/gamemode_lms.qc index 8ff6c190a..0e29e7033 100644 --- a/qcsrc/server/mutators/mutator/gamemode_lms.qc +++ b/qcsrc/server/mutators/mutator/gamemode_lms.qc @@ -298,9 +298,11 @@ MUTATOR_HOOKFUNCTION(lms, ForbidPlayerScore_Clear) } MUTATOR_HOOKFUNCTION(lms, FilterItem) -{SELFPARAM(); +{ + entity item = M_ARGV(0, entity); + if(autocvar_g_lms_extra_lives) - if(self.itemdef == ITEM_ExtraLife) + if(item.itemdef == ITEM_ExtraLife) return false; return true; @@ -312,20 +314,22 @@ void lms_extralife(entity this) } MUTATOR_HOOKFUNCTION(lms, OnEntityPreSpawn) -{SELFPARAM(); +{ if (!autocvar_g_powerups) return false; if (!autocvar_g_lms_extra_lives) return false; + entity ent = M_ARGV(0, entity); + // Can't use .itemdef here - if (self.classname != "item_health_mega") return false; + if (ent.classname != "item_health_mega") return false; entity e = spawn(); setthink(e, lms_extralife); e.nextthink = time + 0.1; - e.spawnflags = self.spawnflags; - e.noalign = self.noalign; - setorigin(e, self.origin); + e.spawnflags = ent.spawnflags; + e.noalign = ent.noalign; + setorigin(e, ent.origin); return true; }