1 REGISTER_NET_LINKED(ENT_CLIENT_PLAT)
4 void plat_link(entity this);
6 void plat_delayedinit(entity this)
9 plat_spawn_inside_trigger(this); // the "start moving" trigger
12 float plat_send(entity this, 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, this.platmovetype_start);
20 WriteByte(MSG_ENTITY, this.platmovetype_turn);
21 WriteByte(MSG_ENTITY, this.platmovetype_end);
22 WriteByte(MSG_ENTITY, this.spawnflags);
24 WriteString(MSG_ENTITY, this.model);
26 trigger_common_write(this, true);
28 WriteCoord(MSG_ENTITY, this.pos1_x);
29 WriteCoord(MSG_ENTITY, this.pos1_y);
30 WriteCoord(MSG_ENTITY, this.pos1_z);
31 WriteCoord(MSG_ENTITY, this.pos2_x);
32 WriteCoord(MSG_ENTITY, this.pos2_y);
33 WriteCoord(MSG_ENTITY, this.pos2_z);
35 WriteCoord(MSG_ENTITY, this.size_x);
36 WriteCoord(MSG_ENTITY, this.size_y);
37 WriteCoord(MSG_ENTITY, this.size_z);
39 WriteAngle(MSG_ENTITY, this.mangle_x);
40 WriteAngle(MSG_ENTITY, this.mangle_y);
41 WriteAngle(MSG_ENTITY, this.mangle_z);
43 WriteShort(MSG_ENTITY, this.speed);
44 WriteShort(MSG_ENTITY, this.height);
45 WriteByte(MSG_ENTITY, this.lip);
46 WriteByte(MSG_ENTITY, this.state);
48 WriteShort(MSG_ENTITY, this.dmg);
51 if(sf & SF_TRIGGER_RESET)
59 void plat_link(entity this)
61 //Net_LinkEntity(this, 0, false, plat_send);
66 if (this.sounds == 0) this.sounds = 2;
68 if (this.spawnflags & 4) this.dmg = 10000;
70 if (this.dmg && (this.message == "")) this.message = "was squished";
71 if (this.dmg && (this.message2 == "")) this.message2 = "was squished by";
75 precache_sound ("plats/plat1.wav");
76 precache_sound ("plats/plat2.wav");
77 this.noise = "plats/plat1.wav";
78 this.noise1 = "plats/plat2.wav";
83 precache_sound ("plats/medplat1.wav");
84 precache_sound ("plats/medplat2.wav");
85 this.noise = "plats/medplat1.wav";
86 this.noise1 = "plats/medplat2.wav";
91 precache_sound (this.sound1);
92 this.noise = this.sound1;
96 precache_sound (this.sound2);
97 this.noise1 = this.sound2;
100 this.mangle = this.angles;
101 this.angles = '0 0 0';
103 this.classname = "plat";
104 if (!InitMovingBrushTrigger(this))
106 this.effects |= EF_LOWPRECISION;
107 setsize (this, this.mins , this.maxs);
109 setblocked(this, plat_crush);
111 if (!this.speed) this.speed = 150;
112 if (!this.lip) this.lip = 16;
113 if (!this.height) this.height = this.size.z - this.lip;
115 this.pos1 = this.origin;
116 this.pos2 = this.origin;
117 this.pos2_z = this.origin.z - this.height;
119 this.reset = plat_reset;
122 InitializeEntity(this, plat_delayedinit, INITPRIO_FINDTARGET);
125 void plat_draw(entity this)
127 Movetype_Physics_NoMatchServer(this);
128 //Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
131 NET_HANDLE(ENT_CLIENT_PLAT, bool isnew)
133 float sf = ReadByte();
135 if(sf & SF_TRIGGER_INIT)
137 this.platmovetype_start = ReadByte();
138 this.platmovetype_turn = ReadByte();
139 this.platmovetype_end = ReadByte();
140 this.spawnflags = ReadByte();
142 this.model = strzone(ReadString());
143 _setmodel(this, this.model);
145 trigger_common_read(this, true);
147 this.pos1_x = ReadCoord();
148 this.pos1_y = ReadCoord();
149 this.pos1_z = ReadCoord();
150 this.pos2_x = ReadCoord();
151 this.pos2_y = ReadCoord();
152 this.pos2_z = ReadCoord();
154 this.size_x = ReadCoord();
155 this.size_y = ReadCoord();
156 this.size_z = ReadCoord();
158 this.mangle_x = ReadAngle();
159 this.mangle_y = ReadAngle();
160 this.mangle_z = ReadAngle();
162 this.speed = ReadShort();
163 this.height = ReadShort();
164 this.lip = ReadByte();
165 this.state = ReadByte();
167 this.dmg = ReadShort();
169 this.classname = "plat";
170 this.solid = SOLID_BSP;
171 this.move_movetype = MOVETYPE_PUSH;
172 this.drawmask = MASK_NORMAL;
173 this.draw = plat_draw;
175 this.entremove = trigger_remove_generic;
177 plat_reset(this); // also called here
179 this.move_movetype = MOVETYPE_PUSH;
180 this.move_time = time;
182 plat_spawn_inside_trigger(this);
185 if(sf & SF_TRIGGER_RESET)
189 this.move_time = time;