]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/triggers/func/ladder.qc
Cleanup
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / ladder.qc
1 void func_ladder_touch()
2 {SELFPARAM();
3 #ifdef SVQC
4         if (!other.iscreature)
5                 return;
6         if(IS_VEHICLE(other))
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 bool func_ladder_send(entity this, entity to, float sf)
22 {
23         WriteHeader(MSG_ENTITY, ENT_CLIENT_LADDER);
24
25         WriteString(MSG_ENTITY, self.classname);
26         WriteByte(MSG_ENTITY, self.skin);
27         WriteByte(MSG_ENTITY, self.speed);
28         WriteString(MSG_ENTITY, self.mdl);
29
30         trigger_common_write(false);
31
32         return true;
33 }
34
35 void func_ladder_link()
36 {
37         //self.SendEntity = func_ladder_send;
38         //self.SendFlags = 0xFFFFFF;
39         //self.model = "null";
40 }
41
42 spawnfunc(func_ladder)
43 {
44         self.mdl = self.model;
45         EXACTTRIGGER_INIT;
46         self.touch = func_ladder_touch;
47
48         func_ladder_link();
49 }
50
51 spawnfunc(func_water)
52 {
53         self.mdl = self.model;
54         EXACTTRIGGER_INIT;
55         self.touch = func_ladder_touch;
56
57         func_ladder_link();
58 }
59
60 #elif defined(CSQC)
61 .float speed;
62
63 NET_HANDLE(ENT_CLIENT_LADDER, bool isnew)
64 {
65         self.classname = strzone(ReadString());
66         self.skin = ReadByte();
67         self.speed = ReadByte();
68         self.model = strzone(ReadString());
69
70         trigger_common_read(false);
71
72         return = true;
73
74         self.mins = self.maxs = '0 0 0';
75
76         self.solid = SOLID_TRIGGER;
77         self.draw = trigger_draw_generic;
78         self.trigger_touch = func_ladder_touch;
79         self.drawmask = MASK_NORMAL;
80         self.move_time = time;
81         self.entremove = trigger_remove_generic;
82
83         //precache_model(self.mdl);
84         EXACTTRIGGER_INIT;
85 }
86 #endif