]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/triggers/func/ladder.qc
Merge branch 'TimePath/experiments/csqc_prediction' into Mario/qc_physics
[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 ent_func_ladder()
77 {
78         self.classname = strzone(ReadString());
79         self.warpzone_isboxy = ReadByte();
80         self.skin = ReadByte();
81         self.speed = ReadByte();
82         self.scale = ReadByte();
83         self.origin_x = ReadCoord();
84         self.origin_y = ReadCoord();
85         self.origin_z = ReadCoord();
86         setorigin(self, self.origin);
87         self.mins_x = ReadCoord();
88         self.mins_y = ReadCoord();
89         self.mins_z = ReadCoord();
90         self.maxs_x = ReadCoord();
91         self.maxs_y = ReadCoord();
92         self.maxs_z = ReadCoord();
93         setsize(self, self.mins, self.maxs);
94         self.movedir_x = ReadCoord();
95         self.movedir_y = ReadCoord();
96         self.movedir_z = ReadCoord();
97         self.angles_x = ReadCoord();
98         self.angles_y = ReadCoord();
99         self.angles_z = ReadCoord();
100
101         self.solid = SOLID_TRIGGER;
102         self.draw = trigger_draw_generic;
103         self.trigger_touch = func_ladder_touch;
104         self.drawmask = MASK_NORMAL;
105         self.move_time = time;
106 }
107 #endif