fix iterating on dead entities after player dies

This commit is contained in:
Thomas von Dein 2024-02-25 14:19:21 +01:00
parent b0a8060d5b
commit 2e3acf4ec4
3 changed files with 12 additions and 4 deletions

View File

@ -4,11 +4,11 @@ Background: background-lila
#############
# #
# t #
#> S # #
# ># >#
#< # #
# v# <#
# ># ^#
#< #W#####
# o v# o#
#############

View File

@ -60,6 +60,10 @@ func (system *DestroyableSystem) Update() error {
doorposition, renderable, door := query.Get()
for player := range playerobserver.Entities {
if !system.World.Alive(player) {
continue
}
playerposition := (*Position)(system.World.Get(player, posID))
playervelocity := (*Velocity)(system.World.Get(player, veloID))

View File

@ -60,6 +60,10 @@ func (system *TransientSystem) Update() error {
transientposition, _, transient := query.Get()
for player := range playerobserver.Entities {
if !system.World.Alive(player) {
continue
}
playerposition := (*Position)(system.World.Get(player, posID))
playervelocity := (*Velocity)(system.World.Get(player, veloID))