-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathflare.qc
72 lines (57 loc) · 1.64 KB
/
flare.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
//====================================
// This file handles all the functions
// to deal with the flare 'grenade'.
//====================================
void () FlareGrenadeTouch = {
sound(self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);
if (pointcontents(self.origin) == CONTENT_SKY) {
dremove(self);
return;
}
if (other == world) {
self.movetype = MOVETYPE_NONE;
self.velocity = '0 0 0';
}
if (self.velocity == '0 0 0') {
self.avelocity = '0 0 0';
self.touch = SUB_Null;
}
};
void () FlareGrenadeThink = {
local float rnum;
local float time_left;
time_left = self.health - time;
if (time_left > 33) {
rnum = random();
if (rnum < 0.5)
self.effects = EF_DIMLIGHT;
else
self.effects = 0;
self.nextthink = time + 0.05 + random() * 0.1;
} else if (time_left > 31) {
rnum = random();
if (rnum < 0.5)
self.effects = EF_BRIGHTLIGHT;
else
self.effects = EF_DIMLIGHT;
self.nextthink = time + 0.05 + random() * 0.1;
} else if (time_left > 15) {
self.effects = EF_BRIGHTLIGHT;
self.nextthink = time + 10;
} else if (time_left < 1) {
RemoveFlare();
} else {
self.effects = 8;
self.nextthink = time + time_left;
}
};
void () FlareGrenadeExplode = {
self.skin = 1;
self.health = time + 40;
self.nextthink = time + 0.05 + random() * 0.1;
self.think = FlareGrenadeThink;
};
void () RemoveFlare = {
self.effects = self.effects - (self.effects & EF_BRIGHTLIGHT);
dremove(self);
};