transhumandesign / kag-base

King Arthur's Gold base folder.
257 stars 118 forks source link

Keg loses its fuse when popping out of inventories #1266

Open mugg91 opened 2 years ago

mugg91 commented 2 years ago

Description

On a very rare chance, Keg can lose its fuse sprite overlay after popping out of inventories (confirmed with Dinghy and Bomber). This happens in online server (tested and confirmed on Sandbox EU & Sandbox US). It has not occured in offline. https://www.youtube.com/watch?v=OH7t7Y1Xi5A

Reproduction

  1. Spawn a bunch of Dinghies or Bombers.
  2. Spawn a bunch of Kegs and put them in the Dinghies or Bombers.
  3. Detonate one Keg on top of the Dinghies or Bombers. The Kegs will fly out.
  4. Sometimes one Keg will have lost its fuse.
asumagic commented 2 years ago

This seems to happen most when ping (.. or jitter or packet loss) is high at the time the keg is put inside of the inventory. Not sure what's going on.

mugg91 commented 1 year ago

I tested with a bare-bones Keg.as file and removed all the sprite scripts and blob scripts but the issue is still happening. The file only contains this:

void onInit(CBlob@ this)
{
    CSpriteLayer@ fuse = this.getSprite().addSpriteLayer("fuse", "Keg.png" , 16, 16, 0, 0);

    if (fuse !is null)
    {
        fuse.addAnimation("default", 0, false);
        int[] frames = {8, 9, 10, 11, 12, 13};
        fuse.animation.AddFrames(frames);
        fuse.SetOffset(Vec2f(3, -4));
        fuse.SetRelativeZ(1);
    }
}

You don't have to explode Keg on dinghies btw, it's sufficient to just add and remove from inventory repeatedly.

The scenario manifests when fuse.isVisible() keeps returning false after removing the Keg from inventory. I didn't find anything suspicious when checking other sprite and spritelayer functions such as getFrame(), getFrameIndex(), hasAnimationEnded(), etc.

FireAnim.as adds an "on fire" spritelayer to runners which is set to false in onInit() but is set to true continuosly while on fire. I tested with setting myself on fire and then going in a crate and jumping out of it. Doing so, I noticed the bug happen with with this spritelayer, but only for a few ticks. It corrects itself fast due to the repeated SetVisible(true) calls.

If you give Fireplace a PICKUP attachmentpoint and add

bool canBePickedUp(CBlob@ this, CBlob@ byBlob)
{
    return true;
}

then you can pick up fireplace. If you add it to your inventory and remove it, it may lose its fire animation spritelayer (It is a bit difficult to notice).

Drill doesn't have the bug because its heat spritelayer is set to visible = true every tick it is supposed to be showing.

Runners' head spritelayer will also not have this bug because, at least at first glance, the head spritelayer seems to be continuously set to visible = true as long as the body is visible: head.SetVisible(this.isVisible()); (line 259 in RunnerHead.as)

Gingerbeard5773 commented 1 year ago

I was not able to reproduce this bug

asumagic commented 1 year ago

I was but it's rather rare.

mugg91 commented 3 months ago

I haven't been able to reproduce this for like a year. Was this silently fixed?