]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/t_halflife.qc
Almost fix ladder prediction (entering and idle are still iffy)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / t_halflife.qc
1 .float ladder_time;
2 .entity ladder_entity;
3
4 #ifdef SVQC
5 .float  roomtype;
6 .float  radius;
7 .float  pitch;
8 .float  renderamt;
9 .float  rendermode;
10 .vector rendercolor;
11
12 void spawnfunc_weapon_crossbow() {}
13 void spawnfunc_weapon_handgrenade() {}
14 void spawnfunc_ammo_crossbow() {}
15 void spawnfunc_ammo_9mmclip() {}
16 void spawnfunc_ammo_gaussclip() {}
17 void spawnfunc_weapon_rpg() {}
18 void spawnfunc_weapon_357() {}
19 void ammo_ARgrenades() {}
20 void spawnfunc_item_battery() {}
21 void spawnfunc_ammo_rpgclip() {}
22 void weapon_9mmAR() {}
23 void spawnfunc_weapon_tripmine() {}
24 void spawnfunc_weapon_snark() {}
25 void spawnfunc_ammo_buckshot() {}
26 void ammo_9mmAR() {}
27 void spawnfunc_ammo_357() {}
28 void spawnfunc_weapon_gauss() {}
29 void spawnfunc_weapon_hornetgun() {}
30 //void spawnfunc_weapon_shotgun() {}
31 void spawnfunc_item_healthkit() {}
32 void spawnfunc_item_longjump() {}
33 void spawnfunc_item_antidote() {}
34 void spawnfunc_func_recharge() {}
35 void spawnfunc_info_node() {}
36 void spawnfunc_env_sound() {}
37 void spawnfunc_light_spot() {}
38 void spawnfunc_func_healthcharger() {}
39 #endif
40
41 void func_ladder_touch()
42 {
43 #ifdef SVQC
44         if (!other.iscreature)
45                 return;
46         if (other.vehicle_flags & VHF_ISVEHICLE)
47                 return;
48 #endif
49 #ifdef CSQC
50         if(other.classname != "csqcmodel")
51                 return;
52 #endif
53
54         EXACTTRIGGER_TOUCH;
55
56         other.ladder_time = time + 0.1;
57         other.ladder_entity = self;
58 }
59
60 #ifdef SVQC
61 float func_ladder_send(entity to, float sf)
62 {
63         WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER);
64
65         WriteString(MSG_ENTITY, self.classname);
66         WriteByte(MSG_ENTITY, self.warpzone_isboxy);
67         WriteByte(MSG_ENTITY, self.skin);
68         WriteByte(MSG_ENTITY, self.speed);
69         WriteByte(MSG_ENTITY, self.scale);
70         WriteCoord(MSG_ENTITY, self.origin_x);
71         WriteCoord(MSG_ENTITY, self.origin_y);
72         WriteCoord(MSG_ENTITY, self.origin_z);
73
74         WriteCoord(MSG_ENTITY, self.mins_x);
75         WriteCoord(MSG_ENTITY, self.mins_y);
76         WriteCoord(MSG_ENTITY, self.mins_z);
77         WriteCoord(MSG_ENTITY, self.maxs_x);
78         WriteCoord(MSG_ENTITY, self.maxs_y);
79         WriteCoord(MSG_ENTITY, self.maxs_z);
80
81         WriteCoord(MSG_ENTITY, self.movedir_x);
82         WriteCoord(MSG_ENTITY, self.movedir_y);
83         WriteCoord(MSG_ENTITY, self.movedir_z);
84
85         WriteCoord(MSG_ENTITY, self.angles_x);
86         WriteCoord(MSG_ENTITY, self.angles_y);
87         WriteCoord(MSG_ENTITY, self.angles_z);
88
89         return TRUE;
90 }
91
92 void func_ladder_link()
93 {
94         Net_LinkEntity(self, FALSE, 0, func_ladder_send);
95 }
96
97 void spawnfunc_func_ladder()
98 {
99         EXACTTRIGGER_INIT;
100         self.touch = func_ladder_touch;
101
102         func_ladder_link();
103 }
104
105 void spawnfunc_func_water()
106 {
107         EXACTTRIGGER_INIT;
108         self.touch = func_ladder_touch;
109
110         func_ladder_link();
111 }
112
113 #elif defined(CSQC)
114 .float speed;
115
116 void func_ladder_draw()
117 {
118         tracebox(self.origin, self.mins, self.maxs, self.origin, MOVE_NORMAL, self);
119
120         //if(trace_fraction < 1)
121         if(trace_ent)
122         {
123                 other = trace_ent;
124                 func_ladder_touch();
125         }
126 }
127
128 void ent_func_ladder()
129 {
130         self.classname = strzone(ReadString());
131         self.warpzone_isboxy = ReadByte();
132         self.skin = ReadByte();
133         self.speed = ReadByte();
134         self.scale = ReadByte();
135         self.origin_x = ReadCoord();
136         self.origin_y = ReadCoord();
137         self.origin_z = ReadCoord();
138         setorigin(self, self.origin);
139         self.mins_x = ReadCoord();
140         self.mins_y = ReadCoord();
141         self.mins_z = ReadCoord();
142         self.maxs_x = ReadCoord();
143         self.maxs_y = ReadCoord();
144         self.maxs_z = ReadCoord();
145         setsize(self, self.mins, self.maxs);
146         self.movedir_x = ReadCoord();
147         self.movedir_y = ReadCoord();
148         self.movedir_z = ReadCoord();
149         self.angles_x = ReadCoord();
150         self.angles_y = ReadCoord();
151         self.angles_z = ReadCoord();
152
153         self.solid = SOLID_TRIGGER;
154         self.draw = func_ladder_draw;
155         self.drawmask = MASK_NORMAL;
156 }
157 #endif