]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move spider web slowness entirely into spider file
authorMario <mario@smbclan.net>
Mon, 23 Nov 2015 14:17:19 +0000 (00:17 +1000)
committerMario <mario@smbclan.net>
Mon, 23 Nov 2015 14:17:19 +0000 (00:17 +1000)
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/monsters/sv_monsters.qh
qcsrc/common/physics.qc
qcsrc/server/cl_client.qc

index 10ee911d95c447dbc093dc676e7cbb895501fcf5..a25a89e7dde125194dedfe8124412ed8bc2edc20 100644 (file)
@@ -38,6 +38,8 @@ REGISTER_WEAPON(SPIDER_ATTACK, NEW(SpiderAttack));
 
 #ifdef SVQC
 
+.float spider_slowness; // effect time of slowness inflicted by spiders
+
 .float spider_web_delay;
 
 float autocvar_g_monster_spider_attack_web_damagetime;
@@ -50,6 +52,41 @@ float autocvar_g_monster_spider_attack_bite_delay;
 
 void M_Spider_Attack_Web();
 
+REGISTER_MUTATOR(spiderweb, true);
+
+MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics)
+{
+       if (time >= self.spider_slowness)
+               return false;
+       PHYS_MAXSPEED(self) *= 0.5; // half speed while slow from spider
+       PHYS_MAXAIRSPEED(self) *= 0.5;
+       PHYS_AIRSPEEDLIMIT_NONQW(self) *= 0.5;
+       PHYS_AIRSTRAFEACCELERATE(self) *= 0.5;
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove)
+{
+       if(time < self.spider_slowness)
+       {
+               monster_speed_run *= 0.5;
+               monster_speed_walk *= 0.5;
+       }
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn)
+{
+       self.spider_slowness = 0;
+       return false;
+}
+
+MUTATOR_HOOKFUNCTION(spiderweb, MonsterSpawn)
+{
+       self.spider_slowness = 0;
+       return false;
+}
+
 SOUND(SpiderAttack_FIRE, W_Sound("electro_fire"));
 METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity weaponentity, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
index 7ee3e3eab72d84228fe2360e7d46a8137ede8fe1..45fc349275768074459f11407fd5ccc94269b27f 100644 (file)
@@ -806,12 +806,6 @@ void Monster_Move(float runspeed, float walkspeed, float stpspeed)
        runspeed = bound(0, monster_speed_run * MONSTER_SKILLMOD(self), runspeed * 2.5); // limit maxspeed to prevent craziness
        walkspeed = bound(0, monster_speed_walk * MONSTER_SKILLMOD(self), walkspeed * 2.5); // limit maxspeed to prevent craziness
 
-       if(time < self.spider_slowness)
-       {
-               runspeed *= 0.5;
-               walkspeed *= 0.5;
-       }
-
        if(teamplay)
        if(autocvar_g_monsters_teams)
        if(DIFF_TEAM(self.monster_follow, self))
@@ -1358,7 +1352,6 @@ bool Monster_Spawn(int mon_id)
        self.deadflag                   = DEAD_NO;
        self.noalign                    = ((mon.spawnflags & MONSTER_TYPE_FLY) || (mon.spawnflags & MONSTER_TYPE_SWIM));
        self.spawn_time                 = time;
-       self.spider_slowness    = 0;
        self.gravity                    = 1;
        self.monster_moveto             = '0 0 0';
        self.monster_face               = '0 0 0';
index acf94eb7d78ad9f35b80ed1d9777cc0292889439..bad6242bc5954b914ec9a88da1bc3071728849ca 100644 (file)
@@ -33,7 +33,6 @@ int monsters_killed;
 
 // other properties
 .bool monster_attack; // indicates whether an entity can be attacked by monsters
-.float spider_slowness; // effect time of slowness inflicted by spiders
 
 // monster state declarations
 const int MONSTER_MOVE_FOLLOW = 1; // monster will follow if in range, or stand still
index 34f5663d57478b5d3df05469da3df5d78a019ee9..1cc9db51e2d3cbe32369887c3caa00b1f10ff2df 100644 (file)
@@ -843,18 +843,6 @@ void PM_check_punch()
 #endif
 }
 
-void PM_check_spider()
-{SELFPARAM();
-#ifdef SVQC
-       if (time >= self.spider_slowness)
-               return;
-       PHYS_MAXSPEED(self) *= 0.5; // half speed while slow from spider
-       PHYS_MAXAIRSPEED(self) *= 0.5;
-       PHYS_AIRSPEEDLIMIT_NONQW(self) *= 0.5;
-       PHYS_AIRSTRAFEACCELERATE(self) *= 0.5;
-#endif
-}
-
 // predict frozen movement, as frozen players CAN move in some cases
 void PM_check_frozen()
 {SELFPARAM();
@@ -1448,8 +1436,6 @@ void PM_Main(entity this)
 
        viewloc_PlayerPhysics();
 
-       PM_check_spider();
-
        PM_check_frozen();
 
        PM_check_blocked();
index 6dc4ac881483fed9443e9f34853a82d8d63c759f..fbe028eaffec5518efa0828cf09cc88428c80d6c 100644 (file)
@@ -570,8 +570,6 @@ void PutClientInServer()
                this.bot_attack = true;
                this.monster_attack = true;
 
-               this.spider_slowness = 0;
-
                this.BUTTON_ATCK = this.BUTTON_JUMP = this.BUTTON_ATCK2 = false;
 
                if (this.killcount == FRAGS_SPECTATOR) {