]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/blaster.qh
Added offhand blaster.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / blaster.qh
index 990add96bd8f271fe30571b524b148ba38536245..9d28e73772dd3405046d24ad5f7dcebae4ba0209 100644 (file)
@@ -1,7 +1,8 @@
 #pragma once
 
 CLASS(Blaster, Weapon)
-/* ammotype  */ //ATTRIB(Blaster, ammo_field, .int, ammo_none);
+/* spawnfunc */ ATTRIB(Blaster, m_canonical_spawnfunc, string, "weapon_blaster");
+/* ammotype  */ //ATTRIB(Blaster, ammo_type, int, RESOURCE_NONE);
 /* impulse   */ ATTRIB(Blaster, impulse, int, 1);
 /* flags     */ ATTRIB(Blaster, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(Blaster, bot_pickupbasevalue, float, 0);
@@ -44,10 +45,38 @@ CLASS(Blaster, Weapon)
 ENDCLASS(Blaster)
 REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster));
 
+SPAWNFUNC_WEAPON(weapon_blaster, WEP_BLASTER)
+SPAWNFUNC_WEAPON(weapon_laser, WEP_BLASTER)
+
+CLASS(OffhandBlaster, OffhandWeapon)
+ENDCLASS(OffhandBlaster)
+OffhandBlaster OFFHAND_BLASTER; STATIC_INIT(OFFHAND_BLASTER) { OFFHAND_BLASTER = NEW(OffhandBlaster); }
+
 #ifdef SVQC
 .float blaster_damage;
 .float blaster_edgedamage;
 .float blaster_radius;
 .float blaster_force;
 .float blaster_lifetime;
+
+#define BLASTER_SECONDARY_ATTACK_HACK(weapon_name, actor, weaponentity) \
+       makevectors(actor.v_angle); \
+       Weapon oldwep = actor.(weaponentity).m_weapon; \
+       actor.(weaponentity).m_weapon = WEP_BLASTER; \
+       W_Blaster_Attack( \
+               actor, \
+               weaponentity, \
+               WEP_BLASTER.m_id | HITTYPE_SECONDARY, \
+               WEP_CVAR_SEC(weapon_name, shotangle), \
+               WEP_CVAR_SEC(weapon_name, damage), \
+               WEP_CVAR_SEC(weapon_name, edgedamage), \
+               WEP_CVAR_SEC(weapon_name, radius), \
+               WEP_CVAR_SEC(weapon_name, force), \
+               WEP_CVAR_SEC(weapon_name, speed), \
+               WEP_CVAR_SEC(weapon_name, spread), \
+               WEP_CVAR_SEC(weapon_name, delay), \
+               WEP_CVAR_SEC(weapon_name, lifetime) \
+       ); \
+       actor.(weaponentity).m_weapon = oldwep;
+
 #endif