]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/spider.qc
Introduce touch accessors
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / spider.qc
index defa719df559795140016b23b34be56ec7902769..5f8add4ffd08248b837318f1fd7dfbecae8bfc20 100644 (file)
@@ -56,17 +56,19 @@ REGISTER_MUTATOR(spiderweb, true);
 
 MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics)
 {
-       if (time >= self.spider_slowness)
+    SELFPARAM();
+       if (time >= this.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;
+       PHYS_MAXSPEED(this) *= 0.5; // half speed while slow from spider
+       PHYS_MAXAIRSPEED(this) *= 0.5;
+       PHYS_AIRSPEEDLIMIT_NONQW(this) *= 0.5;
+       PHYS_AIRSTRAFEACCELERATE(this) *= 0.5;
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove)
 {
+    SELFPARAM();
        if(time < self.spider_slowness)
        {
                monster_speed_run *= 0.5;
@@ -77,12 +79,14 @@ MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove)
 
 MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn)
 {
+    SELFPARAM();
        self.spider_slowness = 0;
        return false;
 }
 
 MUTATOR_HOOKFUNCTION(spiderweb, MonsterSpawn)
 {
+    SELFPARAM();
        self.spider_slowness = 0;
        return false;
 }
@@ -90,6 +94,7 @@ MUTATOR_HOOKFUNCTION(spiderweb, MonsterSpawn)
 SOUND(SpiderAttack_FIRE, W_Sound("electro_fire"));
 METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity weaponentity, int fire))
 {
+    SELFPARAM();
     TC(SpiderAttack, thiswep);
     bool isPlayer = IS_PLAYER(actor);
     if (fire & 1)
@@ -146,6 +151,11 @@ void M_Spider_Attack_Web_Explode()
        }
 }
 
+void M_Spider_Attack_Web_Explode_use(entity this, entity actor, entity trigger)
+{
+       WITHSELF(this, M_Spider_Attack_Web_Explode());
+}
+
 void M_Spider_Attack_Web_Touch()
 {
        PROJECTILE_TOUCH;
@@ -163,7 +173,7 @@ void M_Spider_Attack_Web(entity this)
 
        entity proj = new(plasma);
        proj.owner = proj.realowner = this;
-       proj.use = M_Spider_Attack_Web_Explode;
+       proj.use = M_Spider_Attack_Web_Explode_use;
        proj.think = adaptor_think2use_hittype_splash;
        proj.bot_dodge = true;
        proj.bot_dodgerating = 0;
@@ -176,7 +186,7 @@ void M_Spider_Attack_Web(entity this)
        //proj.glow_color = 45;
        proj.movetype = MOVETYPE_BOUNCE;
        W_SetupProjVelocity_Explicit(proj, v_forward, v_up, (autocvar_g_monster_spider_attack_web_speed), (autocvar_g_monster_spider_attack_web_speed_up), 0, 0, false);
-       proj.touch = M_Spider_Attack_Web_Touch;
+       settouch(proj, M_Spider_Attack_Web_Touch);
        setsize(proj, '-4 -4 -4', '4 4 4');
        proj.takedamage = DAMAGE_NO;
        proj.damageforcescale = 0;