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 spawnfunc_weapon_laser (void)
102 weapon_defaultspawnfunc(WEP_LASER);
105 float w_laser(float req)
111 if(cvar("g_balance_laser_secondary"))
113 r1 = cvar("g_balance_laser_primary_damage");
114 r2 = cvar("g_balance_laser_secondary_damage");
115 if (random() * (r2 + r1) > r1)
116 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_laser_secondary_speed"), 0, cvar("g_balance_laser_secondary_lifetime"), FALSE);
118 self.BUTTON_ATCK = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
121 self.BUTTON_ATCK = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
123 else if (req == WR_THINK)
125 if (self.BUTTON_ATCK)
126 if (weapon_prepareattack(0, cvar("g_balance_laser_primary_refire")))
129 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_laser_primary_animtime"), w_ready);
131 if (self.BUTTON_ATCK2)
133 if(cvar("g_balance_laser_secondary"))
135 if (weapon_prepareattack(0, cvar("g_balance_laser_secondary_refire")))
138 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_laser_secondary_animtime"), w_ready);
143 if(self.switchweapon == WEP_LASER) // don't do this if already switching
144 W_SwitchWeapon (self.cnt);
148 else if (req == WR_PRECACHE)
150 precache_model ("models/weapons/g_laser.md3");
151 precache_model ("models/weapons/v_laser.md3");
152 precache_model ("models/weapons/h_laser.dpm");
153 precache_sound ("weapons/lasergun_fire.wav");
155 else if (req == WR_SETUP)
156 weapon_setup(WEP_LASER);
157 else if (req == WR_CHECKAMMO1)
159 else if (req == WR_CHECKAMMO2)
161 else if (req == WR_SUICIDEMESSAGE)
162 w_deathtypestring = "lasered themself to hell";
163 else if (req == WR_KILLMESSAGE)
165 w_deathtypestring = "was lasered to death by"; // unchecked: SPLASH