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