6297bdf37b5f78875414d9ee01f8df09fd5cce36
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / blaster.qh
1 #pragma once
2
3 CLASS(Blaster, Weapon)
4 /* spawnfunc */ ATTRIB(Blaster, m_canonical_spawnfunc, string, "weapon_blaster");
5 /* ammotype  */ //ATTRIB(Blaster, ammo_type, int, RES_NONE);
6 /* impulse   */ ATTRIB(Blaster, impulse, int, 1);
7 /* flags     */ ATTRIB(Blaster, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
8 /* rating    */ ATTRIB(Blaster, bot_pickupbasevalue, float, 0);
9 /* color     */ ATTRIB(Blaster, wpcolor, vector, '1 0.5 0.5');
10 /* modelname */ ATTRIB(Blaster, mdl, string, "laser");
11 #ifdef GAMEQC
12 /* model     */ ATTRIB(Blaster, m_model, Model, MDL_BLASTER_ITEM);
13 #endif
14 /* crosshair */ ATTRIB(Blaster, w_crosshair, string, "gfx/crosshairlaser");
15 /* crosshair */ ATTRIB(Blaster, w_crosshair_size, float, 0.5);
16 /* wepimg    */ ATTRIB(Blaster, model2, string, "weaponlaser");
17 /* refname   */ ATTRIB(Blaster, netname, string, "blaster");
18 /* wepname   */ ATTRIB(Blaster, m_name, string, _("Blaster"));
19
20 #define X(BEGIN, P, END, class, prefix) \
21         BEGIN(class) \
22                 P(class, prefix, animtime, float, BOTH) \
23                 P(class, prefix, damage, float, BOTH) \
24                 P(class, prefix, delay, float, BOTH) \
25                 P(class, prefix, edgedamage, float, BOTH) \
26                 P(class, prefix, force, float, BOTH) \
27                 P(class, prefix, force_zscale, float, BOTH) \
28                 P(class, prefix, lifetime, float, BOTH) \
29                 P(class, prefix, radius, float, BOTH) \
30                 P(class, prefix, refire, float, BOTH) \
31                 P(class, prefix, secondary, float, NONE) \
32                 P(class, prefix, shotangle, float, BOTH) \
33                 P(class, prefix, speed, float, BOTH) \
34                 P(class, prefix, spread, float, BOTH) \
35         P(class, prefix, switchdelay_drop, float, NONE) \
36                 P(class, prefix, switchdelay_raise, float, NONE) \
37         P(class, prefix, weaponreplace, string, NONE) \
38         P(class, prefix, weaponstartoverride, float, NONE) \
39         P(class, prefix, weaponstart, float, NONE) \
40         P(class, prefix, weaponthrowable, float, NONE) \
41         END()
42         W_PROPS(X, Blaster, blaster)
43 #undef X
44
45 ENDCLASS(Blaster)
46 REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster));
47
48 SPAWNFUNC_WEAPON(weapon_blaster, WEP_BLASTER)
49 SPAWNFUNC_WEAPON(weapon_laser, WEP_BLASTER)
50
51 CLASS(OffhandBlaster, OffhandWeapon)
52 ENDCLASS(OffhandBlaster)
53 OffhandBlaster OFFHAND_BLASTER;
54 STATIC_INIT(OFFHAND_BLASTER) { OFFHAND_BLASTER = NEW(OffhandBlaster); }
55
56 #ifdef SVQC
57 .float blaster_damage;
58 .float blaster_edgedamage;
59 .float blaster_radius;
60 .float blaster_force;
61 .float blaster_lifetime;
62
63 // Will be demacroed after WEP_CVAR macros are also demacroed.
64 #define BLASTER_SECONDARY_ATTACK(weapon_name, actor, weaponentity) \
65         makevectors(actor.v_angle); \
66         W_Blaster_Attack( \
67                 actor, \
68                 weaponentity, \
69                 WEP_BLASTER.m_id | HITTYPE_SECONDARY, \
70                 WEP_CVAR_SEC(weapon_name, shotangle), \
71                 WEP_CVAR_SEC(weapon_name, damage), \
72                 WEP_CVAR_SEC(weapon_name, edgedamage), \
73                 WEP_CVAR_SEC(weapon_name, radius), \
74                 WEP_CVAR_SEC(weapon_name, force), \
75                 WEP_CVAR_SEC(weapon_name, speed), \
76                 WEP_CVAR_SEC(weapon_name, spread), \
77                 WEP_CVAR_SEC(weapon_name, delay), \
78                 WEP_CVAR_SEC(weapon_name, lifetime) \
79         );
80
81 #endif