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 if(issecondary == 2) // minstanex shot
24 nodamage = g_minstagib;
29 a = cvar("g_balance_laser_secondary_shotangle");
31 a = cvar("g_balance_laser_primary_shotangle");
32 s_forward = v_forward * cos(a * DEG2RAD) + v_up * sin(a * DEG2RAD);
35 W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", 0);
36 else if(issecondary == 1)
37 W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_laser_secondary_damage"));
39 W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_laser_primary_damage"));
40 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
44 missile.classname = "laserbolt";
45 missile.dmg = (issecondary == 1);
48 missile.bot_dodge = TRUE;
50 missile.bot_dodgerating = cvar("g_balance_laser_secondary_damage");
52 missile.bot_dodgerating = cvar("g_balance_laser_primary_damage");
55 missile.movetype = MOVETYPE_FLY;
56 PROJECTILE_MAKETRIGGER(missile);
57 missile.projectiledeathtype = WEP_LASER;
59 missile.projectiledeathtype |= HITTYPE_SECONDARY;
61 setorigin (missile, w_shotorg);
62 setsize(missile, '0 0 0', '0 0 0');
65 missile.velocity = w_shotdir * cvar("g_balance_laser_secondary_speed");
67 missile.velocity = w_shotdir * cvar("g_balance_laser_primary_speed");
68 W_SetupProjectileVelocity(missile);
69 missile.angles = vectoangles (missile.velocity);
70 //missile.glow_color = 250; // 244, 250
71 //missile.glow_size = 120;
72 missile.touch = W_Laser_Touch;
73 missile.think = SUB_Remove;
75 missile.nextthink = time + cvar("g_balance_laser_secondary_lifetime");
77 missile.nextthink = time + cvar("g_balance_laser_primary_lifetime");
79 missile.flags = FL_PROJECTILE;
81 CSQCProjectile(missile, TRUE, PROJECTILE_LASER, TRUE);
84 void spawnfunc_weapon_laser (void)
86 weapon_defaultspawnfunc(WEP_LASER);
89 float w_laser(float req)
95 if(cvar("g_balance_laser_secondary"))
97 r1 = cvar("g_balance_laser_primary_damage");
98 r2 = cvar("g_balance_laser_secondary_damage");
99 if (random() * (r2 + r1) > r1)
100 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_laser_secondary_speed"), 0, cvar("g_balance_laser_secondary_lifetime"), FALSE);
102 self.BUTTON_ATCK = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
105 self.BUTTON_ATCK = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
107 else if (req == WR_THINK)
109 if (self.BUTTON_ATCK)
110 if (weapon_prepareattack(0, cvar("g_balance_laser_primary_refire")))
113 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_laser_primary_animtime"), w_ready);
115 if (self.BUTTON_ATCK2)
117 if(cvar("g_balance_laser_secondary"))
119 if (weapon_prepareattack(0, cvar("g_balance_laser_secondary_refire")))
122 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_laser_secondary_animtime"), w_ready);
127 if(self.switchweapon == WEP_LASER) // don't do this if already switching
128 W_SwitchWeapon (self.cnt);
132 else if (req == WR_PRECACHE)
134 precache_model ("models/weapons/g_laser.md3");
135 precache_model ("models/weapons/v_laser.md3");
136 precache_model ("models/weapons/h_laser.dpm");
137 precache_sound ("weapons/lasergun_fire.wav");
139 else if (req == WR_SETUP)
140 weapon_setup(WEP_LASER);
141 else if (req == WR_CHECKAMMO1)
143 else if (req == WR_CHECKAMMO2)
145 else if (req == WR_SUICIDEMESSAGE)
146 w_deathtypestring = "lasered himself to hell";
147 else if (req == WR_KILLMESSAGE)
149 w_deathtypestring = "was lasered to death by"; // unchecked: SPLASH