-
Notifications
You must be signed in to change notification settings - Fork 20
/
tsoldier.qc
78 lines (65 loc) · 2.13 KB
/
tsoldier.qc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//========================================================
// Functions for the SOLDIER class and associated weaponry
//========================================================
void () NailGrenadeExplode;
void () NailGrenadeNailEm;
void () NailGrenadeLaunchNail;
void () NailGrenadeTouch = {
if (other == self.owner)
return;
// If the Nail Grenade hits a player, it just bounces off
sound(self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);
if (self.velocity == '0 0 0')
self.avelocity = '0 0 0';
};
void () NailGrenadeExplode = {
local entity te;
self.owner.no_active_nail_grens = self.owner.no_active_nail_grens + 1;
if (self.owner.no_active_nail_grens > 2) {
te = find(world, classname, "grenade");
while (te) {
if ((te.owner == self.owner) && (te.no_active_nail_grens == 1)) {
te.weapon = 9;
te.think = GrenadeExplode;
te.nextthink = time + 0.1;
}
te = find(te, classname, "grenade");
}
}
self.no_active_nail_grens = self.owner.no_active_nail_grens;
self.movetype = MOVETYPE_FLY;
setorigin(self, self.origin + '0 0 32');
self.avelocity = '0 500 0';
self.nextthink = time + 0.7;
self.think = NailGrenadeNailEm;
};
void () NailGrenadeNailEm = {
self.velocity = '0 0 0';
self.nextthink = time + 0.1;
self.think = NailGrenadeLaunchNail;
self.playerclass = 0;
};
void () NailGrenadeLaunchNail = {
local float i, j;
local float current_yaw;
i = 0;
while (i < 3) {
j = (random() + 2) * 5;
current_yaw = anglemod(self.angles_y + j);
self.angles_y = current_yaw;
self.angles_x = 0;
self.angles_z = 0;
makevectors(self.angles);
deathmsg = DMSG_GREN_NAIL;
launch_spike(self.origin, v_forward);
newmis.touch = superspike_touch;
newmis.weapon = DMSG_GREN_NAIL;
i = i + 1;
}
self.playerclass = self.playerclass + 1;
self.nextthink = time + 0.1;
if (self.playerclass > 50) {
self.weapon = DMSG_GREN_NAIL;
self.think = GrenadeExplode;
}
};