]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix up even more mutators
authorMario <mario@smbclan.net>
Fri, 10 Jun 2016 07:11:01 +0000 (17:11 +1000)
committerMario <mario@smbclan.net>
Fri, 10 Jun 2016 07:11:01 +0000 (17:11 +1000)
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/events.qh
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/midair/midair.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator/gamemode_invasion.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qc

index fad837f403e27e99abbd740b8961c6f1a2da87c5..58cfe61ea58a41c726fb38afabb05ffeb085cf3e 100644 (file)
@@ -1933,17 +1933,17 @@ MUTATOR_HOOKFUNCTION(ons, PlayerDies)
 }
 
 MUTATOR_HOOKFUNCTION(ons, MonsterMove)
-{SELFPARAM();
-       entity e = find(world, targetname, self.target);
-       if (e != world)
-               self.team = e.team;
+{
+       entity mon = M_ARGV(0, entity);
 
-       return false;
+       entity e = find(world, targetname, mon.target);
+       if (e != world)
+               mon.team = e.team;
 }
 
 void ons_MonsterSpawn_Delayed(entity this)
 {
-       entity own = self.owner;
+       entity own = this.owner;
 
        if(!own) { remove(this); return; }
 
@@ -1962,12 +1962,12 @@ void ons_MonsterSpawn_Delayed(entity this)
 }
 
 MUTATOR_HOOKFUNCTION(ons, MonsterSpawn)
-{SELFPARAM();
+{
+       entity mon = M_ARGV(0, entity);
+
        entity e = spawn();
-       e.owner = self;
+       e.owner = mon;
        InitializeEntity(e, ons_MonsterSpawn_Delayed, INITPRIO_FINDTARGET);
-
-       return false;
 }
 
 void ons_TurretSpawn_Delayed(entity this)
index 8727b798d6909285c0e5b5084336bfa7887ebba0..6ec111b1f791daf09808baf0fc4b4059521af1ad 100644 (file)
@@ -68,13 +68,13 @@ MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics)
 
 MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove)
 {
-    SELFPARAM();
-       if(time < self.spider_slowness)
+    entity mon = M_ARGV(0, entity);
+
+       if(time < mon.spider_slowness)
        {
-               monster_speed_run *= 0.5;
-               monster_speed_walk *= 0.5;
+               M_ARGV(1, float) *= 0.5; // run speed
+               M_ARGV(2, float) *= 0.5; // walk speed
        }
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn)
@@ -87,9 +87,9 @@ MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn)
 
 MUTATOR_HOOKFUNCTION(spiderweb, MonsterSpawn)
 {
-    SELFPARAM();
-       self.spider_slowness = 0;
-       return false;
+    entity mon = M_ARGV(0, entity);
+
+       mon.spider_slowness = 0;
 }
 
 SOUND(SpiderAttack_FIRE, W_Sound("electro_fire"));
index f641d7944fce06f77fee7f12bd296853274397c5..1ae7e83a914f83d21b628a482ce38c8866e5a8dc 100644 (file)
@@ -795,9 +795,9 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
                return;
        }
 
-       targ = monster_target;
-       runspeed = bound(0, monster_speed_run * MONSTER_SKILLMOD(this), runspeed * 2.5); // limit maxspeed to prevent craziness
-       walkspeed = bound(0, monster_speed_walk * MONSTER_SKILLMOD(this), walkspeed * 2.5); // limit maxspeed to prevent craziness
+       targ = M_ARGV(3, entity);
+       runspeed = bound(0, M_ARGV(1, float) * MONSTER_SKILLMOD(this), runspeed * 2.5); // limit maxspeed to prevent craziness
+       walkspeed = bound(0, M_ARGV(2, float) * MONSTER_SKILLMOD(this), walkspeed * 2.5); // limit maxspeed to prevent craziness
 
        if(teamplay)
        if(autocvar_g_monsters_teams)
index 58f9c43d0a89d11b25d5da27088cde095bbbedd1..cae6b19842db105e39c08cecc0c20c459700fff4 100644 (file)
@@ -28,6 +28,8 @@ MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 5)
 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 6)
 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 7)
 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 8)
+MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 9)
+MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 10)
 
 #undef MUTATOR_TYPES
 #undef MUTATOR_NEWGLOBAL
index b97124a394abd07466e15279ff701587d208dc13..ea9511db2ce5e30ca0fddd10efe831aa66e83217 100644 (file)
@@ -671,14 +671,14 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerJump)
 }
 
 MUTATOR_HOOKFUNCTION(buffs, MonsterMove)
