forked from fabiolimamp/alkaline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhip_expl.qc
189 lines (173 loc) · 4.34 KB
/
hip_expl.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/* Exploder QuickC program
By Jim Dose' 9/13/96
Copyright (c)1996 Hipnotic Interactive, Inc.
All rights reserved.
Distributed (unsupported) on 3.12.97
*/
float USE_PARTICLES = 1;
void() BecomeExplosion;
void() exploder_fire =
{
local entity temp;
temp = self;
activator = other;
SUB_UseTargets ();
self = temp;
other = self;
if (self.dmg<120)
{
sound (self , CHAN_AUTO, "misc/shortexp.wav", self.volume, self.speed);
}
else
{
sound (self , CHAN_AUTO, "misc/longexpl.wav", self.volume, self.speed);
}
T_RadiusDamage (self, self.owner, self.dmg, other, DMGTYPE_EXPLOSION);
BecomeExplosion();
};
void() exploder_use =
{
if (self.delay)
{
self.nextthink = time + self.delay;
self.delay = 0;
self.think = exploder_fire;
}
else
{
exploder_fire();
}
};
/*QUAKED func_exploder (0.4 0 0) (0 0 0) (8 8 8) particles
Spawns an explosion when triggered. Triggers any targets.
"dmg" specifies how much damage to cause. Negative values
indicate no damage. Default or 0 indicates 120.
"volume" volume at which to play explosions (default 1.0)
"speed" attenuation for explosions (default normal)
*/
void() func_exploder =
{
precache_sound ("misc/shortexp.wav");
precache_sound ("misc/longexpl.wav");
self.classname = "exploder";
self.use = exploder_use;
if ( self.dmg == 0 )
{
self.dmg = 120;
}
if ( self.dmg < 0 )
{
self.dmg = 0;
}
if ( self.speed == 0 )
{
self.speed = 1;
}
if ( self.volume == 0 )
{
self.volume = 1.0;
}
};
void() multi_exploder_fire =
{
local entity temp;
local entity expl;
self.nextthink = time + self.wait;
if (self.state == 0)
{
self.state = 1;
self.duration = time + self.duration;
temp = self;
activator = other;
SUB_UseTargets ();
self = temp;
other = self;
}
if (time > self.duration)
{
remove(self);
return;
}
expl = spawn();
expl.owner = self.owner;
expl.dmg = self.dmg;
expl.origin_x = self.absmin_x + (random() * (self.absmax_x - self.absmin_x));
expl.origin_y = self.absmin_y + (random() * (self.absmax_y - self.absmin_y));
expl.origin_z = self.absmin_z + (random() * (self.absmax_z - self.absmin_z));
sound (expl , CHAN_VOICE, "misc/shortexp.wav", self.volume, self.speed);
T_RadiusDamage (expl, self.owner, self.dmg, other, DMGTYPE_EXPLOSION);
temp = self;
self = expl;
BecomeExplosion();
self = temp;
};
void( vector loc, float rad, float damage, float dur, float pause, float vol) multi_explosion =
{
local entity temp;
temp = self;
self = spawn();
self.origin = loc;
self.dmg = damage;
self.duration = dur;
self.wait = pause;
self.owner = world;
self.absmin = self.origin - (rad * '1 1 1');
self.absmax = self.origin + (rad * '1 1 1');
self.think = multi_exploder_fire;
self.volume = vol;
multi_exploder_fire();
self = temp;
};
void() multi_exploder_use =
{
if (self.delay)
{
self.nextthink = time + self.delay;
self.delay = 0;
self.think = multi_exploder_fire;
}
else
{
self.think = multi_exploder_fire;
multi_exploder_fire();
}
};
/*QUAKED func_multi_exploder (0.4 0 0) ?
Spawns an explosion when triggered. Triggers any targets.
size of brush determines where explosions will occur.
"dmg" specifies how much damage to cause from each explosion
Negative values indicate no damage. Default or 0 indicates 120.
"delay" delay before exploding (Default 0 seconds)
"duration" how long to explode for (Default 1 second)
"wait" time between each explosion (default 0.25 seconds)
"volume" volume to play explosion sound at (default 0.5)
"speed" attenuation for explosions (default normal)
*/
void() func_multi_exploder =
{
precache_sound ("misc/shortexp.wav");
precache_sound ("misc/longexpl.wav");
self.classname = "exploder";
self.use = multi_exploder_use;
setmodel(self,self.model);
self.movetype = MOVETYPE_NONE;
self.modelindex = 0;
self.model = "";
if ( self.dmg == 0 )
{
self.dmg = 120;
}
if ( self.dmg < 0 )
{
self.dmg = 0;
}
if (self.duration == 0)
self.duration = 1.0;
if (self.speed == 0)
self.speed = 1.0;
if (self.volume == 0)
self.volume = 0.5;
if (self.wait == 0)
self.wait = 0.25;
self.state = 0;
};