]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/triggers/func/ladder.qc
It actually compiles
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / ladder.qc
1 void func_ladder_touch()
2 {
3 #ifdef SVQC
4         if (!other.iscreature)
5                 return;
6         if (other.vehicle_flags & VHF_ISVEHICLE)
7                 return;
8 #endif
9 #ifdef CSQC
10         if(other.classname != "csqcmodel")
11                 return;
12 #endif
13
14         EXACTTRIGGER_TOUCH;
15
16         other.ladder_time = time + 0.1;
17         other.ladder_entity = self;
18 }
19
20 #ifdef SVQC
21 float func_ladder_send(entity to, float sf)
22 {
23         WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER);
24
25         WriteString(MSG_ENTITY, self.classname);
26         WriteByte(MSG_ENTITY, self.warpzone_isboxy);
27         WriteByte(MSG_ENTITY, self.skin);
28         WriteByte(MSG_ENTITY, self.speed);
29         WriteByte(MSG_ENTITY, self.scale);
30         WriteCoord(MSG_ENTITY, self.origin_x);
31         WriteCoord(MSG_ENTITY, self.origin_y);
32         WriteCoord(MSG_ENTITY, self.origin_z);
33
34         WriteCoord(MSG_ENTITY, self.mins_x);
35         WriteCoord(MSG_ENTITY, self.mins_y);
36         WriteCoord(MSG_ENTITY, self.mins_z);
37         WriteCoord(MSG_ENTITY, self.maxs_x);
38         WriteCoord(MSG_ENTITY, self.maxs_y);
39         WriteCoord(MSG_ENTITY, self.maxs_z);
40
41         WriteCoord(MSG_ENTITY, self.movedir_x);
42         WriteCoord(MSG_ENTITY, self.movedir_y);
43         WriteCoord(MSG_ENTITY, self.movedir_z);
44
45         WriteCoord(MSG_ENTITY, self.angles_x);
46         WriteCoord(MSG_ENTITY, self.angles_y);
47         WriteCoord(MSG_ENTITY, self.angles_z);
48
49         return TRUE;
50 }
51
52 void func_ladder_link()
53 {
54         Net_LinkEntity(self, FALSE, 0, func_ladder_send);
55 }
56
57 void spawnfunc_func_ladder()
58 {
59         EXACTTRIGGER_INIT;
60         self.touch = func_ladder_touch;
61
62         func_ladder_link();
63 }
64
65 void spawnfunc_func_water()
66 {
67         EXACTTRIGGER_INIT;
68         self.touch = func_ladder_touch;
69
70         func_ladder_link();
71 }
72
73 #elif defined(CSQC)
74 .float speed;
75
76 void func_ladder_draw()
77 {
78         float dt = time - self.move_time;
79         self.move_time = time;
80         if(dt <= 0) { return; }
81
82         trigger_touch_generic(func_ladder_touch);
83 }
84
85 void ent_func_ladder()
86 {
87         self.classname = strzone(ReadString());
88         self.warpzone_isboxy = ReadByte();
89         self.skin = ReadByte();
90         self.speed = ReadByte();
91         self.scale = ReadByte();
92         self.origin_x = ReadCoord();
93         self.origin_y = ReadCoord();
94         self.origin_z = ReadCoord();
95         setorigin(self, self.origin);
96         self.mins_x = ReadCoord();
97         self.mins_y = ReadCoord();
98         self.mins_z = ReadCoord();
99         self.maxs_x = ReadCoord();
100         self.maxs_y = ReadCoord();
101         self.maxs_z = ReadCoord();
102         setsize(self, self.mins, self.maxs);
103         self.movedir_x = ReadCoord();
104         self.movedir_y = ReadCoord();
105         self.movedir_z = ReadCoord();
106         self.angles_x = ReadCoord();
107         self.angles_y = ReadCoord();
108         self.angles_z = ReadCoord();
109
110         self.solid = SOLID_TRIGGER;
111         self.draw = func_ladder_draw;
112         self.drawmask = MASK_NORMAL;
113         self.move_time = time;
114 }
115 #endif