X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Fmisc%2Fteleport_dest.qc;h=33401930d8d929c836ee4f16273ae5aa6d90d669;hb=847371860eeb17f6a51aa1fa532aa997cb2d760b;hp=a3c9783537bb9632d691def050eeedb8bf8fa220;hpb=5607e279fe7b0dc9f92e15556ed6dc33f17f549c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/misc/teleport_dest.qc b/qcsrc/common/triggers/misc/teleport_dest.qc index a3c978353..33401930d 100644 --- a/qcsrc/common/triggers/misc/teleport_dest.qc +++ b/qcsrc/common/triggers/misc/teleport_dest.qc @@ -1,7 +1,37 @@ +REGISTER_NET_LINKED(ENT_CLIENT_TELEPORT_DEST) + #ifdef SVQC -void spawnfunc_info_teleport_destination (void) +bool teleport_dest_send(entity this, entity to, int sf) +{ + WriteHeader(MSG_ENTITY, ENT_CLIENT_TELEPORT_DEST); + WriteByte(MSG_ENTITY, sf); + + if(sf & 1) + { + WriteByte(MSG_ENTITY, this.cnt); + WriteCoord(MSG_ENTITY, this.speed); + WriteString(MSG_ENTITY, this.targetname); + WriteCoord(MSG_ENTITY, this.origin_x); + WriteCoord(MSG_ENTITY, this.origin_y); + WriteCoord(MSG_ENTITY, this.origin_z); + + WriteAngle(MSG_ENTITY, this.mangle_x); + WriteAngle(MSG_ENTITY, this.mangle_y); + WriteAngle(MSG_ENTITY, this.mangle_z); + } + + return true; +} + +void teleport_dest_link() {SELFPARAM(); + Net_LinkEntity(self, false, 0, teleport_dest_send); + self.SendFlags |= 1; // update +} + +spawnfunc(info_teleport_destination) +{ self.classname = "info_teleport_destination"; self.mangle = self.angles; @@ -15,16 +45,58 @@ void spawnfunc_info_teleport_destination (void) } else objerror ("^3Teleport destination without a targetname"); + + teleport_dest_link(); +} + +spawnfunc(misc_teleporter_dest) +{ + spawnfunc_info_teleport_destination(this); } -void spawnfunc_misc_teleporter_dest (void) +spawnfunc(target_teleporter) { - spawnfunc_info_teleport_destination(); + spawnfunc_info_teleport_destination(this); +} + +#elif defined(CSQC) + +void teleport_dest_remove(entity this) +{ + //if(self.classname) + //strunzone(self.classname); + //self.classname = string_null; + + if(this.targetname) + strunzone(this.targetname); + this.targetname = string_null; } -void spawnfunc_target_teleporter (void) +NET_HANDLE(ENT_CLIENT_TELEPORT_DEST, bool isnew) { - spawnfunc_info_teleport_destination(); + int sf = ReadByte(); + + if(sf & 1) + { + self.classname = "info_teleport_destination"; + self.cnt = ReadByte(); + self.speed = ReadCoord(); + self.targetname = strzone(ReadString()); + self.origin_x = ReadCoord(); + self.origin_y = ReadCoord(); + self.origin_z = ReadCoord(); + + self.mangle_x = ReadAngle(); + self.mangle_y = ReadAngle(); + self.mangle_z = ReadAngle(); + + setorigin(self, self.origin); + + self.drawmask = MASK_NORMAL; + self.entremove = teleport_dest_remove; + } + + return = true; } #endif