]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/overkill/okmachinegun.qc
Merged Lyberta/URS3 into Lyberta/StandaloneOverkillWeapons.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / overkill / okmachinegun.qc
index 38eea00254295f451a4bf68eb7138d086f842c2f..d874304432182434b9be139c905ea9a8ae2865f1 100644 (file)
@@ -154,6 +154,22 @@ METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity
                        WEP_CVAR_SEC(okmachinegun, lifetime)
                );
                actor.(weaponentity).m_weapon = oldwep;
+               if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
+                       (actor.(weaponentity).wframe == WFRAME_FIRE2))
+               {
+                       // Set secondary fire animation.
+                       vector a = '0 0 0';
+                       actor.(weaponentity).wframe = WFRAME_FIRE2;
+                       a = actor.(weaponentity).anim_fire2;
+                       a.z *= g_weaponratefactor;
+                       FOREACH_CLIENT(true, LAMBDA(
+                               if (it == actor || (IS_SPEC(it) && it.enemy == actor))
+                               {
+                                       wframe_send(it, actor.(weaponentity), a, true);
+                               }
+                       ));
+                       animdecide_setaction(actor, ANIMACTION_SHOOT, true);
+               }
        }
        if (WEP_CVAR(okmachinegun, reload_ammo) && actor.(weaponentity).clip_load < min(max(WEP_CVAR(okmachinegun, sustained_ammo), WEP_CVAR(okmachinegun, first_ammo)), WEP_CVAR(okmachinegun, burst_ammo)))
        {
@@ -247,17 +263,24 @@ METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity
 METHOD(OverkillMachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
        float ammo_amount;
-       if(WEP_CVAR(okmachinegun, mode) == 1)
-               ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(okmachinegun, sustained_ammo);
+       if (WEP_CVAR(okmachinegun, mode) == 1)
+       {
+               ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(okmachinegun, sustained_ammo);
+       }
        else
-               ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(okmachinegun, first_ammo);
-
-       if(WEP_CVAR(okmachinegun, reload_ammo))
        {
-               if(WEP_CVAR(okmachinegun, mode) == 1)
+               ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(okmachinegun, first_ammo);
+       }
+       if (WEP_CVAR(okmachinegun, reload_ammo))
+       {
+               if (WEP_CVAR(okmachinegun, mode) == 1)
+               {
                        ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_MACHINEGUN.m_id]) >= WEP_CVAR(okmachinegun, sustained_ammo);
+               }
                else
+               {
                        ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_MACHINEGUN.m_id]) >= WEP_CVAR(okmachinegun, first_ammo);
+               }
        }
        return ammo_amount;
 }
@@ -265,17 +288,24 @@ METHOD(OverkillMachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .en
 METHOD(OverkillMachineGun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
 {
        float ammo_amount;
-       if(WEP_CVAR(okmachinegun, mode) == 1)
-               ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(okmachinegun, burst_ammo);
+       if (WEP_CVAR(okmachinegun, mode) == 1)
+       {
+               ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(okmachinegun, burst_ammo);
+       }
        else
-               ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(okmachinegun, first_ammo);
-
-       if(WEP_CVAR(okmachinegun, reload_ammo))
        {
-               if(WEP_CVAR(okmachinegun, mode) == 1)
+               ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(okmachinegun, first_ammo);
+       }
+       if (WEP_CVAR(okmachinegun, reload_ammo))
+       {
+               if (WEP_CVAR(okmachinegun, mode) == 1)
+               {
                        ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_MACHINEGUN.m_id]) >= WEP_CVAR(okmachinegun, burst_ammo);
+               }
                else
+               {
                        ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_MACHINEGUN.m_id]) >= WEP_CVAR(okmachinegun, first_ammo);
+               }
        }
        return ammo_amount;
 }