-{SELFPARAM();
-       if(time < self.buff_disability_time)
+{
+       entity mon = M_ARGV(0, entity);
+
+       if(time < mon.buff_disability_time)
        {
-               monster_speed_walk *= autocvar_g_buffs_disability_speed;
-               monster_speed_run *= autocvar_g_buffs_disability_speed;
+               M_ARGV(1, float) *= autocvar_g_buffs_disability_speed; // run speed
+               M_ARGV(2, float) *= autocvar_g_buffs_disability_speed; // walk speed
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs, PlayerDies)
index ec96d462601d92aa2b189307a2fa0d532b2b4a5a..c913be742d6969288130207b56e261486b711978 100644 (file)
@@ -153,10 +153,12 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, MonsterDropItem)
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, MonsterSpawn)
-{SELFPARAM();
+{
+       entity mon = M_ARGV(0, entity);
+
        // always refill ammo
-       if(self.monsterid == MON_MAGE.monsterid)
-               self.skin = 1;
+       if(mon.monsterid == MON_MAGE.monsterid)
+               mon.skin = 1;
 
        return false;
 }
@@ -196,52 +198,53 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerRegen)
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPowerups)
-{SELFPARAM();
-       if (!(self.effects & EF_FULLBRIGHT))
-               self.effects |= EF_FULLBRIGHT;
+{
+       entity player = M_ARGV(0, entity);
 
-       if (self.items & ITEM_Invisibility.m_itemid)
+       if (!(player.effects & EF_FULLBRIGHT))
+               player.effects |= EF_FULLBRIGHT;
+
+       if (player.items & ITEM_Invisibility.m_itemid)
        {
-               play_countdown(self.strength_finished, SND_POWEROFF);
-               if (time > self.strength_finished)
+               play_countdown(player.strength_finished, SND_POWEROFF);
+               if (time > player.strength_finished)
                {
-                       self.alpha = default_player_alpha;
-                       self.exteriorweaponentity.alpha = default_weapon_alpha;
-                       self.items &= ~ITEM_Invisibility.m_itemid;
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
+                       player.alpha = default_player_alpha;
+                       player.exteriorweaponentity.alpha = default_weapon_alpha;
+                       player.items &= ~ITEM_Invisibility.m_itemid;
+                       Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
                }
        }
        else
        {
-               if (time < self.strength_finished)
+               if (time < player.strength_finished)
                {
-                       self.alpha = autocvar_g_instagib_invis_alpha;
-                       self.exteriorweaponentity.alpha = autocvar_g_instagib_invis_alpha;
-                       self.items |= ITEM_Invisibility.m_itemid;
-                       Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname);
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
+                       player.alpha = autocvar_g_instagib_invis_alpha;
+                       player.exteriorweaponentity.alpha = autocvar_g_instagib_invis_alpha;
+                       player.items |= ITEM_Invisibility.m_itemid;
+                       Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, player.netname);
+                       Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
                }
        }
 
-       if (self.items & ITEM_Speed.m_itemid)
+       if (player.items & ITEM_Speed.m_itemid)
        {
-               play_countdown(self.invincible_finished, SND_POWEROFF);
-               if (time > self.invincible_finished)
+               play_countdown(player.invincible_finished, SND_POWEROFF);
+               if (time > player.invincible_finished)
                {
-                       self.items &= ~ITEM_Speed.m_itemid;
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED);
+                       player.items &= ~ITEM_Speed.m_itemid;
+                       Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERDOWN_SPEED);
                }
        }
        else
        {
-               if (time < self.invincible_finished)
+               if (time < player.invincible_finished)
                {
-                       self.items |= ITEM_Speed.m_itemid;
-                       Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, self.netname);
-                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED);
+                       player.items |= ITEM_Speed.m_itemid;
+                       Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, player.netname);
+                       Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERUP_SPEED);
                }
        }
-       return false;
 }
 
 .float stat_sv_maxspeed;
index c9a62f34932c1405abe3ac0d94fe5b949204c5c9..cc426a36d7f513c6dd91c22bb1f98243cc2078f0 100644 (file)
@@ -20,12 +20,14 @@ MUTATOR_HOOKFUNCTION(midair, PlayerDamage_Calculate)
 }
 
 MUTATOR_HOOKFUNCTION(midair, PlayerPowerups)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        if(time >= game_starttime)
-       if(IS_ONGROUND(self))
+       if(IS_ONGROUND(player))
        {
-               self.effects |= (EF_ADDITIVE | EF_FULLBRIGHT);
-               self.midair_shieldtime = max(self.midair_shieldtime, time + autocvar_g_midair_shieldtime);
+               player.effects |= (EF_ADDITIVE | EF_FULLBRIGHT);
+               player.midair_shieldtime = max(player.midair_shieldtime, time + autocvar_g_midair_shieldtime);
        }
 
        return false;
index 9591efbf21f90b619d707f2840d331136ce0427e..b66b394afb7eef48f003dce1f80b1379ce78e70c 100644 (file)
@@ -214,7 +214,7 @@ MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
 
 /** called when a monster spawns */
 #define EV_MonsterSpawn(i, o) \
-    /**/ i(entity, __self) \
+    /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn);
 
@@ -228,23 +228,22 @@ MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
 
 /** called when a monster dies */
 #define EV_MonsterRemove(i, o) \
-    /**/ i(entity, rem_mon) \
+    /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
-entity rem_mon; // avoiding ovewriting self & other
 MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove);
 
 /** called when a monster wants to respawn */
 #define EV_MonsterRespawn(i, o) \
-    /**/ i(entity, other) \
+    /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
 
 /** called when a monster is dropping loot */
 #define EV_MonsterDropItem(i, o) \
