4 /* function */ W_Laser,
7 /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH,
10 /* netname */ "laser",
11 /* fullname */ _("Blaster")
15 void spawnfunc_weapon_laser() { weapon_defaultspawnfunc(WEP_LASER); }
21 self.event_damage = func_null;
24 RadiusDamage(self, self.realowner, autocvar_g_balance_laser_secondary_damage, autocvar_g_balance_laser_secondary_edgedamage, autocvar_g_balance_laser_secondary_radius, world, world, autocvar_g_balance_laser_secondary_force, self.projectiledeathtype, other);
26 RadiusDamage(self, self.realowner, autocvar_g_balance_laser_primary_damage, autocvar_g_balance_laser_primary_edgedamage, autocvar_g_balance_laser_primary_radius, world, world, autocvar_g_balance_laser_primary_force, self.projectiledeathtype, other);
33 self.movetype = MOVETYPE_FLY;
34 self.think = SUB_Remove;
37 self.nextthink = time + autocvar_g_balance_laser_secondary_lifetime;
39 self.nextthink = time + autocvar_g_balance_laser_primary_lifetime;
41 CSQCProjectile(self, TRUE, PROJECTILE_LASER, TRUE);
44 void W_Laser_Attack(float issecondary)
50 a = autocvar_g_balance_laser_primary_shotangle;
51 s_forward = v_forward * cos(a * DEG2RAD) + v_up * sin(a * DEG2RAD);
54 // W_SetupShot_Dir(self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, 0);
55 /*else*/if(issecondary == 1)
56 W_SetupShot_Dir(self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, autocvar_g_balance_laser_secondary_damage);
58 W_SetupShot_Dir(self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, autocvar_g_balance_laser_primary_damage);
59 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
62 missile.owner = missile.realowner = self;
63 missile.classname = "laserbolt";
65 missile.bot_dodge = TRUE;
66 missile.bot_dodgerating = autocvar_g_balance_laser_primary_damage;
68 PROJECTILE_MAKETRIGGER(missile);
69 missile.projectiledeathtype = WEP_LASER;
71 setorigin(missile, w_shotorg);
72 setsize(missile, '0 0 0', '0 0 0');
74 W_SETUPPROJECTILEVELOCITY(missile, g_balance_laser_primary);
75 missile.angles = vectoangles(missile.velocity);
76 //missile.glow_color = 250; // 244, 250
77 //missile.glow_size = 120;
78 missile.touch = W_Laser_Touch;
80 missile.flags = FL_PROJECTILE;
81 missile.missile_flags = MIF_SPLASH;
83 missile.think = W_Laser_Think;
84 missile.nextthink = time + autocvar_g_balance_laser_primary_delay;
86 other = missile; MUTATOR_CALLHOOK(EditProjectile);
88 if(time >= missile.nextthink)
97 float W_Laser(float request)
103 if(autocvar_g_balance_laser_secondary)
105 if((random() * (autocvar_g_balance_laser_primary_damage + autocvar_g_balance_laser_secondary_damage)) > autocvar_g_balance_laser_primary_damage)
106 { self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_laser_secondary_speed, 0, autocvar_g_balance_laser_secondary_lifetime, FALSE); }
108 { self.BUTTON_ATCK = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE); }
111 { self.BUTTON_ATCK = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE); }
118 if(autocvar_g_balance_laser_reload_ammo && self.clip_load < 1) // forced reload
119 WEP_ACTION(self.weapon, WR_RELOAD);
120 else if(self.BUTTON_ATCK)
122 if(weapon_prepareattack(0, autocvar_g_balance_laser_primary_refire))
124 W_DecreaseAmmo(ammo_none, 1, TRUE); // WEAPONTODO is this necessary?
125 W_Laser_Attack(FALSE);
126 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_laser_primary_animtime, w_ready);
129 else if(self.BUTTON_ATCK2)
131 switch(autocvar_g_balance_laser_secondary)
133 case 0: // switch to last used weapon
135 if(self.switchweapon == WEP_LASER) // don't do this if already switching
140 case 1: // normal projectile secondary
142 if(weapon_prepareattack(1, autocvar_g_balance_laser_secondary_refire))
144 W_DecreaseAmmo(ammo_none, 1, TRUE);
145 W_Laser_Attack(TRUE);
146 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_laser_secondary_animtime, w_ready);
158 precache_model("models/weapons/g_laser.md3");
159 precache_model("models/weapons/v_laser.md3");
160 precache_model("models/weapons/h_laser.iqm");
161 precache_sound("weapons/lasergun_fire.wav");
167 self.current_ammo = ammo_none;
174 return TRUE; // laser has infinite ammo
179 W_Reload(0, "weapons/reload.wav");
183 case WR_SUICIDEMESSAGE:
185 return WEAPON_LASER_SUICIDE;
190 return WEAPON_LASER_MURDER;
198 float W_Laser(float request)
202 case WR_IMPACTEFFECT:
205 org2 = w_org + w_backoff * 6;
206 pointparticles(particleeffectnum("new_laser_impact"), org2, w_backoff * 1000, 1);
207 if(!w_issilent) { sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM); }
213 precache_sound("weapons/laserimpact.wav");