1 #include "teleport_dest.qh"
2 REGISTER_NET_LINKED(ENT_CLIENT_TELEPORT_DEST)
6 bool teleport_dest_send(entity this, entity to, int sendflags)
8 WriteHeader(MSG_ENTITY, ENT_CLIENT_TELEPORT_DEST);
9 WriteByte(MSG_ENTITY, sendflags);
11 if(sendflags & SF_TRIGGER_INIT)
13 WriteByte(MSG_ENTITY, this.cnt);
14 WriteCoord(MSG_ENTITY, this.speed);
15 WriteString(MSG_ENTITY, this.targetname);
16 WriteVector(MSG_ENTITY, this.origin);
18 WriteAngle(MSG_ENTITY, this.mangle_x);
19 WriteAngle(MSG_ENTITY, this.mangle_y);
20 WriteAngle(MSG_ENTITY, this.mangle_z);
26 void teleport_dest_link(entity this)
28 Net_LinkEntity(this, false, 0, teleport_dest_send);
29 this.SendFlags |= SF_TRIGGER_INIT;
32 spawnfunc(info_teleport_destination)
34 this.classname = "info_teleport_destination";
36 this.mangle = this.angles;
37 this.angles = '0 0 0';
39 //setorigin(this, this.origin + '0 0 27'); // To fix a mappers' habit as old as Quake
40 setorigin(this, this.origin);
46 objerror (this, "^3Teleport destination without a targetname");
48 teleport_dest_link(this);
51 spawnfunc(misc_teleporter_dest)
53 spawnfunc_info_teleport_destination(this);
58 void teleport_dest_remove(entity this)
60 // strfree(this.classname);
61 strfree(this.targetname);
64 NET_HANDLE(ENT_CLIENT_TELEPORT_DEST, bool isnew)
66 int sendflags = ReadByte();
68 if(sendflags & SF_TRIGGER_INIT)
70 this.classname = "info_teleport_destination";
71 this.cnt = ReadByte();
72 this.speed = ReadCoord();
73 this.targetname = strzone(ReadString());
74 this.origin = ReadVector();
76 this.mangle_x = ReadAngle();
77 this.mangle_y = ReadAngle();
78 this.mangle_z = ReadAngle();
80 setorigin(this, this.origin);
82 this.drawmask = MASK_NORMAL;
83 this.entremove = teleport_dest_remove;