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);
16 void W_Laser_Attack (float issecondary)
23 a = cvar("g_balance_laser_secondary_shotangle");
25 a = cvar("g_balance_laser_primary_shotangle");
26 s_forward = v_forward * cos(a * DEG2RAD) + v_up * sin(a * DEG2RAD);
29 W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_laser_secondary_damage"));
31 W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_laser_primary_damage"));
32 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
36 missile.classname = "laserbolt";
37 missile.dmg = issecondary;
38 missile.bot_dodge = TRUE;
40 missile.bot_dodgerating = cvar("g_balance_laser_secondary_damage");
42 missile.bot_dodgerating = cvar("g_balance_laser_primary_damage");
44 missile.movetype = MOVETYPE_FLY;
45 PROJECTILE_MAKETRIGGER(missile);
46 missile.projectiledeathtype = WEP_LASER;
48 missile.projectiledeathtype |= HITTYPE_SECONDARY;
50 setorigin (missile, w_shotorg);
51 setsize(missile, '0 0 0', '0 0 0');
54 missile.velocity = w_shotdir * cvar("g_balance_laser_secondary_speed");
56 missile.velocity = w_shotdir * cvar("g_balance_laser_primary_speed");
57 W_SetupProjectileVelocity(missile);
58 missile.angles = vectoangles (missile.velocity);
59 //missile.glow_color = 250; // 244, 250
60 //missile.glow_size = 120;
61 missile.touch = W_Laser_Touch;
62 missile.think = SUB_Remove;
64 missile.nextthink = time + cvar("g_balance_laser_secondary_lifetime");
66 missile.nextthink = time + cvar("g_balance_laser_primary_lifetime");
68 missile.flags = FL_PROJECTILE;
70 CSQCProjectile(missile, TRUE, PROJECTILE_LASER, TRUE);
73 void spawnfunc_weapon_laser (void)
75 weapon_defaultspawnfunc(WEP_LASER);
78 float w_laser(float req)
84 if(cvar("g_balance_laser_secondary"))
86 r1 = cvar("g_balance_laser_primary_damage");
87 r2 = cvar("g_balance_laser_secondary_damage");
88 if (random() * (r2 + r1) > r1)
89 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_laser_secondary_speed"), 0, cvar("g_balance_laser_secondary_lifetime"), FALSE);
91 self.BUTTON_ATCK = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
94 self.BUTTON_ATCK = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
96 else if (req == WR_THINK)
99 if (weapon_prepareattack(0, cvar("g_balance_laser_primary_refire")))
101 W_Laser_Attack(FALSE);
102 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_laser_primary_animtime"), w_ready);
104 if (self.BUTTON_ATCK2)
106 if(cvar("g_balance_laser_secondary"))
108 if (weapon_prepareattack(0, cvar("g_balance_laser_secondary_refire")))
110 W_Laser_Attack(TRUE);
111 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_laser_secondary_animtime"), w_ready);
116 if(self.switchweapon == WEP_LASER) // don't do this if already switching
117 W_SwitchWeapon (self.cnt);
121 else if (req == WR_PRECACHE)
123 precache_model ("models/weapons/g_laser.md3");
124 precache_model ("models/weapons/v_laser.md3");
125 precache_model ("models/weapons/h_laser.dpm");
126 precache_sound ("weapons/lasergun_fire.wav");
128 else if (req == WR_SETUP)
129 weapon_setup(WEP_LASER);
130 else if (req == WR_CHECKAMMO1)
132 else if (req == WR_CHECKAMMO2)
134 else if (req == WR_SUICIDEMESSAGE)
135 w_deathtypestring = "lasered himself to hell";
136 else if (req == WR_KILLMESSAGE)
138 w_deathtypestring = "was lasered to death by"; // unchecked: SPLASH