]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/spider.qc
Merge branch 'master' into Mario/monsters
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / spider.qc
index a29f20b398842b36b0a9d0ab53b60b5f3b0f3984..90b1d3218a46b6474035cee00865b19ac75f3ce0 100644 (file)
@@ -6,8 +6,6 @@
 
 #ifdef SVQC
 
-.float spider_slowness; // effect time of slowness inflicted by spiders
-
 .float spider_web_delay;
 
 float autocvar_g_monster_spider_attack_web_damagetime;
@@ -27,7 +25,7 @@ MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics_UpdateStats)
 {
        entity player = M_ARGV(0, entity);
 
-       if(time < player.spider_slowness)
+       if(StatusEffects_active(STATUSEFFECT_Webbed, player))
                STAT(MOVEVARS_HIGHSPEED, player) *= 0.5;
 }
 
@@ -35,28 +33,13 @@ MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove)
 {
     entity mon = M_ARGV(0, entity);
 
-       if(time < mon.spider_slowness)
+       if(StatusEffects_active(STATUSEFFECT_Webbed, mon))
        {
                M_ARGV(1, float) *= 0.5; // run speed
                M_ARGV(2, float) *= 0.5; // walk speed
        }
 }
 
-MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn)
-{
-       entity player = M_ARGV(0, entity);
-
-       player.spider_slowness = 0;
-       return false;
-}
-
-MUTATOR_HOOKFUNCTION(spiderweb, MonsterSpawn)
-{
-    entity mon = M_ARGV(0, entity);
-
-       mon.spider_slowness = 0;
-}
-
 SOUND(SpiderAttack_FIRE, W_Sound("electro_fire"));
 METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity weaponentity, int fire))
 {
@@ -114,7 +97,7 @@ void M_Spider_Attack_Web_Explode(entity this)
 
                FOREACH_ENTITY_RADIUS(this.origin, 25, it != this && it.takedamage && !IS_DEAD(it) && GetResource(it, RES_HEALTH) > 0 && it.monsterdef != MON_SPIDER,
                {
-                       it.spider_slowness = time + (autocvar_g_monster_spider_attack_web_damagetime);
+                       StatusEffects_apply(STATUSEFFECT_Webbed, it, time + autocvar_g_monster_spider_attack_web_damagetime, 0);
                });
 
                delete(this);