Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix first entering teapot failure #2259

Merged
merged 1 commit into from
Jul 13, 2023
Merged

fix first entering teapot failure #2259

merged 1 commit into from
Jul 13, 2023

Conversation

pfyy
Copy link
Contributor

@pfyy pfyy commented Jul 10, 2023

Description

Please carefully read the Contributing note and Code of conduct before making any pull requests.

teapot is using a function call:

Position pos = scene.getScriptManager().getConfig().born_pos;

but config may not be ready when the scene is first loaded using another thread, thus causing a fail

    public SceneScriptManager(Scene scene) {
        ...
        // Create
        new Thread(this::init).start();
    }

    private void init() {
        var meta = ScriptLoader.getSceneMeta(getScene().getId());
        if (meta == null) {
            return;
        }
        this.meta = meta;

        // TEMP
        this.isInit = true;
    }

Issues fixed by this PR

this is a dirty fix that waits 100ms 10 times when failure happens

Type of changes

  • Bug fix
  • New feature
  • Enhancement
  • Documentation

Checklist:

  • My code follows the style guidelines of this project
  • My pull request is unique and no other pull requests have been opened for these changes
  • I have read the Contributing note and Code of conduct
  • I am responsible for any copyright issues with my code if it occurs in the future.

@KingRainbow44 KingRainbow44 merged commit 0d71d29 into Grasscutters:development Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants