From b7bba4f92a1d86bb1849388e091d33197105911d Mon Sep 17 00:00:00 2001 From: Brian Yeh Date: Thu, 16 May 2024 17:43:51 -0700 Subject: [PATCH] lint --- cardinal/system/regen.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/cardinal/system/regen.go b/cardinal/system/regen.go index faf3190..767bd8f 100644 --- a/cardinal/system/regen.go +++ b/cardinal/system/regen.go @@ -11,15 +11,17 @@ import ( // RegenSystem replenishes the player's HP at every tick. // This provides an example of a system that doesn't rely on a transaction to update a component. func RegenSystem(world cardinal.WorldContext) error { - return cardinal.NewSearch().Entity(filter.Exact(filter.Component[comp.Player](), filter.Component[comp.Health]())).Each(world, func(id types.EntityID) bool { - health, err := cardinal.GetComponent[comp.Health](world, id) - if err != nil { + return cardinal.NewSearch().Entity( + filter.Exact(filter.Component[comp.Player](), filter.Component[comp.Health]())). + Each(world, func(id types.EntityID) bool { + health, err := cardinal.GetComponent[comp.Health](world, id) + if err != nil { + return true + } + health.HP++ + if err := cardinal.SetComponent[comp.Health](world, id, health); err != nil { + return true + } return true - } - health.HP++ - if err := cardinal.SetComponent[comp.Health](world, id, health); err != nil { - return true - } - return true - }) + }) }