amethyst / amethyst/rustrogueliketutorial

Chapter 9: May not need `maintain` after each RunState call to dispatch

Abierto
#173 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
970
Forks
166
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

In this section of [Chapter 9](http://bfnightly.bracketproductions.com/rustbook/chapter_9.html#using-items) :

> Testing this with cargo run gives a surprise: the potion isn't deleted after use! This is because the ECS simply marks entities as dead - it doesn't delete them in systems (so as to not mess up iterators and threading). So after every call to dispatch, we need to add a call to maintain. In main.ecs:
>
> ```rust
> RunState::PreRun => {
> self.run_systems();
> self.ecs.maintain();
> newrunstate = RunState::AwaitingInput;
> }
> ```
>
>
Maybe it is not necessary to do this here, because the `maintain` is called in `self.run_systems();`.

> the potion isn't deleted after use!

It is because return to `RunState::AwaitingInput` when use the potion, It will keep waiting for input, and then keypress `i`, jump to the `ShowInventory` again.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.