From: Mario Date: Thu, 17 Dec 2015 23:02:20 +0000 (+1000) Subject: Update items instantly when they pass through warpzones X-Git-Tag: xonotic-v0.8.2~1480 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9afcdba8f937a13d14385e04c267c88fd0d4686c;p=xonotic%2Fxonotic-data.pk3dir.git Update items instantly when they pass through warpzones --- diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index 1f4d0a664..89653e8b8 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -110,6 +110,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle makevectors(player.angles); Reset_ArcBeam(player, v_forward); UpdateCSQCProjectileAfterTeleport(player); + UpdateItemAfterTeleport(player); #elif defined(CSQC) from = player.move_origin; player.move_origin = to; @@ -286,6 +287,7 @@ void WarpZone_PostTeleportPlayer_Callback(entity pl) makevectors(pl.angles); Reset_ArcBeam(pl, v_forward); UpdateCSQCProjectileAfterTeleport(pl); + UpdateItemAfterTeleport(pl); { WITH(entity, self, pl, anticheat_fixangle()); } diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index d25849533..432bfc366 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -323,9 +323,16 @@ bool ItemSend(entity this, entity to, int sf) return true; } -void ItemUpdate(entity item) +void ItemUpdate(entity this) { - item.SendFlags |= ISF_LOCATION; + this.oldorigin = this.origin; + this.SendFlags |= ISF_LOCATION; +} + +void UpdateItemAfterTeleport(entity this) +{ + if(this.SendEntity3 == ItemSend) + ItemUpdate(this); } bool have_pickup_item(entity this) @@ -443,10 +450,7 @@ void Item_Think() {SELFPARAM(); self.nextthink = time; if(self.origin != self.oldorigin) - { - self.oldorigin = self.origin; ItemUpdate(self); - } } bool Item_ItemsTime_SpectatorOnly(GameItem it); @@ -545,10 +549,7 @@ void Item_RespawnThink() {SELFPARAM(); self.nextthink = time; if(self.origin != self.oldorigin) - { - self.oldorigin = self.origin; ItemUpdate(self); - } if(time >= self.wait) Item_Respawn(); diff --git a/qcsrc/server/t_items.qh b/qcsrc/server/t_items.qh index 718944952..1dc79f8cc 100644 --- a/qcsrc/server/t_items.qh +++ b/qcsrc/server/t_items.qh @@ -97,7 +97,9 @@ void Item_FindTeam(); // TODO: perhaps nice special effect? bool ItemSend(entity this, entity to, int sf); -void ItemUpdate(entity item); +void ItemUpdate(entity this); + +void UpdateItemAfterTeleport(entity this); // pickup evaluation functions // these functions decide how desirable an item is to the bots