2 REGISTER_NET_LINKED(ENT_CLIENT_PLAT)
5 void plat_link(entity this);
7 void plat_delayedinit(entity this)
10 plat_spawn_inside_trigger(this); // the "start moving" trigger
13 float plat_send(entity this, entity to, float sf)
15 WriteHeader(MSG_ENTITY, ENT_CLIENT_PLAT);
16 WriteByte(MSG_ENTITY, sf);
18 if(sf & SF_TRIGGER_INIT)
20 WriteByte(MSG_ENTITY, this.platmovetype_start);
21 WriteByte(MSG_ENTITY, this.platmovetype_turn);
22 WriteByte(MSG_ENTITY, this.platmovetype_end);
23 WriteByte(MSG_ENTITY, this.spawnflags);
25 WriteString(MSG_ENTITY, this.model);
27 trigger_common_write(this, true);
29 WriteCoord(MSG_ENTITY, this.pos1_x);
30 WriteCoord(MSG_ENTITY, this.pos1_y);
31 WriteCoord(MSG_ENTITY, this.pos1_z);
32 WriteCoord(MSG_ENTITY, this.pos2_x);
33 WriteCoord(MSG_ENTITY, this.pos2_y);
34 WriteCoord(MSG_ENTITY, this.pos2_z);
36 WriteCoord(MSG_ENTITY, this.size_x);
37 WriteCoord(MSG_ENTITY, this.size_y);
38 WriteCoord(MSG_ENTITY, this.size_z);
40 WriteAngle(MSG_ENTITY, this.mangle_x);
41 WriteAngle(MSG_ENTITY, this.mangle_y);
42 WriteAngle(MSG_ENTITY, this.mangle_z);
44 WriteShort(MSG_ENTITY, this.speed);
45 WriteShort(MSG_ENTITY, this.height);
46 WriteByte(MSG_ENTITY, this.lip);
47 WriteByte(MSG_ENTITY, this.state);
49 WriteShort(MSG_ENTITY, this.dmg);
52 if(sf & SF_TRIGGER_RESET)
60 void plat_link(entity this)
62 //Net_LinkEntity(this, 0, false, plat_send);
67 if (this.sounds == 0) this.sounds = 2;
69 if (this.spawnflags & 4) this.dmg = 10000;
71 if (this.dmg && (this.message == "")) this.message = "was squished";
72 if (this.dmg && (this.message2 == "")) this.message2 = "was squished by";
76 this.noise = "plats/plat1.wav";
77 this.noise1 = "plats/plat2.wav";
82 this.noise = "plats/medplat1.wav";
83 this.noise1 = "plats/medplat2.wav";
87 this.noise = this.sound1;
89 this.noise1 = this.sound2;
91 if(this.noise && this.noise != "") { precache_sound(this.noise); }
92 if(this.noise1 && this.noise1 != "") { precache_sound(this.noise1); }
94 this.mangle = this.angles;
95 this.angles = '0 0 0';
97 this.classname = "plat";
98 if (!InitMovingBrushTrigger(this))
100 this.effects |= EF_LOWPRECISION;
101 setsize (this, this.mins , this.maxs);
103 setblocked(this, plat_crush);
105 if (!this.speed) this.speed = 150;
106 if (!this.lip) this.lip = 16;
107 if (!this.height) this.height = this.size.z - this.lip;
109 this.pos1 = this.origin;
110 this.pos2 = this.origin;
111 this.pos2_z = this.origin.z - this.height;
113 this.reset = plat_reset;
116 InitializeEntity(this, plat_delayedinit, INITPRIO_FINDTARGET);
119 void plat_draw(entity this)
121 Movetype_Physics_NoMatchServer(this);
122 //Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
125 NET_HANDLE(ENT_CLIENT_PLAT, bool isnew)
127 float sf = ReadByte();
129 if(sf & SF_TRIGGER_INIT)
131 this.platmovetype_start = ReadByte();
132 this.platmovetype_turn = ReadByte();
133 this.platmovetype_end = ReadByte();
134 this.spawnflags = ReadByte();
136 this.model = strzone(ReadString());
137 _setmodel(this, this.model);
139 trigger_common_read(this, true);
141 this.pos1_x = ReadCoord();
142 this.pos1_y = ReadCoord();
143 this.pos1_z = ReadCoord();
144 this.pos2_x = ReadCoord();
145 this.pos2_y = ReadCoord();
146 this.pos2_z = ReadCoord();
148 this.size_x = ReadCoord();
149 this.size_y = ReadCoord();
150 this.size_z = ReadCoord();
152 this.mangle_x = ReadAngle();
153 this.mangle_y = ReadAngle();
154 this.mangle_z = ReadAngle();
156 this.speed = ReadShort();
157 this.height = ReadShort();
158 this.lip = ReadByte();
159 this.state = ReadByte();
161 this.dmg = ReadShort();
163 this.classname = "plat";
164 this.solid = SOLID_BSP;
165 set_movetype(this, MOVETYPE_PUSH);
166 this.drawmask = MASK_NORMAL;
167 this.draw = plat_draw;
168 if (isnew) IL_PUSH(g_drawables, this);
170 this.entremove = trigger_remove_generic;
172 plat_reset(this); // also called here
174 set_movetype(this, MOVETYPE_PUSH);
175 this.move_time = time;
177 plat_spawn_inside_trigger(this);
180 if(sf & SF_TRIGGER_RESET)
184 this.move_time = time;