]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/blaster.qc
Introduce touch accessors
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / blaster.qc
index 362666d27c2bc98f48d1cb6f0d0ebb10554980df..56465e5c8809b62146e684779d1e1c3676a2a130 100644 (file)
@@ -98,10 +98,10 @@ void W_Blaster_Attack(
        float atk_spread,
        float atk_delay,
        float atk_lifetime)
-{SELFPARAM();
+{
        vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
 
-       W_SetupShot_Dir(actor, s_forward, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_B, atk_damage);
+       W_SetupShot_Dir(actor, s_forward, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, atk_damage);
        Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
        entity missile = new(blasterbolt);
@@ -135,7 +135,7 @@ void W_Blaster_Attack(
        //missile.glow_color = 250; // 244, 250
        //missile.glow_size = 120;
 
-       missile.touch = W_Blaster_Touch;
+       settouch(missile, W_Blaster_Touch);
        missile.flags = FL_PROJECTILE;
        missile.missile_flags = MIF_SPLASH;
        missile.projectiledeathtype = atk_deathtype;
@@ -146,21 +146,22 @@ void W_Blaster_Attack(
 
        if (time >= missile.nextthink)
        {
-               WITH(entity, self, missile, missile.think());
+               WITHSELF(missile, missile.think());
        }
 }
 
 METHOD(Blaster, wr_aim, void(entity thiswep))
 {
+    SELFPARAM();
     if(WEP_CVAR(blaster, secondary))
     {
         if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
-            { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
+            { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
         else
-            { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
+            { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
     }
     else
-        { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
+        { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
 }
 
 METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire))
@@ -224,15 +225,16 @@ METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponenti
 
 METHOD(Blaster, wr_setup, void(entity thiswep))
 {
+    SELFPARAM();
     self.ammo_field = ammo_none;
 }
 
-METHOD(Blaster, wr_checkammo1, bool(entity thiswep))
+METHOD(Blaster, wr_checkammo1, bool(entity thiswep, entity actor))
 {
     return true; // infinite ammo
 }
 
-METHOD(Blaster, wr_checkammo2, bool(entity thiswep))
+METHOD(Blaster, wr_checkammo2, bool(entity thiswep, entity actor))
 {
     return true; // blaster has infinite ammo
 }
@@ -252,6 +254,7 @@ METHOD(Blaster, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Blaster, wr_impacteffect, void(entity thiswep))
 {
+    SELFPARAM();
     vector org2;
     org2 = w_org + w_backoff * 6;
     pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);