]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/triggers/func/ladder.qc
Merge branch 'master' into terencehill/menu_hudskin_selector
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / ladder.qc
1 REGISTER_NET_LINKED(ENT_CLIENT_LADDER)
2
3 void func_ladder_touch()
4 {SELFPARAM();
5 #ifdef SVQC
6         if (!other.iscreature)
7                 return;
8         if(IS_VEHICLE(other))
9                 return;
10 #endif
11
12         EXACTTRIGGER_TOUCH;
13
14         other.ladder_time = time + 0.1;
15         other.ladder_entity = self;
16 }
17
18 #ifdef SVQC
19 bool func_ladder_send(entity to, int sf)
20 {SELFPARAM();
21         WriteHeader(MSG_ENTITY, ENT_CLIENT_LADDER);
22
23         WriteString(MSG_ENTITY, self.classname);
24         WriteByte(MSG_ENTITY, self.skin);
25         WriteCoord(MSG_ENTITY, self.speed);
26
27         trigger_common_write(self, false);
28
29         return true;
30 }
31
32 void func_ladder_link()
33 {
34         self.SendEntity = func_ladder_send;
35         self.SendFlags = 0xFFFFFF;
36         //self.model = "null";
37 }
38
39 void func_ladder_init()
40 {
41         self.touch = func_ladder_touch;
42
43         trigger_init(self);
44         func_ladder_link();
45 }
46
47 spawnfunc(func_ladder)
48 {
49         func_ladder_init();
50 }
51
52 spawnfunc(func_water)
53 {
54         func_ladder_init();
55 }
56
57 #elif defined(CSQC)
58 .float speed;
59
60 void func_ladder_remove()
61 {
62         if(self.classname) { strunzone(self.classname); }
63         self.classname = string_null;
64 }
65
66 NET_HANDLE(ENT_CLIENT_LADDER, bool isnew)
67 {
68         self.classname = strzone(ReadString());
69         self.skin = ReadByte();
70         self.speed = ReadCoord();
71
72         trigger_common_read(false);
73
74         self.solid = SOLID_TRIGGER;
75         self.move_touch = func_ladder_touch;
76         self.drawmask = MASK_NORMAL;
77         self.move_time = time;
78         self.entremove = func_ladder_remove;
79
80         return true;
81 }
82 #endif