]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/w_laser.qc
added: g_projectiles_newton_style
[divverent/nexuiz.git] / data / qcsrc / server / w_laser.qc
1 void(float imp) W_SwitchWeapon;
2
3 void W_Laser_Touch (void)
4 {
5         vector  dir;
6         vector org2;
7
8         if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
9         {
10                 remove(self);
11                 return;
12         }
13
14         if (other == self.owner)
15                 return;
16
17         dir = normalize (self.owner.origin - self.origin);
18         org2 = findbetterlocation (self.origin, 8);
19
20         te_knightspike(org2);
21
22
23         self.event_damage = SUB_Null;
24         RadiusDamage (self, self.owner, cvar("g_balance_laser_damage"), cvar("g_balance_laser_edgedamage"), cvar("g_balance_laser_radius"), world, cvar("g_balance_laser_force"), IT_LASER);
25         sound (self, CHAN_BODY, "weapons/laserimpact.ogg", 1, ATTN_NORM);
26
27         remove (self);
28 }
29
30 void W_Laser_Attack (void)
31 {
32         local entity missile;
33
34         W_SetupShot (self, '15 8 -8', FALSE, 3, "weapons/lasergun_fire.ogg");
35         //te_customflash(w_shotorg, 160, 0.2, '1 0 0');
36
37         missile = spawn ();
38         missile.owner = self;
39         missile.classname = "laserbolt";
40         missile.bot_dodge = TRUE;
41         missile.bot_dodgerating = cvar("g_balance_laser_damage");
42
43         missile.movetype = MOVETYPE_FLY;
44         missile.solid = SOLID_BBOX;
45
46         setmodel (missile, "models/laser.mdl");
47         setsize (missile, '0 0 0', '0 0 0');
48         setorigin (missile, w_shotorg);
49
50         missile.velocity = w_shotdir * cvar("g_balance_laser_speed");
51         W_SetupProjectileVelocity(missile);
52         missile.angles = vectoangles (missile.velocity);
53         //missile.glow_color = 250; // 244, 250
54         //missile.glow_size = 120;
55         missile.touch = W_Laser_Touch;
56         missile.think = SUB_Remove;
57         missile.nextthink = time + cvar("g_balance_laser_lifetime");
58
59         missile.effects = EF_NOSHADOW | EF_FULLBRIGHT | EF_FULLBRIGHT | EF_LOWPRECISION;
60         missile.flags = FL_PROJECTILE;
61 }
62
63 float(float req) w_laser =
64 {
65         if (req == WR_AIM)
66                 self.button0 = bot_aim(cvar("g_balance_laser_speed"), 0, cvar("g_balance_laser_lifetime"), FALSE);
67         else if (req == WR_THINK)
68         {
69                 if (self.button0)
70                 if (weapon_prepareattack(0, cvar("g_balance_laser_refire")))
71                 {
72                         W_Laser_Attack();
73                         weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_laser_animtime"), w_ready);
74                 }
75                 if (self.button3)
76                 if (client_hasweapon(self, self.cnt, TRUE, FALSE))
77                         W_SwitchWeapon (self.cnt);
78         }
79         else if (req == WR_SETUP)
80                 weapon_setup(WEP_LASER, "laser", 0);
81         else if (req == WR_CHECKAMMO1)
82                 return TRUE;
83         else if (req == WR_CHECKAMMO2)
84                 return TRUE;
85         return TRUE;
86 };