1 REGISTER_NET_LINKED(ENT_CLIENT_PLAT)
6 void plat_delayedinit()
9 plat_spawn_inside_trigger(); // the "start moving" trigger
12 float plat_send(entity to, float sf)
14 WriteHeader(MSG_ENTITY, ENT_CLIENT_PLAT);
15 WriteByte(MSG_ENTITY, sf);
17 if(sf & SF_TRIGGER_INIT)
19 WriteByte(MSG_ENTITY, self.platmovetype_start);
20 WriteByte(MSG_ENTITY, self.platmovetype_turn);
21 WriteByte(MSG_ENTITY, self.platmovetype_end);
22 WriteByte(MSG_ENTITY, self.spawnflags);
24 WriteString(MSG_ENTITY, self.model);
26 trigger_common_write(true);
28 WriteCoord(MSG_ENTITY, self.pos1_x);
29 WriteCoord(MSG_ENTITY, self.pos1_y);
30 WriteCoord(MSG_ENTITY, self.pos1_z);
31 WriteCoord(MSG_ENTITY, self.pos2_x);
32 WriteCoord(MSG_ENTITY, self.pos2_y);
33 WriteCoord(MSG_ENTITY, self.pos2_z);
35 WriteCoord(MSG_ENTITY, self.size_x);
36 WriteCoord(MSG_ENTITY, self.size_y);
37 WriteCoord(MSG_ENTITY, self.size_z);
39 WriteAngle(MSG_ENTITY, self.mangle_x);
40 WriteAngle(MSG_ENTITY, self.mangle_y);
41 WriteAngle(MSG_ENTITY, self.mangle_z);
43 WriteShort(MSG_ENTITY, self.speed);
44 WriteShort(MSG_ENTITY, self.height);
45 WriteByte(MSG_ENTITY, self.lip);
46 WriteByte(MSG_ENTITY, self.state);
48 WriteShort(MSG_ENTITY, self.dmg);
51 if(sf & SF_TRIGGER_RESET)
61 //Net_LinkEntity(self, 0, false, plat_send);
69 if(self.spawnflags & 4)
72 if(self.dmg && (self.message == ""))
73 self.message = "was squished";
74 if(self.dmg && (self.message2 == ""))
75 self.message2 = "was squished by";
79 precache_sound ("plats/plat1.wav");
80 precache_sound ("plats/plat2.wav");
81 self.noise = "plats/plat1.wav";
82 self.noise1 = "plats/plat2.wav";
87 precache_sound ("plats/medplat1.wav");
88 precache_sound ("plats/medplat2.wav");
89 self.noise = "plats/medplat1.wav";
90 self.noise1 = "plats/medplat2.wav";
95 precache_sound (self.sound1);
96 self.noise = self.sound1;
100 precache_sound (self.sound2);
101 self.noise1 = self.sound2;
104 self.mangle = self.angles;
105 self.angles = '0 0 0';
107 self.classname = "plat";
108 if (!InitMovingBrushTrigger())
110 self.effects |= EF_LOWPRECISION;
111 setsize (self, self.mins , self.maxs);
113 self.blocked = plat_crush;
120 self.height = self.size_z - self.lip;
122 self.pos1 = self.origin;
123 self.pos2 = self.origin;
124 self.pos2_z = self.origin_z - self.height;
126 self.reset = plat_reset;
129 InitializeEntity(self, plat_delayedinit, INITPRIO_FINDTARGET);
132 void plat_draw(entity this)
134 Movetype_Physics_NoMatchServer();
135 //Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
138 NET_HANDLE(ENT_CLIENT_PLAT, bool isnew)
140 float sf = ReadByte();
142 if(sf & SF_TRIGGER_INIT)
144 self.platmovetype_start = ReadByte();
145 self.platmovetype_turn = ReadByte();
146 self.platmovetype_end = ReadByte();
147 self.spawnflags = ReadByte();
149 self.model = strzone(ReadString());
150 _setmodel(self, self.model);
152 trigger_common_read(true);
154 self.pos1_x = ReadCoord();
155 self.pos1_y = ReadCoord();
156 self.pos1_z = ReadCoord();
157 self.pos2_x = ReadCoord();
158 self.pos2_y = ReadCoord();
159 self.pos2_z = ReadCoord();
161 self.size_x = ReadCoord();
162 self.size_y = ReadCoord();
163 self.size_z = ReadCoord();
165 self.mangle_x = ReadAngle();
166 self.mangle_y = ReadAngle();
167 self.mangle_z = ReadAngle();
169 self.speed = ReadShort();
170 self.height = ReadShort();
171 self.lip = ReadByte();
172 self.state = ReadByte();
174 self.dmg = ReadShort();
176 self.classname = "plat";
177 self.solid = SOLID_BSP;
178 self.movetype = MOVETYPE_PUSH;
179 self.drawmask = MASK_NORMAL;
180 self.draw = plat_draw;
182 self.entremove = trigger_remove_generic;
184 plat_reset(); // also called here
186 self.move_movetype = MOVETYPE_PUSH;
187 self.move_origin = self.origin;
188 self.move_angles = self.angles;
189 self.move_time = time;
191 plat_spawn_inside_trigger();
194 if(sf & SF_TRIGGER_RESET)
198 self.move_origin = self.origin;
199 self.move_angles = self.angles;
200 self.move_time = time;