3 /* WEP_##id */ BLASTER,
4 /* function */ W_Blaster,
5 /* ammotype */ ammo_none,
7 /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH,
9 /* color */ '1 0.5 0.5',
11 /* netname */ "laser",
12 /* fullname */ _("Blaster")
15 #define BLASTER_SETTINGS(w_cvar,w_prop) BLASTER_SETTINGS_LIST(w_cvar, w_prop, BLASTER, blaster)
16 #define BLASTER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
17 w_cvar(id, sn, BOTH, animtime) \
18 w_cvar(id, sn, BOTH, damage) \
19 w_cvar(id, sn, BOTH, delay) \
20 w_cvar(id, sn, BOTH, edgedamage) \
21 w_cvar(id, sn, BOTH, force) \
22 w_cvar(id, sn, BOTH, lifetime) \
23 w_cvar(id, sn, BOTH, radius) \
24 w_cvar(id, sn, BOTH, refire) \
25 w_cvar(id, sn, BOTH, shotangle) \
26 w_cvar(id, sn, BOTH, speed) \
27 w_cvar(id, sn, BOTH, spread) \
28 w_cvar(id, sn, NONE, secondary) \
29 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
30 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
31 w_prop(id, sn, string, weaponreplace, weaponreplace) \
32 w_prop(id, sn, float, weaponstart, weaponstart) \
33 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride)
36 BLASTER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
37 .float blaster_damage;
38 .float blaster_edgedamage;
39 .float blaster_radius;
41 .float blaster_lifetime;
45 void spawnfunc_weapon_blaster() { weapon_defaultspawnfunc(WEP_BLASTER); }
46 void spawnfunc_weapon_laser() { spawnfunc_weapon_blaster(); }
48 void W_Blaster_Touch()
52 self.event_damage = func_null;
58 self.blaster_edgedamage,
63 self.projectiledeathtype,
70 void W_Blaster_Think()
72 self.movetype = MOVETYPE_FLY;
73 self.think = SUB_Remove;
74 self.nextthink = time + self.blaster_lifetime;
75 CSQCProjectile(self, TRUE, PROJECTILE_BLASTER, TRUE);
78 void W_Blaster_Attack(
89 vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
91 W_SetupShot_Dir(self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, atk_damage);
92 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
94 entity missile = spawn();
95 missile.owner = missile.realowner = self;
96 missile.classname = "blasterbolt";
97 missile.bot_dodge = TRUE;
98 missile.bot_dodgerating = atk_damage;
99 PROJECTILE_MAKETRIGGER(missile);
101 missile.blaster_damage = atk_damage;
102 missile.blaster_edgedamage = atk_edgedamage;
103 missile.blaster_radius = atk_radius;
104 missile.blaster_force = atk_force;
105 missile.blaster_lifetime = atk_lifetime;
107 setorigin(missile, w_shotorg);
108 setsize(missile, '0 0 0', '0 0 0');
110 W_SetupProjectileVelocityEx(
121 missile.angles = vectoangles(missile.velocity);
123 //missile.glow_color = 250; // 244, 250
124 //missile.glow_size = 120;
126 missile.touch = W_Blaster_Touch;
127 missile.flags = FL_PROJECTILE;
128 missile.missile_flags = MIF_SPLASH;
129 missile.projectiledeathtype = WEP_BLASTER;
130 missile.think = W_Blaster_Think;
131 missile.nextthink = time + atk_delay;
133 other = missile; MUTATOR_CALLHOOK(EditProjectile);
135 if(time >= missile.nextthink)
144 float W_Blaster(float request)
150 if(WEP_CVAR(blaster, secondary))
152 if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
153 { self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), FALSE); }
155 { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), FALSE); }
158 { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), FALSE); }
167 if(weapon_prepareattack(0, WEP_CVAR_PRI(blaster, refire)))
170 WEP_CVAR_PRI(blaster, shotangle),
171 WEP_CVAR_PRI(blaster, damage),
172 WEP_CVAR_PRI(blaster, edgedamage),
173 WEP_CVAR_PRI(blaster, radius),
174 WEP_CVAR_PRI(blaster, force),
175 WEP_CVAR_PRI(blaster, speed),
176 WEP_CVAR_PRI(blaster, spread),
177 WEP_CVAR_PRI(blaster, delay),
178 WEP_CVAR_PRI(blaster, lifetime)
180 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(blaster, animtime), w_ready);
183 else if(self.BUTTON_ATCK2)
185 switch(WEP_CVAR(blaster, secondary))
187 case 0: // switch to last used weapon
189 if(self.switchweapon == WEP_BLASTER) // don't do this if already switching
194 case 1: // normal projectile secondary
196 if(weapon_prepareattack(1, WEP_CVAR_SEC(blaster, refire)))
199 WEP_CVAR_SEC(blaster, shotangle),
200 WEP_CVAR_SEC(blaster, damage),
201 WEP_CVAR_SEC(blaster, edgedamage),
202 WEP_CVAR_SEC(blaster, radius),
203 WEP_CVAR_SEC(blaster, force),
204 WEP_CVAR_SEC(blaster, speed),
205 WEP_CVAR_SEC(blaster, spread),
206 WEP_CVAR_SEC(blaster, delay),
207 WEP_CVAR_SEC(blaster, lifetime)
209 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(blaster, animtime), w_ready);
221 precache_model("models/weapons/g_laser.md3");
222 precache_model("models/weapons/v_laser.md3");
223 precache_model("models/weapons/h_laser.iqm");
224 precache_sound("weapons/lasergun_fire.wav");
225 BLASTER_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
231 self.current_ammo = ammo_none;
238 return TRUE; // laser has infinite ammo
243 BLASTER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
247 case WR_SUICIDEMESSAGE:
249 return WEAPON_LASER_SUICIDE;
254 return WEAPON_LASER_MURDER;
262 float W_Blaster(float request)
266 case WR_IMPACTEFFECT:
269 org2 = w_org + w_backoff * 6;
270 pointparticles(particleeffectnum("new_laser_impact"), org2, w_backoff * 1000, 1);
271 if(!w_issilent) { sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM); }
277 precache_sound("weapons/laserimpact.wav");