]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/gamec/w_crylink.c
change crylink color back to white (boring but still better). I wished
[divverent/nexuiz.git] / data / qcsrc / server / gamec / w_crylink.c
1 void() crylink_ready_01;
2 void() crylink_fire1_01;
3 void() crylink_fire2_01;
4 void() crylink_deselect_01;
5 void() crylink_select_01;
6
7 .float gravity;
8 const vector proj_color = '1 1 1';
9
10 float() crylink_check =
11 {
12         if (self.ammo_cells >= cvar("g_balance_crylink_primary_ammo"))
13                 return TRUE;
14         return FALSE;
15 };
16
17 float() crylink_check2 =
18 {
19         if (self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo"))
20                 return TRUE;
21         return FALSE;
22 };
23
24 void(float req) w_crylink =
25 {
26         if (req == WR_IDLE)
27                 crylink_ready_01();
28         else if (req == WR_FIRE1)
29                 weapon_prepareattack(crylink_check, crylink_check, crylink_fire1_01, cvar("g_balance_crylink_primary_refire"));
30         else if (req == WR_FIRE2)
31                 weapon_prepareattack(crylink_check2, crylink_check2, crylink_fire2_01, cvar("g_balance_crylink_secondary_refire"));
32         else if (req == WR_RAISE)
33                 crylink_select_01();
34         else if (req == WR_UPDATECOUNTS)
35                 self.currentammo = self.ammo_cells;
36         else if (req == WR_DROP)
37                 crylink_deselect_01();
38         else if (req == WR_SETUP)
39                 weapon_setup(WEP_CRYLINK, "w_crylink.zym", IT_CELLS);
40         else if (req == WR_CHECKAMMO)
41                 weapon_hasammo = crylink_check() + crylink_check2();
42 };
43
44 .entity realowner;
45 void W_Crylink_Touch (void)
46 {
47         RadiusDamage (self, self.realowner, cvar("g_balance_crylink_primary_damage"), cvar("g_balance_crylink_primary_edgedamage"), cvar("g_balance_crylink_primary_radius"), world, cvar("g_balance_crylink_primary_force"), IT_CRYLINK);
48         //te_smallflash(self.origin);
49         if (other.takedamage == DAMAGE_AIM)
50         {
51                 remove (self);
52                 return;
53         }
54         self.owner = world;
55         self.touch = SUB_Null;
56         setmodel (self, "models/plasma.mdl");
57         setsize (self, '0 0 0', '0 0 0');
58         self.gravity = 0;
59         self.glow_size = 0;
60         self.glow_color = 0;
61         self.think = SUB_Remove;
62         self.movetype = MOVETYPE_NONE;
63         self.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
64         SUB_SetFade(self, time, 1);
65         //remove (self);
66 }
67
68 void W_Crylink_Touch2 (void)
69 {
70         RadiusDamage (self, self.realowner, cvar("g_balance_crylink_secondary_damage"), cvar("g_balance_crylink_secondary_edgedamage"), cvar("g_balance_crylink_secondary_radius"), world, cvar("g_balance_crylink_secondary_force"), IT_CRYLINK);
71         //te_smallflash(self.origin);
72         if (other.takedamage == DAMAGE_AIM)
73         {
74                 remove (self);
75                 return;
76         }
77         self.owner = world;
78         self.touch = SUB_Null;
79         setmodel (self, "models/plasma.mdl");
80         setsize (self, '0 0 0', '0 0 0');
81         self.gravity = 0;
82         self.glow_size = 0;
83         self.glow_color = 0;
84         self.think = SUB_Remove;
85         self.movetype = MOVETYPE_NONE;
86         self.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
87         SUB_SetFade(self, time, 1);
88         //remove (self);
89 }
90
91 void W_Crylink_Attack (void)
92 {
93         local float counter, shots;
94         local vector org;
95         local entity proj;
96
97         local vector trueaim;
98         trueaim = W_TrueAim();
99
100         sound (self, CHAN_WEAPON, "weapons/crylink_fire.ogg", 1, ATTN_NORM);
101         if (self.items & IT_STRENGTH) {
102                 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
103         }
104
105         if (cvar("g_use_ammunition"))
106                 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
107         self.punchangle_x = -2;
108         org = self.origin + self.view_ofs + v_forward * 10 + v_right * 5 + v_up * -14;
109         te_smallflash(org);
110
111         shots = cvar("g_balance_crylink_shots");
112         if (!shots)
113                 shots = 5;
114         while (counter < shots)
115         {
116                 proj = spawn ();
117                 proj.realowner = proj.owner = self;
118                 proj.classname = "spike";
119
120                 proj.movetype = MOVETYPE_BOUNCE;
121                 proj.solid = SOLID_BBOX;
122                 proj.gravity = 0.001;
123
124                 setmodel (proj, "models/plasmatrail.mdl");
125                 setsize (proj, '0 0 0', '0 0 0');
126                 setorigin (proj, org);
127
128                 proj.velocity = (normalize(trueaim - org) + randomvec() * cvar("g_balance_crylink_primary_spread")) * cvar("g_balance_crylink_primary_speed");
129                 proj.touch = W_Crylink_Touch;
130                 proj.think = SUB_Remove;
131                 proj.nextthink = time + cvar("g_balance_crylink_primary_lifetime");
132
133                 proj.angles = vectoangles (proj.velocity);
134
135                 //proj.glow_size = 20;
136
137                 proj.effects = EF_NOSHADOW | EF_FULLBRIGHT | EF_LOWPRECISION;
138                 proj.colormod = proj_color;
139                 counter = counter + 1;
140         }
141 }
142
143 void W_Crylink_Attack2 (void)
144 {
145         local float counter, shots;
146         local vector org;
147         local entity proj;
148
149         local vector trueaim;
150         trueaim = W_TrueAim();
151
152         sound (self, CHAN_WEAPON, "weapons/crylink_fire.ogg", 1, ATTN_NORM);
153         if (self.items & IT_STRENGTH) {
154                 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
155         }
156
157         if (cvar("g_use_ammunition"))
158                 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
159         self.punchangle_x = -2;
160         org = self.origin + self.view_ofs + v_forward * 10 + v_right * 5 + v_up * -14;
161         te_smallflash(org);
162
163         shots = cvar("g_balance_crylink_secondary_shots");
164         if (!shots)
165                 shots = 5;
166         while (counter < shots)
167         {
168                 proj = spawn ();
169                 proj.realowner = proj.owner = self;
170                 proj.classname = "spike";
171
172                 proj.movetype = MOVETYPE_BOUNCE;
173                 proj.solid = SOLID_BBOX;
174                 proj.gravity = 0.001;
175
176                 setmodel (proj, "models/plasmatrail.mdl");
177                 setsize (proj, '0 0 0', '0 0 0');
178                 setorigin (proj, org);
179
180                 proj.velocity = (normalize(trueaim - org) + ((counter / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread")) * cvar("g_balance_crylink_secondary_speed");
181                 proj.touch = W_Crylink_Touch2;
182                 proj.think = SUB_Remove;
183                 proj.nextthink = time + cvar("g_balance_crylink_secondary_lifetime");
184
185                 proj.angles = vectoangles (proj.velocity);
186
187                 //proj.glow_size = 20;
188
189                 proj.effects = EF_NOSHADOW | EF_FULLBRIGHT | EF_LOWPRECISION;
190                 proj.colormod = proj_color;
191                 counter = counter + 1;
192         }
193 }
194
195
196 // weapon frames
197 void()  crylink_ready_01 =      {weapon_thinkf(WFRAME_IDLE, 0.1, crylink_ready_01); self.weaponentity.state = WS_READY;};
198 void()  crylink_select_01 =     {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
199 void()  crylink_deselect_01 =   {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
200 void()  crylink_fire1_01 =
201 {
202         weapon_doattack(crylink_check, crylink_check, W_Crylink_Attack);
203         weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), crylink_ready_01);
204 };
205 void()  crylink_fire2_01 =
206 {
207         weapon_doattack(crylink_check, crylink_check, W_Crylink_Attack2);
208         weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), crylink_ready_01);
209 };
210