fix logger

This commit is contained in:
2020-09-25 00:45:45 +03:00
parent d2b22f4760
commit 9f3eaafa3f
21 changed files with 115 additions and 79 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"lab.zaar.be/thefish/alchemyst-go/engine/ecs"
"lab.zaar.be/thefish/alchemyst-go/engine/types"
"lab.zaar.be/thefish/alchemyst-go/util/appctx"
)
type CarriedFace interface {
@ -96,8 +97,16 @@ func FindCarriedUnder(who ecs.Entity) []ecs.Entity {
pickerCoords := Controller.GetComponent(who, ecs.CoordsComponent).(types.Coords)
carrieds := Controller.GetEntitiesWithComponent(ecs.CarriedComponent)
result := make([]ecs.Entity, 0)
for _, carried := range carrieds {
carriedCoords := Controller.GetComponent(carried, ecs.CoordsComponent).(types.Coords)
for idx, carried := range carrieds {
appctx.Logger().Info().Msgf("%d - %s", idx, carried)
maybeCoords := Controller.GetComponent(carried, ecs.CoordsComponent)
//if maybeCoords == nil {
// continue
//}
// убедились что что-то есть? тогда кастуем в тип
carriedCoords := maybeCoords.(types.Coords)
if pickerCoords.IsAdjacentTo(&carriedCoords) {
result = append(result, carried)
}