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));
16 WriteByte(MSG_ENTITY, self.platmovetype_start);
17 WriteByte(MSG_ENTITY, self.platmovetype_turn);
18 WriteByte(MSG_ENTITY, self.platmovetype_end);
20 WriteString(MSG_ENTITY, self.model);
22 trigger_common_write(true);
24 WriteCoord(MSG_ENTITY, self.pos1_x);
25 WriteCoord(MSG_ENTITY, self.pos1_y);
26 WriteCoord(MSG_ENTITY, self.pos1_z);
27 WriteCoord(MSG_ENTITY, self.pos2_x);
28 WriteCoord(MSG_ENTITY, self.pos2_y);
29 WriteCoord(MSG_ENTITY, self.pos2_z);
31 WriteCoord(MSG_ENTITY, self.size_x);
32 WriteCoord(MSG_ENTITY, self.size_y);
33 WriteCoord(MSG_ENTITY, self.size_z);
35 WriteAngle(MSG_ENTITY, self.mangle_x);
36 WriteAngle(MSG_ENTITY, self.mangle_y);
37 WriteAngle(MSG_ENTITY, self.mangle_z);
39 WriteShort(MSG_ENTITY, self.speed);
40 WriteShort(MSG_ENTITY, self.height);
41 WriteByte(MSG_ENTITY, self.lip);
42 WriteByte(MSG_ENTITY, self.state);
44 WriteShort(MSG_ENTITY, self.dmg);
47 if(sf & SF_TRIGGER_RESET)
57 Net_LinkEntity(self, 0, false, plat_send);
60 void spawnfunc_func_plat()
65 if(self.spawnflags & 4)
68 if(self.dmg && (self.message == ""))
69 self.message = "was squished";
70 if(self.dmg && (self.message2 == ""))
71 self.message2 = "was squished by";
75 precache_sound ("plats/plat1.wav");
76 precache_sound ("plats/plat2.wav");
77 self.noise = "plats/plat1.wav";
78 self.noise1 = "plats/plat2.wav";
83 precache_sound ("plats/medplat1.wav");
84 precache_sound ("plats/medplat2.wav");
85 self.noise = "plats/medplat1.wav";
86 self.noise1 = "plats/medplat2.wav";
91 precache_sound (self.sound1);
92 self.noise = self.sound1;
96 precache_sound (self.sound2);
97 self.noise1 = self.sound2;
100 self.mangle = self.angles;
101 self.angles = '0 0 0';
103 self.classname = "plat";
104 if (!InitMovingBrushTrigger())
106 self.effects |= EF_LOWPRECISION;
107 setsize (self, self.mins , self.maxs);
109 self.blocked = plat_crush;
116 self.height = self.size_z - self.lip;
118 self.pos1 = self.origin;
119 self.pos2 = self.origin;
120 self.pos2_z = self.origin_z - self.height;
122 self.reset = plat_reset;
127 InitializeEntity(self, plat_delayedinit, INITPRIO_FINDTARGET);
132 Movetype_Physics_NoMatchServer();
137 float sf = ReadByte();
139 if(sf & SF_TRIGGER_INIT)
141 self.sv_entnum = ReadShort();
143 self.platmovetype_start = ReadByte();
144 self.platmovetype_turn = ReadByte();
145 self.platmovetype_end = 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.solid = SOLID_BSP;
175 self.movetype = MOVETYPE_PUSH;
176 self.drawmask = MASK_NORMAL;
177 self.draw = plat_draw;
179 self.entremove = trigger_remove_generic;
181 plat_reset(); // also called here
183 self.move_origin = self.origin;
184 self.move_angles = self.angles;
185 self.move_time = time;
188 if(sf & SF_TRIGGER_RESET)
192 self.move_origin = self.origin;
193 self.move_angles = self.angles;
194 self.move_time = time;