MovingBlocks / Terasology

Terasology - open source voxel world
http://terasology.org
Apache License 2.0
3.69k stars 1.34k forks source link

Error Dialog cannot be closed #3768

Closed jdrueckert closed 4 years ago

jdrueckert commented 5 years ago

What you were trying to do

Close the error dialog coming up on starting a game whilst having dependency issues underneath.

What actually happened

The "Ok" button is not clickable. It's also not greyed out or anything, but if I click on it, simply nothing happens.

How to reproduce

bluebee12 commented 5 years ago

This is the first Open source issue for me. Please tell me what module i should look into..

DarkWeird commented 4 years ago

I found a place of error. This problem is with InputSystem: When the application state changes in StateLoading - InputSystem is not cleared. When the state of the application has changed back to StateMainMenu - the InputSystem is already filled inputEntities. On update() - trying update via updateInputEntities(), but do not update because this code returns false:

inputEntities == null
                || inputEntities.length != 2
                || inputEntities[0] == null
                || inputEntities[1] == null
                || !inputEntities[0].equals(localPlayer.getClientEntity())
                || !inputEntities[1].equals(localPlayer.getCharacterEntity())

params: inputEntities: [EntityRef(id=1, exists=false), NullEntityRef] from localPlayer: [EntityRef(id=1, exists=true, ...), NullEntityRef]

inputEntities[0].equals(localPlayer.getClientEntity() returns true.

EntityRef's equals:

  public final boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o instanceof EntityRef) {
            EntityRef other = (EntityRef) o;
            return !exists() && !other.exists() || getId() == other.getId();
        }
        return false;
    }

As a result, InputSystem uses old not existing refs, and the UI is not available ( There are no EventTarget for the MouseButtonEvents.). I don’t know where to fix it: StateMainMenu - recreate the InputSystem when initializing StateMainMenu, EntityRef - modify Equals, but there are a lot of commits for it, it seems so done on purpose InputSystem - add existence checks to updateInputEntities TerasologyEngine - Clear InputSystem state.