-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusebutton.qc
54 lines (54 loc) · 876 Bytes
/
usebutton.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
//buttonuse
.void() th_use;
.float capenabled;
void() use_ent =
{
local entity oldself;
if (trace_ent.th_use)
{
oldself = self;
other = self;
self = trace_ent;
self.th_use();
self = oldself;
}
};
void() use_cmd =
{
local vector source;
local vector org;
makevectors(self.v_angle);
source = self.origin + '0 0 22';
traceline(source, source + v_forward * 70, 0, self);
if (trace_fraction == 1)
{
return;
}
org = trace_endpos - v_forward * 4;
if (trace_ent)
{
if (trace_ent.capenabled == 1)
{
if (self.capenabled == 1)
{
return;
}
self.frame = 384;
}
else
{
if (trace_ent.classname == "player" && trace_ent.capenabled == 0)
{
return;
}
else
{
if (trace_ent.classname == "player" && self.capenabled == 1)
{
return;
}
}
}
use_ent();
}
};