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 WriteVector(MSG_ENTITY, this.pos1);
30 WriteVector(MSG_ENTITY, this.pos2);
32 WriteVector(MSG_ENTITY, this.size);
34 WriteAngle(MSG_ENTITY, this.mangle_x);
35 WriteAngle(MSG_ENTITY, this.mangle_y);
36 WriteAngle(MSG_ENTITY, this.mangle_z);
38 WriteShort(MSG_ENTITY, this.speed);
39 WriteShort(MSG_ENTITY, this.height);
40 WriteByte(MSG_ENTITY, this.lip);
41 WriteByte(MSG_ENTITY, this.state);
43 WriteShort(MSG_ENTITY, this.dmg);
46 if(sf & SF_TRIGGER_RESET)
54 void plat_link(entity this)
56 //Net_LinkEntity(this, 0, false, plat_send);
61 if (this.sounds == 0) this.sounds = 2;
63 if (this.spawnflags & 4) this.dmg = 10000;
65 if (this.dmg && (this.message == "")) this.message = "was squished";
66 if (this.dmg && (this.message2 == "")) this.message2 = "was squished by";
70 this.noise = "plats/plat1.wav";
71 this.noise1 = "plats/plat2.wav";
76 this.noise = "plats/medplat1.wav";
77 this.noise1 = "plats/medplat2.wav";
81 this.noise = this.sound1;
83 this.noise1 = this.sound2;
85 if(this.noise && this.noise != "") { precache_sound(this.noise); }
86 if(this.noise1 && this.noise1 != "") { precache_sound(this.noise1); }
88 this.mangle = this.angles;
89 this.angles = '0 0 0';
91 this.classname = "plat";
92 if (!InitMovingBrushTrigger(this))
94 this.effects |= EF_LOWPRECISION;
95 setsize (this, this.mins , this.maxs);
97 setblocked(this, plat_crush);
99 if (!this.speed) this.speed = 150;
100 if (!this.lip) this.lip = 16;
101 if (!this.height) this.height = this.size.z - this.lip;
103 this.pos1 = this.origin;
104 this.pos2 = this.origin;
105 this.pos2_z = this.origin.z - this.height;
107 this.reset = plat_reset;
110 InitializeEntity(this, plat_delayedinit, INITPRIO_FINDTARGET);
113 void plat_draw(entity this)
115 Movetype_Physics_NoMatchServer(this);
116 //Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
119 NET_HANDLE(ENT_CLIENT_PLAT, bool isnew)
121 float sf = ReadByte();
123 if(sf & SF_TRIGGER_INIT)
125 this.platmovetype_start = ReadByte();
126 this.platmovetype_turn = ReadByte();
127 this.platmovetype_end = ReadByte();
128 this.spawnflags = ReadByte();
130 this.model = strzone(ReadString());
131 _setmodel(this, this.model);
133 trigger_common_read(this, true);
135 this.pos1 = ReadVector();
136 this.pos2 = ReadVector();
138 this.size = ReadVector();
140 this.mangle_x = ReadAngle();
141 this.mangle_y = ReadAngle();
142 this.mangle_z = ReadAngle();
144 this.speed = ReadShort();
145 this.height = ReadShort();
146 this.lip = ReadByte();
147 this.state = ReadByte();
149 this.dmg = ReadShort();
151 this.classname = "plat";
152 this.solid = SOLID_BSP;
153 set_movetype(this, MOVETYPE_PUSH);
154 this.drawmask = MASK_NORMAL;
155 this.draw = plat_draw;
156 if (isnew) IL_PUSH(g_drawables, this);
158 this.entremove = trigger_remove_generic;
160 plat_reset(this); // also called here
162 set_movetype(this, MOVETYPE_PUSH);
163 this.move_time = time;
165 plat_spawn_inside_trigger(this);
168 if(sf & SF_TRIGGER_RESET)
172 this.move_time = time;