Improve assert+imporve error messages when adding comps

This commit is contained in:
bloeys
2022-12-06 06:17:25 +04:00
parent b025afe1b4
commit 855cbfaba3
4 changed files with 6 additions and 12 deletions

View File

@ -15,7 +15,7 @@ type Comp interface {
func AddComp[T Comp](e *Entity, c T) {
assert.T(!HasComp[T](e), "Entity with id %v already has component with name %s", e.ID, c.Name())
assert.T(!HasComp[T](e), "Entity with id '%v' already has component of type '%T'", e.ID, c)
e.Comps = append(e.Comps, c)
c.Init(e)