4 void plat_delayedinit()
7 plat_spawn_inside_trigger(); // the "start moving" trigger
10 float plat_send(entity to, float sf)
12 WriteByte(MSG_ENTITY, ENT_CLIENT_PLAT);
13 WriteByte(MSG_ENTITY, sf);
15 if(sf & SF_TRIGGER_INIT)
17 WriteByte(MSG_ENTITY, self.platmovetype_start);
18 WriteByte(MSG_ENTITY, self.platmovetype_turn);
19 WriteByte(MSG_ENTITY, self.platmovetype_end);
20 WriteByte(MSG_ENTITY, self.spawnflags);
22 WriteString(MSG_ENTITY, self.model);
24 trigger_common_write(true);
26 WriteCoord(MSG_ENTITY, self.pos1_x);
27 WriteCoord(MSG_ENTITY, self.pos1_y);
28 WriteCoord(MSG_ENTITY, self.pos1_z);
29 WriteCoord(MSG_ENTITY, self.pos2_x);
30 WriteCoord(MSG_ENTITY, self.pos2_y);
31 WriteCoord(MSG_ENTITY, self.pos2_z);
33 WriteCoord(MSG_ENTITY, self.size_x);
34 WriteCoord(MSG_ENTITY, self.size_y);
35 WriteCoord(MSG_ENTITY, self.size_z);
37 WriteAngle(MSG_ENTITY, self.mangle_x);
38 WriteAngle(MSG_ENTITY, self.mangle_y);
39 WriteAngle(MSG_ENTITY, self.mangle_z);
41 WriteShort(MSG_ENTITY, self.speed);
42 WriteShort(MSG_ENTITY, self.height);
43 WriteByte(MSG_ENTITY, self.lip);
44 WriteByte(MSG_ENTITY, self.state);
46 WriteShort(MSG_ENTITY, self.dmg);
49 if(sf & SF_TRIGGER_RESET)
59 //Net_LinkEntity(self, 0, false, plat_send);
67 if(self.spawnflags & 4)
70 if(self.dmg && (self.message == ""))
71 self.message = "was squished";
72 if(self.dmg && (self.message2 == ""))
73 self.message2 = "was squished by";
77 precache_sound ("plats/plat1.wav");
78 precache_sound ("plats/plat2.wav");
79 self.noise = "plats/plat1.wav";
80 self.noise1 = "plats/plat2.wav";
85 precache_sound ("plats/medplat1.wav");
86 precache_sound ("plats/medplat2.wav");
87 self.noise = "plats/medplat1.wav";
88 self.noise1 = "plats/medplat2.wav";
93 precache_sound (self.sound1);
94 self.noise = self.sound1;
98 precache_sound (self.sound2);
99 self.noise1 = self.sound2;
102 self.mangle = self.angles;
103 self.angles = '0 0 0';
105 self.classname = "plat";
106 if (!InitMovingBrushTrigger())
108 self.effects |= EF_LOWPRECISION;
109 setsize (self, self.mins , self.maxs);
111 self.blocked = plat_crush;
118 self.height = self.size_z - self.lip;
120 self.pos1 = self.origin;
121 self.pos2 = self.origin;
122 self.pos2_z = self.origin_z - self.height;
124 self.reset = plat_reset;
127 InitializeEntity(self, plat_delayedinit, INITPRIO_FINDTARGET);
132 Movetype_Physics_NoMatchServer();
133 //Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
138 float sf = ReadByte();
140 if(sf & SF_TRIGGER_INIT)
142 self.platmovetype_start = ReadByte();
143 self.platmovetype_turn = ReadByte();
144 self.platmovetype_end = ReadByte();
145 self.spawnflags = ReadByte();
147 self.model = strzone(ReadString());
148 _setmodel(self, self.model);
150 trigger_common_read(true);
152 self.pos1_x = ReadCoord();
153 self.pos1_y = ReadCoord();
154 self.pos1_z = ReadCoord();
155 self.pos2_x = ReadCoord();
156 self.pos2_y = ReadCoord();
157 self.pos2_z = ReadCoord();
159 self.size_x = ReadCoord();
160 self.size_y = ReadCoord();
161 self.size_z = ReadCoord();
163 self.mangle_x = ReadAngle();
164 self.mangle_y = ReadAngle();
165 self.mangle_z = ReadAngle();
167 self.speed = ReadShort();
168 self.height = ReadShort();
169 self.lip = ReadByte();
170 self.state = ReadByte();
172 self.dmg = ReadShort();
174 self.classname = "plat";
175 self.solid = SOLID_BSP;
176 self.movetype = MOVETYPE_PUSH;
177 self.drawmask = MASK_NORMAL;
178 self.draw = plat_draw;
180 self.entremove = trigger_remove_generic;
182 plat_reset(); // also called here
184 self.move_movetype = MOVETYPE_PUSH;
185 self.move_origin = self.origin;
186 self.move_angles = self.angles;
187 self.move_time = time;
189 plat_spawn_inside_trigger();
192 if(sf & SF_TRIGGER_RESET)
196 self.move_origin = self.origin;
197 self.move_angles = self.angles;
198 self.move_time = time;