-    /* monster */ i(entity, MUTATOR_ARGV_0_entity) \
+    /* monster */                          i(entity, MUTATOR_ARGV_0_entity) \
     /* item (can be removed or changed) */ i(entity, MUTATOR_ARGV_1_entity) \
-    /**/ o(entity, MUTATOR_ARGV_1_entity) \
-    /* attacker */ i(entity, MUTATOR_ARGV_2_entity) \
+    /**/                                   o(entity, MUTATOR_ARGV_1_entity) \
+    /* attacker */                         i(entity, MUTATOR_ARGV_2_entity) \
     /**/
 .void(entity this) monster_loot;
 MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
@@ -254,16 +253,13 @@ MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
  * returning true makes the monster stop
  */
 #define EV_MonsterMove(i, o) \
-    /**/ i(entity, __self) \
-    /**/ i(float, monster_speed_run) \
-    /**/ o(float, monster_speed_run) \
-    /**/ i(float, monster_speed_walk) \
-    /**/ o(float, monster_speed_walk) \
-    /**/ i(entity, monster_target) \
-    /**/
-float monster_speed_run;
-float monster_speed_walk;
-entity monster_target;
+    /** monster */       i(entity, MUTATOR_ARGV_0_entity) \
+    /** run speed */     i(float, MUTATOR_ARGV_1_float) \
+    /**/                 o(float, MUTATOR_ARGV_1_float) \
+    /** walk speed */    i(float, MUTATOR_ARGV_2_float) \
+    /**/                 o(float, MUTATOR_ARGV_2_float) \
+    /** move target */   i(entity, MUTATOR_ARGV_3_entity) \
+    /**/
 MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
 
 /** called when a monster looks for another target */
@@ -271,7 +267,7 @@ MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
 
 /** called to change a random monster to a miniboss */
 #define EV_MonsterCheckBossFlag(i, o) \
-    /**/ i(entity, __self) \
+    /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_MonsterCheckBossFlag);
 
@@ -345,10 +341,9 @@ MUTATOR_HOOKABLE(W_Reload, EV_W_Reload);
 
 /** called at the end of player_powerups() in cl_client.qc, used for manipulating the values which are set by powerup items. */
 #define EV_PlayerPowerups(i, o) \
-    /**/ i(entity, __self) \
-    /**/ i(int, olditems) \
+    /** player */    i(entity, MUTATOR_ARGV_0_entity) \
+    /** old items */ i(int, MUTATOR_ARGV_1_int) \
     /**/
-int olditems;
 MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
 
 /**
index 5bf26c4b8840f5fb3da80d32c0fd815fef1451fb..d0606853c97d7cd0a5dddea18da802cc68b856fd 100644 (file)
@@ -355,22 +355,24 @@ MUTATOR_HOOKFUNCTION(inv, MonsterDies)
 }
 
 MUTATOR_HOOKFUNCTION(inv, MonsterSpawn)
-{SELFPARAM();
-       if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
+{
+       entity mon = M_ARGV(0, entity);
+
+       if(!(mon.spawnflags & MONSTERFLAG_SPAWNED))
                return true;
 
-       if(!(self.spawnflags & MONSTERFLAG_RESPAWNED))
+       if(!(mon.spawnflags & MONSTERFLAG_RESPAWNED))
        {
                inv_numspawned += 1;
                inv_maxcurrent += 1;
        }
 
-       self.monster_skill = inv_monsterskill;
+       mon.monster_skill = inv_monsterskill;
 
-       if((get_monsterinfo(self.monsterid)).spawnflags & MON_FLAG_SUPERMONSTER)
-               Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_INVASION_SUPERMONSTER, self.monster_name);
+       if((get_monsterinfo(mon.monsterid)).spawnflags & MON_FLAG_SUPERMONSTER)
+               Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_INVASION_SUPERMONSTER, mon.monster_name);
 
-       self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP;
+       mon.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP;
 
        return false;
 }
index d13e6220026852395176dc761e65ab462f9029d5..e9e2efcc221047aba9e26df111492d3fa06832d2 100644 (file)
@@ -423,16 +423,16 @@ MUTATOR_HOOKFUNCTION(ka, MakePlayerObserver)
 }
 
 MUTATOR_HOOKFUNCTION(ka, PlayerPowerups)
-{SELFPARAM();
+{
+       entity player = M_ARGV(0, entity);
+
        // In the future this hook is supposed to allow me to do some extra stuff with waypointsprites and invisibility powerup
        // So bare with me until I can fix a certain bug with ka_ballcarrier_waypointsprite_visible_for_player()
 
-       self.effects &= ~autocvar_g_keepaway_ballcarrier_effects;
+       player.effects &= ~autocvar_g_keepaway_ballcarrier_effects;
 
-       if(self.ballcarried)
-               self.effects |= autocvar_g_keepaway_ballcarrier_effects;
-
-       return false;
+       if(player.ballcarried)
+               player.effects |= autocvar_g_keepaway_ballcarrier_effects;
 }
 
 .float stat_sv_airspeedlimit_nonqw;