]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/t_halflife.qc
Attempt to make ladders predicted (currently quite messed up)
[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 #ifdef CSQC
57         print("Setting ladder time on ", other.classname, "\n");
58 #endif
59
60         other.ladder_time = time + 0.1;
61         other.ladder_entity = self;
62 }
63
64 #ifdef SVQC
65 float func_ladder_send(entity to, float sf)
66 {
67         WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER);
68
69         WriteString(MSG_ENTITY, self.classname);
70         WriteByte(MSG_ENTITY, self.warpzone_isboxy);
71         WriteByte(MSG_ENTITY, self.skin);
72         WriteByte(MSG_ENTITY, self.speed);
73         WriteByte(MSG_ENTITY, self.scale);
74         WriteCoord(MSG_ENTITY, self.origin_x);
75         WriteCoord(MSG_ENTITY, self.origin_y);
76         WriteCoord(MSG_ENTITY, self.origin_z);
77
78         WriteCoord(MSG_ENTITY, self.mins_x);
79         WriteCoord(MSG_ENTITY, self.mins_y);
80         WriteCoord(MSG_ENTITY, self.mins_z);
81         WriteCoord(MSG_ENTITY, self.maxs_x);
82         WriteCoord(MSG_ENTITY, self.maxs_y);
83         WriteCoord(MSG_ENTITY, self.maxs_z);
84
85         WriteCoord(MSG_ENTITY, self.movedir_x);
86         WriteCoord(MSG_ENTITY, self.movedir_y);
87         WriteCoord(MSG_ENTITY, self.movedir_z);
88
89         WriteCoord(MSG_ENTITY, self.angles_x);
90         WriteCoord(MSG_ENTITY, self.angles_y);
91         WriteCoord(MSG_ENTITY, self.angles_z);
92
93         return TRUE;
94 }
95
96 void func_ladder_link()
97 {
98         self.nextthink = time;
99         Net_LinkEntity(self, FALSE, 0, func_ladder_send);
100         self.nextthink = 0;
101 }
102
103 void spawnfunc_func_ladder()
104 {
105         EXACTTRIGGER_INIT;
106         self.touch = func_ladder_touch;
107
108         func_ladder_link();
109 }
110
111 void spawnfunc_func_water()
112 {
113         EXACTTRIGGER_INIT;
114         self.touch = func_ladder_touch;
115
116         func_ladder_link();
117 }
118
119 #elif defined(CSQC)
120 .float speed;
121
122 void func_ladder_draw()
123 {
124         tracebox(self.origin, self.mins, self.maxs, self.origin, MOVE_NORMAL, self);
125
126         if(trace_fraction < 1)
127         if(trace_ent)
128         {
129                 other = trace_ent;
130                 func_ladder_touch();
131         }
132 }
133
134 void ent_func_ladder()
135 {
136         self.classname = strzone(ReadString());
137         self.warpzone_isboxy = ReadByte();
138         self.skin = ReadByte();
139         self.speed = ReadByte();
140         self.scale = ReadByte();
141         self.origin_x = ReadCoord();
142         self.origin_y = ReadCoord();
143         self.origin_z = ReadCoord();
144         setorigin(self, self.origin);
145         self.mins_x = ReadCoord();
146         self.mins_y = ReadCoord();
147         self.mins_z = ReadCoord();
148         self.maxs_x = ReadCoord();
149         self.maxs_y = ReadCoord();
150         self.maxs_z = ReadCoord();
151         setsize(self, self.mins, self.maxs);
152         self.movedir_x = ReadCoord();
153         self.movedir_y = ReadCoord();
154         self.movedir_z = ReadCoord();
155         self.angles_x = ReadCoord();
156         self.angles_y = ReadCoord();
157         self.angles_z = ReadCoord();
158
159         self.solid = SOLID_TRIGGER;
160         self.draw = func_ladder_draw;
161         self.drawmask = MASK_NORMAL;
162 }
163 #endif