]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/wyvern.qc
Weapons: pass weaponentity field instead of slot
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / wyvern.qc
index 5cac8982920d5e781c00e67adac8b94f5d0f21ae..ebf178f40dae87455ec2e9c76e98fe3f47cf7f9c 100644 (file)
@@ -48,9 +48,9 @@ float autocvar_g_monster_wyvern_attack_fireball_speed;
 void M_Wyvern_Attack_Fireball_Explode();
 void M_Wyvern_Attack_Fireball_Touch();
 
-METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, int slot, int fire)) {
+METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire)) {
     if (fire & 1)
-    if (time > actor.attack_finished_single[0] || weapon_prepareattack(thiswep, actor, slot, false, 1.2)) {
+    if (time > actor.attack_finished_single[0] || weapon_prepareattack(thiswep, actor, weaponentity, false, 1.2)) {
         if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
                if (IS_MONSTER(actor)) {
                        actor.attack_finished_single[0] = time + 1.2;
@@ -73,7 +73,7 @@ METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, int slot
                missile.touch = M_Wyvern_Attack_Fireball_Touch;
                CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
 
-        weapon_thinkf(actor, slot, WFRAME_FIRE1, 0, w_ready);
+        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
     }
 }
 
@@ -121,6 +121,7 @@ void M_Wyvern_Attack_Fireball_Touch()
 float M_Wyvern_Attack(float attack_type, entity targ)
 {
        SELFPARAM();
+       .entity weaponentity = weaponentities[0];
        switch(attack_type)
        {
                case MONSTER_ATTACK_MELEE:
@@ -128,7 +129,7 @@ float M_Wyvern_Attack(float attack_type, entity targ)
                {
                        w_shotdir = normalize((self.enemy.origin + '0 0 10') - self.origin);
                        Weapon wep = WEP_WYVERN_ATTACK;
-                       wep.wr_think(wep, self, 0, 1);
+                       wep.wr_think(wep, self, weaponentity, 1);
                        return true;
                }
        }