1 void(float imp) W_SwitchWeapon;
3 void W_Laser_Touch (void)
7 self.event_damage = SUB_Null;
9 RadiusDamage (self, self.owner, cvar("g_balance_laser_secondary_damage"), cvar("g_balance_laser_secondary_edgedamage"), cvar("g_balance_laser_secondary_radius"), world, cvar("g_balance_laser_secondary_force"), self.projectiledeathtype, other);
11 RadiusDamage (self, self.owner, cvar("g_balance_laser_primary_damage"), cvar("g_balance_laser_primary_edgedamage"), cvar("g_balance_laser_primary_radius"), world, cvar("g_balance_laser_primary_force"), self.projectiledeathtype, other);
18 self.movetype = MOVETYPE_FLY;
19 self.think = SUB_Remove;
21 self.nextthink = time + cvar("g_balance_laser_secondary_lifetime");
23 self.nextthink = time + cvar("g_balance_laser_primary_lifetime");
24 CSQCProjectile(self, TRUE, PROJECTILE_LASER, TRUE);
27 void W_Laser_Attack (float issecondary)
34 if(issecondary == 2) // minstanex shot
35 nodamage = g_minstagib;
40 a = cvar("g_balance_laser_secondary_shotangle");
42 a = cvar("g_balance_laser_primary_shotangle");
43 s_forward = v_forward * cos(a * DEG2RAD) + v_up * sin(a * DEG2RAD);
46 W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", 0);
47 else if(issecondary == 1)
48 W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_laser_secondary_damage"));
50 W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_laser_primary_damage"));
51 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
55 missile.classname = "laserbolt";
56 missile.dmg = (issecondary == 1);
59 missile.bot_dodge = TRUE;
61 missile.bot_dodgerating = cvar("g_balance_laser_secondary_damage");
63 missile.bot_dodgerating = cvar("g_balance_laser_primary_damage");
66 PROJECTILE_MAKETRIGGER(missile);
67 missile.projectiledeathtype = WEP_LASER;
69 missile.projectiledeathtype |= HITTYPE_SECONDARY;
71 setorigin (missile, w_shotorg);
72 setsize(missile, '0 0 0', '0 0 0');
75 W_SETUPPROJECTILEVELOCITY(missile, g_balance_laser_secondary);
77 W_SETUPPROJECTILEVELOCITY(missile, g_balance_laser_primary);
78 missile.angles = vectoangles (missile.velocity);
79 //missile.glow_color = 250; // 244, 250
80 //missile.glow_size = 120;
81 missile.touch = W_Laser_Touch;
83 missile.flags = FL_PROJECTILE;
85 missile.think = W_Laser_Think;
87 missile.nextthink = time + cvar("g_balance_laser_secondary_delay");
89 missile.nextthink = time + cvar("g_balance_laser_primary_delay");
90 if(time >= missile.nextthink)
100 void W_Laser_Attack2 (void) // gauntlet
102 W_SetupShot (self, TRUE, 0, "weapons/gauntlet_fire.wav", cvar("g_balance_laser_primary_damage"));
104 traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_laser_primary_radius"), FALSE, self, self.ping * 0.001);
106 pointparticles(particleeffectnum("laser_gauntlet"), w_shotorg + w_shotdir * cvar("g_balance_laser_primary_radius"), '0 0 0', 1);
108 if (trace_fraction < 1)
109 Damage(trace_ent, self, self, cvar("g_balance_laser_primary_damage"), WEP_LASER | HITTYPE_SECONDARY, trace_endpos, cvar("g_balance_laser_primary_force") * w_shotdir);
112 void spawnfunc_weapon_laser (void)
114 weapon_defaultspawnfunc(WEP_LASER);
117 float w_laser(float req)
123 if(cvar("g_balance_laser_secondary"))
125 r1 = cvar("g_balance_laser_primary_damage");
126 r2 = cvar("g_balance_laser_secondary_damage");
127 if (random() * (r2 + r1) > r1)
128 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_laser_secondary_speed"), 0, cvar("g_balance_laser_secondary_lifetime"), FALSE);
130 self.BUTTON_ATCK = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
133 self.BUTTON_ATCK = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
135 else if (req == WR_THINK)
137 if (self.BUTTON_ATCK)
138 if (weapon_prepareattack(0, cvar("g_balance_laser_primary_refire")))
140 if(cvar("g_balance_laser_gauntlet"))
144 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_laser_primary_animtime"), w_ready);
146 if (self.BUTTON_ATCK2)
148 if(cvar("g_balance_laser_secondary"))
150 if (weapon_prepareattack(0, cvar("g_balance_laser_secondary_refire")))
153 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_laser_secondary_animtime"), w_ready);
158 if(self.switchweapon == WEP_LASER) // don't do this if already switching
159 W_SwitchWeapon (self.cnt);
163 else if (req == WR_PRECACHE)
165 precache_model ("models/weapons/g_laser.md3");
166 precache_model ("models/weapons/v_laser.md3");
167 precache_model ("models/weapons/h_laser.dpm");
168 precache_sound ("weapons/lasergun_fire.wav");
170 else if (req == WR_SETUP)
171 weapon_setup(WEP_LASER);
172 else if (req == WR_CHECKAMMO1)
174 else if (req == WR_CHECKAMMO2)
176 else if (req == WR_SUICIDEMESSAGE)
177 w_deathtypestring = "lasered themself to hell";
178 else if (req == WR_KILLMESSAGE)
180 w_deathtypestring = "was lasered to death by"; // unchecked: SPLASH