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)
20 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", cvar("g_balance_laser_secondary_damage"));
21 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
25 missile.classname = "laserbolt";
26 missile.dmg = issecondary;
27 missile.bot_dodge = TRUE;
29 missile.bot_dodgerating = cvar("g_balance_laser_secondary_damage");
31 missile.bot_dodgerating = cvar("g_balance_laser_primary_damage");
33 missile.movetype = MOVETYPE_FLY;
34 PROJECTILE_MAKETRIGGER(missile);
35 missile.projectiledeathtype = WEP_LASER;
37 missile.projectiledeathtype |= HITTYPE_SECONDARY;
39 setorigin (missile, w_shotorg);
40 setsize(missile, '0 0 0', '0 0 0');
43 missile.velocity = w_shotdir * cvar("g_balance_laser_secondary_speed");
45 missile.velocity = w_shotdir * cvar("g_balance_laser_primary_speed");
46 W_SetupProjectileVelocity(missile);
47 missile.angles = vectoangles (missile.velocity);
48 //missile.glow_color = 250; // 244, 250
49 //missile.glow_size = 120;
50 missile.touch = W_Laser_Touch;
51 missile.think = SUB_Remove;
53 missile.nextthink = time + cvar("g_balance_laser_secondary_lifetime");
55 missile.nextthink = time + cvar("g_balance_laser_primary_lifetime");
57 missile.flags = FL_PROJECTILE;
59 CSQCProjectile(missile, TRUE, PROJECTILE_LASER, TRUE);
62 void spawnfunc_weapon_laser (void)
64 weapon_defaultspawnfunc(WEP_LASER);
67 float w_laser(float req)
73 if(cvar("g_balance_laser_secondary"))
75 r1 = cvar("g_balance_laser_primary_damage");
76 r2 = cvar("g_balance_laser_secondary_damage");
77 if (random() * (r2 + r1) > r1)
78 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_laser_secondary_speed"), 0, cvar("g_balance_laser_secondary_lifetime"), FALSE);
80 self.BUTTON_ATCK = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
83 self.BUTTON_ATCK = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
85 else if (req == WR_THINK)
88 if (weapon_prepareattack(0, cvar("g_balance_laser_primary_refire")))
90 W_Laser_Attack(FALSE);
91 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_laser_primary_animtime"), w_ready);
93 if (self.BUTTON_ATCK2)
95 if(cvar("g_balance_laser_secondary"))
97 if (weapon_prepareattack(0, cvar("g_balance_laser_secondary_refire")))
100 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_laser_secondary_animtime"), w_ready);
105 if(self.switchweapon == WEP_LASER) // don't do this if already switching
106 W_SwitchWeapon (self.cnt);
110 else if (req == WR_PRECACHE)
112 precache_model ("models/weapons/g_laser.md3");
113 precache_model ("models/weapons/v_laser.md3");
114 precache_model ("models/weapons/h_laser.dpm");
115 precache_sound ("weapons/lasergun_fire.wav");
117 else if (req == WR_SETUP)
118 weapon_setup(WEP_LASER);
119 else if (req == WR_CHECKAMMO1)
121 else if (req == WR_CHECKAMMO2)
123 else if (req == WR_SUICIDEMESSAGE)
124 w_deathtypestring = "lasered himself to hell";
125 else if (req == WR_KILLMESSAGE)
127 w_deathtypestring = "was lasered to death by"; // unchecked: SPLASH