]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Update items instantly when they pass through warpzones
authorMario <mario@smbclan.net>
Thu, 17 Dec 2015 23:02:20 +0000 (09:02 +1000)
committerMario <mario@smbclan.net>
Thu, 17 Dec 2015 23:02:20 +0000 (09:02 +1000)
qcsrc/common/triggers/teleporters.qc
qcsrc/server/t_items.qc
qcsrc/server/t_items.qh

index 1f4d0a664217b49ce3d6a25d3a9ac21100074c62..89653e8b84c42b8234b8c7c4e47ebbbc43218b67 100644 (file)
@@ -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());
        }
index d258495332f372f4af29bae6ef65ed3a7e3cc069..432bfc36630a1bb69e4ab96b0b4f7caa110ad5ab 100644 (file)
@@ -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();
index 718944952c291571dea3257a0114ab84d43463c9..1dc79f8cc24266cf9250bf46f9cf81a89d7cb4a0 100644 (file)
@@ -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