-
Notifications
You must be signed in to change notification settings - Fork 11
Description
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.
diepAPI/src/extensions/entity_manager.ts
Lines 20 to 23 in a6900e2
| 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.
diepAPI/src/extensions/entity_manager.ts
Lines 38 to 40 in a6900e2
| 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.