]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Player usable vehicle attack
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 26 Sep 2015 02:31:33 +0000 (12:31 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 26 Sep 2015 02:31:33 +0000 (12:31 +1000)
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/turrets/unit/plasma_dual.qc
qcsrc/common/vehicles/unit/racer.qc
qcsrc/common/weapons/all.qh

index e8e38824b10b8fb14240db49d67830c27055b242..a3114812b61f8ccc1ca41ecf5fcb71fc4843bd5e 100644 (file)
@@ -15,9 +15,11 @@ REGISTER_MONSTER_SIMPLE(
 #endif
 }
 
+#include "../../weapons/all.qh"
+
 CLASS(MageSpike, PortoLaunch)
 /* flags     */ ATTRIB(MageSpike, spawnflags, int, WEP_TYPE_OTHER);
-/* impulse   */ ATTRIB(MageSpike, impulse, int, 5);
+/* impulse   */ ATTRIB(MageSpike, impulse, int, 9);
 /* refname   */ ATTRIB(MageSpike, netname, string, "magespike");
 /* wepname   */ ATTRIB(MageSpike, message, string, _("Mage spike"));
 ENDCLASS(MageSpike)
index 78cfbe95a492f03fb55d710f46aa7d48c50d0523..7f761bad15cdcb5bdeeb939fbe3cc28ce4fcd304 100644 (file)
@@ -11,6 +11,8 @@ REGISTER_TURRET(
 );
 #else
 
+#include "../../weapons/all.qh"
+
 CLASS(PlasmaDualAttack, PortoLaunch)
 /* flags     */ ATTRIB(PlasmaDualAttack, spawnflags, int, WEP_TYPE_OTHER);
 /* impulse   */ ATTRIB(PlasmaDualAttack, impulse, int, 5);
@@ -28,7 +30,6 @@ METHOD(PlasmaDualAttack, wr_think, bool(entity thiswep)) {
        SELFPARAM();
        if (self.BUTTON_ATCK)
        if (weapon_prepareattack(0, WEP_CVAR_PRI(electro, refire))) {
-               if (!self.target_range) self.target_range = autocvar_g_monsters_target_range;
                W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
                self.tur_shotdir_updated = w_shotdir;
                self.tur_shotorg = w_shotorg;
index 62a6e850fdb2c4bcc1c2b7f5bb029b39d6451889..4f8325517830b38fb39a15437963ca66624cb3c5 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef VEHICLE_RACER
 #define VEHICLE_RACER
+
 #ifndef MENUQC
 int v_racer(int);
 #endif
@@ -19,6 +20,19 @@ REGISTER_VEHICLE_SIMPLE(
     this.vehicle_func = v_racer;
 #endif
 }
+
+#include "../../weapons/all.qh"
+
+CLASS(RacerAttack, PortoLaunch)
+/* flags     */ ATTRIB(RacerAttack, spawnflags, int, WEP_TYPE_OTHER);
+/* impulse   */ ATTRIB(RacerAttack, impulse, int, 3);
+/* refname   */ ATTRIB(RacerAttack, netname, string, "racercannon");
+/* wepname   */ ATTRIB(RacerAttack, message, string, _("Racer cannon"));
+ENDCLASS(RacerAttack)
+REGISTER_WEAPON(RACER, NEW(RacerAttack)) {
+       localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", this.netname, 230 + this.m_id - 1));
+}
+
 #endif
 
 #ifdef IMPLEMENTATION
@@ -26,6 +40,18 @@ REGISTER_VEHICLE_SIMPLE(
 #include "../../effects/effects.qh"
 #include "../../triggers/trigger/impulse.qh"
 
+void racer_fire_cannon(string tagname);
+METHOD(RacerAttack, wr_think, bool(entity thiswep)) {
+       SELFPARAM();
+       if (self.BUTTON_ATCK)
+       if (weapon_prepareattack(0, 0)) {
+               W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("lasergun_fire"), CH_WEAPON_B, 0);
+               racer_fire_cannon("tag_fire1");
+               weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), w_ready);
+       }
+       return true;
+}
+
 bool autocvar_g_vehicle_racer;
 
 float autocvar_g_vehicle_racer_speed_afterburn;
index e7f66e9795c5ef39c61ebecfca77108f15ab360f..c2ed2af7bef0ac769898438c95475abaa67b7989 100644 (file)
@@ -104,7 +104,7 @@ WepSet ReadWepSet();
 
 // weapon name macros
 const int WEP_FIRST = 1;
-#define WEP_MAXCOUNT 24 // Increase as needed. Can be up to three times as much.
+#define WEP_MAXCOUNT 32 // Increase as needed. Can be up to 72.
 int WEP_COUNT;
 #define WEP_LAST (WEP_FIRST + WEP_COUNT - 1)
 WepSet WEPSET_ALL;