1 void(float imp) W_SwitchWeapon;
3 void W_Laser_Touch (void)
11 normal = trace_plane_normal;
12 dir = normalize (self.owner.origin - self.origin);
13 org2 = findbetterlocation (self.origin, 8);
15 pointparticles(particleeffectnum("laser_impact"), org2, normal * 1000, 1);
18 self.event_damage = SUB_Null;
20 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);
22 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);
23 sound (self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
28 void W_Laser_Attack (float issecondary)
32 W_SetupShot (self, '25 8 -8', FALSE, 3, "weapons/lasergun_fire.wav");
33 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
37 missile.classname = "laserbolt";
38 missile.dmg = issecondary;
39 missile.bot_dodge = TRUE;
41 missile.bot_dodgerating = cvar("g_balance_laser_secondary_damage");
43 missile.bot_dodgerating = cvar("g_balance_laser_primary_damage");
45 missile.movetype = MOVETYPE_FLY;
46 missile.solid = SOLID_BBOX;
47 missile.projectiledeathtype = WEP_LASER;
49 missile.projectiledeathtype |= HITTYPE_SECONDARY;
51 setmodel (missile, "models/laser.mdl"); // precision set below
52 setsize (missile, '0 0 0', '0 0 0');
53 setorigin (missile, w_shotorg);
56 missile.velocity = w_shotdir * cvar("g_balance_laser_secondary_speed");
58 missile.velocity = w_shotdir * cvar("g_balance_laser_primary_speed");
59 W_SetupProjectileVelocity(missile);
60 missile.angles = vectoangles (missile.velocity);
61 //missile.glow_color = 250; // 244, 250
62 //missile.glow_size = 120;
63 missile.touch = W_Laser_Touch;
64 missile.think = SUB_Remove;
66 missile.nextthink = time + cvar("g_balance_laser_secondary_lifetime");
68 missile.nextthink = time + cvar("g_balance_laser_primary_lifetime");
70 missile.effects = EF_LOWPRECISION;
71 missile.flags = FL_PROJECTILE;
74 float w_laser(float req)
80 if(cvar("g_balance_laser_secondary"))
82 r1 = cvar("g_balance_laser_primary_damage");
83 r2 = cvar("g_balance_laser_secondary_damage");
84 if (random() * (r2 + r1) > r1)
85 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_laser_secondary_speed"), 0, cvar("g_balance_laser_secondary_lifetime"), FALSE);
87 self.BUTTON_ATCK = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
90 self.BUTTON_ATCK = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
92 else if (req == WR_THINK)
95 if (weapon_prepareattack(0, cvar("g_balance_laser_primary_refire")))
97 W_Laser_Attack(FALSE);
98 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_laser_primary_animtime"), w_ready);
100 if (self.BUTTON_ATCK2)
102 if(cvar("g_balance_laser_secondary"))
104 if (weapon_prepareattack(0, cvar("g_balance_laser_secondary_refire")))
106 W_Laser_Attack(TRUE);
107 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_laser_secondary_animtime"), w_ready);
112 if(self.switchweapon == WEP_LASER) // don't do this if already switching
113 W_SwitchWeapon (self.cnt);
117 else if (req == WR_PRECACHE)
119 precache_model ("models/laser.mdl");
120 precache_model ("models/weapons/v_laser.md3");
121 precache_model ("models/weapons/w_laser.zym");
122 precache_sound ("weapons/lasergun_fire.wav");
123 precache_sound ("weapons/laserimpact.wav");
125 else if (req == WR_SETUP)
126 weapon_setup(WEP_LASER);
127 else if (req == WR_CHECKAMMO1)
129 else if (req == WR_CHECKAMMO2)
131 else if (req == WR_SUICIDEMESSAGE)
132 w_deathtypestring = "lasered himself to hell";
133 else if (req == WR_KILLMESSAGE)
135 w_deathtypestring = "was lasered to death by"; // unchecked: SPLASH