3 /* WEP_##id */ BLASTER,
4 /* function */ W_Blaster,
5 /* ammotype */ ammo_none,
7 /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH,
10 /* netname */ "laser",
11 /* fullname */ _("Blaster")
14 #define BLASTER_SETTINGS(w_cvar,w_prop) BLASTER_SETTINGS_LIST(w_cvar, w_prop, BLASTER, blaster)
15 #define BLASTER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
16 w_cvar(id, sn, BOTH, animtime) \
17 w_cvar(id, sn, BOTH, damage) \
18 w_cvar(id, sn, BOTH, delay) \
19 w_cvar(id, sn, BOTH, edgedamage) \
20 w_cvar(id, sn, BOTH, force) \
21 w_cvar(id, sn, BOTH, lifetime) \
22 w_cvar(id, sn, BOTH, radius) \
23 w_cvar(id, sn, BOTH, refire) \
24 w_cvar(id, sn, BOTH, shotangle) \
25 w_cvar(id, sn, BOTH, speed) \
26 w_cvar(id, sn, BOTH, spread) \
27 w_cvar(id, sn, NONE, secondary) \
28 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
29 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
30 w_prop(id, sn, string, weaponreplace, weaponreplace) \
31 w_prop(id, sn, float, weaponstart, weaponstart) \
32 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride)
35 BLASTER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
36 .float blaster_damage;
37 .float blaster_edgedamage;
38 .float blaster_radius;
40 .float blaster_lifetime;
44 void spawnfunc_weapon_blaster() { weapon_defaultspawnfunc(WEP_BLASTER); }
45 void spawnfunc_weapon_laser() { spawnfunc_weapon_blaster(); }
47 void W_Blaster_Touch()
51 self.event_damage = func_null;
57 self.blaster_edgedamage,
62 self.projectiledeathtype,
69 void W_Blaster_Think()
71 self.movetype = MOVETYPE_FLY;
72 self.think = SUB_Remove;
73 self.nextthink = time + self.blaster_lifetime;
74 CSQCProjectile(self, TRUE, PROJECTILE_BLASTER, TRUE);
77 void W_Blaster_Attack(
88 vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
90 W_SetupShot_Dir(self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, atk_damage);
91 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
93 entity missile = spawn();
94 missile.owner = missile.realowner = self;
95 missile.classname = "blasterbolt";
96 missile.bot_dodge = TRUE;
97 missile.bot_dodgerating = atk_damage;
98 PROJECTILE_MAKETRIGGER(missile);
100 missile.blaster_damage = atk_damage;
101 missile.blaster_edgedamage = atk_edgedamage;
102 missile.blaster_radius = atk_radius;
103 missile.blaster_force = atk_force;
104 missile.blaster_lifetime = atk_lifetime;
106 setorigin(missile, w_shotorg);
107 setsize(missile, '0 0 0', '0 0 0');
109 W_SetupProjectileVelocityEx(
120 missile.angles = vectoangles(missile.velocity);
122 //missile.glow_color = 250; // 244, 250
123 //missile.glow_size = 120;
125 missile.touch = W_Blaster_Touch;
126 missile.flags = FL_PROJECTILE;
127 missile.missile_flags = MIF_SPLASH;
128 missile.projectiledeathtype = WEP_BLASTER;
129 missile.think = W_Blaster_Think;
130 missile.nextthink = time + atk_delay;
132 other = missile; MUTATOR_CALLHOOK(EditProjectile);
134 if(time >= missile.nextthink)
143 float W_Blaster(float request)
149 if(WEP_CVAR(blaster, secondary))
151 if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
152 { self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), FALSE); }
154 { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), FALSE); }
157 { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), FALSE); }
166 if(weapon_prepareattack(0, WEP_CVAR_PRI(blaster, refire)))
169 WEP_CVAR_PRI(blaster, shotangle),
170 WEP_CVAR_PRI(blaster, damage),
171 WEP_CVAR_PRI(blaster, edgedamage),
172 WEP_CVAR_PRI(blaster, radius),
173 WEP_CVAR_PRI(blaster, force),
174 WEP_CVAR_PRI(blaster, speed),
175 WEP_CVAR_PRI(blaster, spread),
176 WEP_CVAR_PRI(blaster, delay),
177 WEP_CVAR_PRI(blaster, lifetime)
179 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
182 else if(self.BUTTON_ATCK2)
184 switch(WEP_CVAR(blaster, secondary))
186 case 0: // switch to last used weapon
188 if(self.switchweapon == WEP_BLASTER) // don't do this if already switching
193 case 1: // normal projectile secondary
195 if(weapon_prepareattack(1, WEP_CVAR_SEC(blaster, refire)))
198 WEP_CVAR_SEC(blaster, shotangle),
199 WEP_CVAR_SEC(blaster, damage),
200 WEP_CVAR_SEC(blaster, edgedamage),
201 WEP_CVAR_SEC(blaster, radius),
202 WEP_CVAR_SEC(blaster, force),
203 WEP_CVAR_SEC(blaster, speed),
204 WEP_CVAR_SEC(blaster, spread),
205 WEP_CVAR_SEC(blaster, delay),
206 WEP_CVAR_SEC(blaster, lifetime)
208 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
220 precache_model("models/weapons/g_laser.md3");
221 precache_model("models/weapons/v_laser.md3");
222 precache_model("models/weapons/h_laser.iqm");
223 precache_sound("weapons/lasergun_fire.wav");
224 BLASTER_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
230 self.current_ammo = ammo_none;
237 return TRUE; // laser has infinite ammo
242 BLASTER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
246 case WR_SUICIDEMESSAGE:
248 return WEAPON_LASER_SUICIDE;
253 return WEAPON_LASER_MURDER;
261 float W_Blaster(float request)
265 case WR_IMPACTEFFECT:
268 org2 = w_org + w_backoff * 6;
269 pointparticles(particleeffectnum("new_laser_impact"), org2, w_backoff * 1000, 1);
270 if(!w_issilent) { sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM); }
276 precache_sound("weapons/laserimpact.wav");