]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/ent_cs.qc
Use exact trigger hack on teleporters
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / ent_cs.qc
index 0098dbc5ea2cf26eb63109298443850c8b2cff15..a3d3cc8be6aabec15490439354428ec71dd7956f 100644 (file)
@@ -52,7 +52,7 @@
        bool entcs_send(entity this, entity to, int sf)
        {
                entity player = this.owner;
-               sf |= 1;
+               sf |= BIT(0) | BIT(1);
                if (IS_PLAYER(to) || to.caplayer)                                  // unless spectating,
                {
                        bool same_team = (to == player) || (teamplay && player.team == to.team);
        void entcs_think()
        {
                SELFPARAM();
-               this.nextthink = time;
-               entity e = CSQCModel_server2csqc(this.sv_entnum + 1);
-               bool exists = e != NULL;
-               if (exists)
+               entity e = CSQCModel_server2csqc(this.sv_entnum);
+               if (e == NULL)
                {
-                       this.has_origin = true;
-                       this.origin = e.origin;
-                       // `cl_forceplayermodels 1` sounds will be wrong until the player has been in the PVS, but so be it
-                       if (this.model != e.model)
-                       {
-                               if (this.model) strunzone(this.model);
-                               this.model = strzone(e.model);
-                       }
+                       this.has_origin = this.has_sv_origin;
+                       return;
                }
-               else
+               this.has_origin = true;
+               this.origin = e.origin;
+               // `cl_forceplayermodels 1` sounds will be wrong until the player has been in the PVS, but so be it
+               if (this.model != e.model)
                {
-                       this.has_origin = this.has_sv_origin;
+                       if (this.model) strunzone(this.model);
+                       this.model = strzone(e.model);
                }
        }
 
                        this.classname = "entcs_receiver";
                        this.entremove = Ent_RemoveEntCS;
                        this.think = entcs_think;
-                       this.nextthink = time;
                }
                InterpolateOrigin_Undo(this);
                int sf = ReadShort();
                this.has_sv_origin = false;
-               this.m_entcs_private = boolean(sf & 1);
+               this.m_entcs_private = boolean(sf & BIT(0));
                int i = 1;
                #define X(public, fld, sv, cl) { if (sf & BIT(i)) cl; } i += 1;
                ENTCS_NETPROPS(X);
                entcs_receiver(this.sv_entnum, this);
                this.iflags |= IFLAG_ORIGIN;
                InterpolateOrigin_Note(this);
+               this.think();
                return true;
        }