From: Mario Date: Mon, 23 Nov 2015 14:17:19 +0000 (+1000) Subject: Move spider web slowness entirely into spider file X-Git-Tag: xonotic-v0.8.2~1630 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=91a6efb76c9a91eb7e888e0d001bf3079c3500de;p=xonotic%2Fxonotic-data.pk3dir.git Move spider web slowness entirely into spider file --- diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 10ee911d9..a25a89e7d 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -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); diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 7ee3e3eab..45fc34927 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -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'; diff --git a/qcsrc/common/monsters/sv_monsters.qh b/qcsrc/common/monsters/sv_monsters.qh index acf94eb7d..bad6242bc 100644 --- a/qcsrc/common/monsters/sv_monsters.qh +++ b/qcsrc/common/monsters/sv_monsters.qh @@ -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 diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index 34f5663d5..1cc9db51e 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -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(); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 6dc4ac881..fbe028eaf 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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) {