]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
items: temp kludge to reduce visibility of prediction errors
authorbones_was_here <bones_was_here@xonotic.au>
Thu, 15 Jun 2023 18:57:18 +0000 (04:57 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 15 Jun 2023 21:00:59 +0000 (07:00 +1000)
FIXME PROPERLY: needs moar sv_legacy_bbox_expand 0

qcsrc/client/items/items.qc
qcsrc/common/items/item.qh
qcsrc/server/items/items.qc

index c1bcfe6e5468b7754feacd420aadf0bf7f1a05d9..755f0f9cd40d0a52aff03018e70a485ef9574d17 100644 (file)
@@ -315,6 +315,15 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
                set_movetype(this, MOVETYPE_TOSS);
                this.velocity = ReadVector();
        }
+       else if (this.gravity) // caution: kludge FIXME (with sv_legacy_bbox_expand)
+       {
+               // workaround for prediction errors caused by bbox discrepancy between SVQC and CSQC
+               this.gravity = 0; // don't do this kludge again
+               this.pushable = false; // no fun allowed
+               set_movetype(this, MOVETYPE_NONE); // disable physics
+               this.velocity = '0 0 0'; // disable it more
+               SET_ONGROUND(this); // extra overkill
+       }
 
        this.entremove = ItemRemove;
 
index 2de498aaf48f6a8c2ca2f6e58699f22d6ce95b85..038566784725b962e5403755f2e3cae674a13323 100644 (file)
@@ -63,7 +63,8 @@ const int ITS_EXPIRING          = BIT(7);
 const float IT_DESPAWNFX_TIME = 1.5;
 
 // 2hz probably enough to correct a desync caused by serious lag
-const float IT_UPDATE_INTERVAL = 0.5;
+// FIXME but updating faster applies the kludge in Item_Think() sooner so it's less noticeable
+const float IT_UPDATE_INTERVAL = 0.0625;
 
 .float fade_start;
 .float fade_end;
index 3aef870e00a8b775257803ef20ce1270fc941067..46587b9c1d9e2a974a6fd654e46437d7c7c50d72 100644 (file)
@@ -205,6 +205,11 @@ void Item_Think(entity this)
                if (this.itemdef.instanceOfPowerup)
                        powerups_DropItem_Think(this);
 
+               // caution: kludge FIXME (with sv_legacy_bbox_expand)
+               // this works around prediction errors caused by bbox discrepancy between SVQC and CSQC
+               if (this.velocity == '0 0 0' && IS_ONGROUND(this))
+                       this.gravity = 0; // don't send ISF_DROP anymore
+
                // send slow updates even if the item didn't move
                // recovers prediction desyncs where server thinks item stopped, client thinks it didn't
                ItemUpdate(this);