From 4e2b8c4c4c2e2e86c6265dab22a9e49c8e2369a8 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 30 Nov 2015 13:44:45 +1000 Subject: [PATCH] Use a temporary hack to fix teleporters and jumppads not finding their targets --- qcsrc/common/triggers/misc/teleport_dest.qc | 61 ++++++++++++--------- qcsrc/common/triggers/trigger/jumppads.qc | 2 +- qcsrc/common/triggers/trigger/teleport.qc | 14 ++--- 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/qcsrc/common/triggers/misc/teleport_dest.qc b/qcsrc/common/triggers/misc/teleport_dest.qc index a53b5c056..5a367308e 100644 --- a/qcsrc/common/triggers/misc/teleport_dest.qc +++ b/qcsrc/common/triggers/misc/teleport_dest.qc @@ -2,20 +2,24 @@ REGISTER_NET_LINKED(ENT_CLIENT_TELEPORT_DEST) #ifdef SVQC -bool teleport_dest_send(entity this, entity to, float sf) +bool teleport_dest_send(entity this, entity to, int sf) { WriteHeader(MSG_ENTITY, ENT_CLIENT_TELEPORT_DEST); + WriteByte(MSG_ENTITY, sf); - WriteByte(MSG_ENTITY, self.cnt); - WriteCoord(MSG_ENTITY, self.speed); - WriteString(MSG_ENTITY, self.targetname); - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); - - WriteAngle(MSG_ENTITY, self.mangle_x); - WriteAngle(MSG_ENTITY, self.mangle_y); - WriteAngle(MSG_ENTITY, self.mangle_z); + 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; } @@ -70,24 +74,29 @@ void teleport_dest_remove() NET_HANDLE(ENT_CLIENT_TELEPORT_DEST, bool isnew) { - 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(); + int sf = ReadByte(); - self.mangle_x = ReadAngle(); - self.mangle_y = ReadAngle(); - self.mangle_z = ReadAngle(); + 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; - - setorigin(self, self.origin); - - self.drawmask = MASK_NORMAL; - self.entremove = teleport_dest_remove; } #endif diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 6a4332681..07c9d6da9 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -438,7 +438,7 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew) self.move_touch = trigger_push_touch; self.drawmask = MASK_NORMAL; self.move_time = time; - trigger_push_findtarget(); + defer(self, 0.25, trigger_push_findtarget); } if(sf & 2) diff --git a/qcsrc/common/triggers/trigger/teleport.qc b/qcsrc/common/triggers/trigger/teleport.qc index 88bf33b8a..9fb6f48b6 100644 --- a/qcsrc/common/triggers/trigger/teleport.qc +++ b/qcsrc/common/triggers/trigger/teleport.qc @@ -63,18 +63,18 @@ float trigger_teleport_send(entity this, entity to, float sf) if(sf & 1) { - WriteByte(MSG_ENTITY, self.team); - WriteInt24_t(MSG_ENTITY, self.spawnflags); - WriteByte(MSG_ENTITY, self.active); - WriteCoord(MSG_ENTITY, self.speed); + WriteByte(MSG_ENTITY, this.team); + WriteInt24_t(MSG_ENTITY, this.spawnflags); + WriteByte(MSG_ENTITY, this.active); + WriteCoord(MSG_ENTITY, this.speed); trigger_common_write(true); } if(sf & 2) { - WriteByte(MSG_ENTITY, self.team); - WriteByte(MSG_ENTITY, self.active); + WriteByte(MSG_ENTITY, this.team); + WriteByte(MSG_ENTITY, this.active); } return true; @@ -128,7 +128,7 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew) //self.move_touch = trigger_push_touch; self.drawmask = MASK_NORMAL; self.move_time = time; - teleport_findtarget(); + defer(self, 0.25, teleport_findtarget); self.teleport_next = teleport_first; teleport_first = self; -- 2.39.2