2 void plat_delayedinit()
4 plat_spawn_inside_trigger (); // the "start moving" trigger
7 float plat_send(entity to, float sf)
9 WriteByte(MSG_ENTITY, ENT_CLIENT_PLAT);
10 WriteByte(MSG_ENTITY, sf);
12 if(sf & SF_TRIGGER_INIT)
14 WriteShort(MSG_ENTITY, num_for_edict(self));
15 WriteString(MSG_ENTITY, self.target);
16 WriteString(MSG_ENTITY, self.target2);
17 WriteString(MSG_ENTITY, self.target3);
18 WriteString(MSG_ENTITY, self.target4);
19 WriteString(MSG_ENTITY, self.targetname);
21 WriteByte(MSG_ENTITY, self.platmovetype_start);
22 WriteByte(MSG_ENTITY, self.platmovetype_turn);
23 WriteByte(MSG_ENTITY, self.platmovetype_end);
25 WriteCoord(MSG_ENTITY, self.origin_x);
26 WriteCoord(MSG_ENTITY, self.origin_y);
27 WriteCoord(MSG_ENTITY, self.origin_z);
29 WriteString(MSG_ENTITY, self.model);
31 WriteCoord(MSG_ENTITY, self.mins_x);
32 WriteCoord(MSG_ENTITY, self.mins_y);
33 WriteCoord(MSG_ENTITY, self.mins_z);
34 WriteCoord(MSG_ENTITY, self.maxs_x);
35 WriteCoord(MSG_ENTITY, self.maxs_y);
36 WriteCoord(MSG_ENTITY, self.maxs_z);
38 WriteCoord(MSG_ENTITY, self.pos1_x);
39 WriteCoord(MSG_ENTITY, self.pos1_y);
40 WriteCoord(MSG_ENTITY, self.pos1_z);
41 WriteCoord(MSG_ENTITY, self.pos2_x);
42 WriteCoord(MSG_ENTITY, self.pos2_y);
43 WriteCoord(MSG_ENTITY, self.pos2_z);
45 WriteCoord(MSG_ENTITY, self.size_x);
46 WriteCoord(MSG_ENTITY, self.size_y);
47 WriteCoord(MSG_ENTITY, self.size_z);
49 WriteAngle(MSG_ENTITY, self.angles_x);
50 WriteAngle(MSG_ENTITY, self.angles_y);
51 WriteAngle(MSG_ENTITY, self.angles_z);
53 WriteAngle(MSG_ENTITY, self.mangle_x);
54 WriteAngle(MSG_ENTITY, self.mangle_y);
55 WriteAngle(MSG_ENTITY, self.mangle_z);
57 WriteShort(MSG_ENTITY, self.speed);
58 WriteShort(MSG_ENTITY, self.height);
59 WriteByte(MSG_ENTITY, self.lip);
60 WriteByte(MSG_ENTITY, self.state);
62 WriteShort(MSG_ENTITY, self.dmg);
65 if(sf & SF_TRIGGER_RESET)
75 Net_LinkEntity(self, 0, false, plat_send);
78 void spawnfunc_func_plat()
83 if(self.spawnflags & 4)
86 if(self.dmg && (self.message == ""))
87 self.message = "was squished";
88 if(self.dmg && (self.message2 == ""))
89 self.message2 = "was squished by";
93 precache_sound ("plats/plat1.wav");
94 precache_sound ("plats/plat2.wav");
95 self.noise = "plats/plat1.wav";
96 self.noise1 = "plats/plat2.wav";
101 precache_sound ("plats/medplat1.wav");
102 precache_sound ("plats/medplat2.wav");
103 self.noise = "plats/medplat1.wav";
104 self.noise1 = "plats/medplat2.wav";
109 precache_sound (self.sound1);
110 self.noise = self.sound1;
114 precache_sound (self.sound2);
115 self.noise1 = self.sound2;
118 self.mangle = self.angles;
119 self.angles = '0 0 0';
121 self.classname = "plat";
122 if (!InitMovingBrushTrigger())
124 self.effects |= EF_LOWPRECISION;
125 setsize (self, self.mins , self.maxs);
127 self.blocked = plat_crush;
134 self.height = self.size_z - self.lip;
136 self.pos1 = self.origin;
137 self.pos2 = self.origin;
138 self.pos2_z = self.origin_z - self.height;
140 self.reset = plat_reset;
145 InitializeEntity(self, plat_delayedinit, INITPRIO_FINDTARGET);
150 float dt = time - self.move_time;
151 self.move_time = time;
152 if(dt <= 0) { return; }
154 setorigin(self, self.origin + self.velocity * dt);
159 float sf = ReadByte();
161 if(sf & SF_TRIGGER_INIT)
163 self.sv_entnum = ReadShort();
164 self.target = strzone(ReadString());
165 self.target2 = strzone(ReadString());
166 self.target3 = strzone(ReadString());
167 self.target4 = strzone(ReadString());
168 self.targetname = strzone(ReadString());
170 self.platmovetype_start = ReadByte();
171 self.platmovetype_turn = ReadByte();
172 self.platmovetype_end = ReadByte();
174 self.origin_x = ReadCoord();
175 self.origin_y = ReadCoord();
176 self.origin_z = ReadCoord();
177 setorigin(self, self.origin);
179 self.model = strzone(ReadString());
180 setmodel(self, self.model);
182 self.mins_x = ReadCoord();
183 self.mins_y = ReadCoord();
184 self.mins_z = ReadCoord();
185 self.maxs_x = ReadCoord();
186 self.maxs_y = ReadCoord();
187 self.maxs_z = ReadCoord();
188 setsize(self, self.mins, self.maxs);
190 self.pos1_x = ReadCoord();
191 self.pos1_y = ReadCoord();
192 self.pos1_z = ReadCoord();
193 self.pos2_x = ReadCoord();
194 self.pos2_y = ReadCoord();
195 self.pos2_z = ReadCoord();
197 self.size_x = ReadCoord();
198 self.size_y = ReadCoord();
199 self.size_z = ReadCoord();
201 self.angles_x = ReadAngle();
202 self.angles_y = ReadAngle();
203 self.angles_z = ReadAngle();
205 self.mangle_x = ReadAngle();
206 self.mangle_y = ReadAngle();
207 self.mangle_z = ReadAngle();
209 self.speed = ReadShort();
210 self.height = ReadShort();
211 self.lip = ReadByte();
212 self.state = ReadByte();
214 self.dmg = ReadShort();
216 self.solid = SOLID_BSP;
217 self.movetype = MOVETYPE_PUSH;
218 self.drawmask = MASK_NORMAL;
219 self.draw = plat_draw;
222 plat_reset(); // also called here
225 if(sf & SF_TRIGGER_RESET)