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

entityManager.entities doesn't hold the entities from the current frame, but the frame before. #50

Closed
Cazka opened this issue Oct 22, 2022 · 0 comments · Fixed by #51
Closed
Labels
bug Something isn't working

Comments

@Cazka
Copy link
Owner

Cazka commented Oct 22, 2022

This is an issue, which I discovered, when I had a new idea for a script, which displays the discord pfp of your friends on their tank body.

Here is a demo that shows the issue

diepAPI.mp4

First i thought, that the diepAPI.apis.scaling.toCanvasPos() is not perfect #49

But after some testing i found out that entityManager.entities doesn't store the information of the entities from the current frame.

game.on('frame', () => {
this.#entities = this.#entitiesUpdated;
this.#entitiesUpdated = [];
});

The entities from the current frame are stored in #entities and are later in the next frame copied over to #entitiesUpdated.

get entities(): Entity[] {
return this.#entities;
}

The solution is to remove #entitiesUpdated and only store entity information in #entities. There also needs to be found a solution for the game.on('frame') listener to be called after all other listeners have been triggered.

@Cazka Cazka pinned this issue Oct 22, 2022
@Cazka Cazka unpinned this issue Oct 22, 2022
@Cazka Cazka added the bug Something isn't working label Oct 22, 2022
@Cazka Cazka linked a pull request Oct 22, 2022 that will close this issue
@Cazka Cazka removed a link to a pull request Oct 22, 2022
@Cazka Cazka linked a pull request Oct 22, 2022 that will close this issue
@Cazka Cazka closed this as completed in #51 Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant