diagnostic tool fixes

This commit is contained in:
2024-04-22 13:52:17 +03:00
parent 4f18b6db18
commit dc2e6ea2b5
20 changed files with 178 additions and 160 deletions

View File

@ -2,7 +2,8 @@ package gamemap
import (
"encoding/json"
"io/ioutil"
"os"
"lab.zaar.be/thefish/alchemyst-go/engine/items"
"lab.zaar.be/thefish/alchemyst-go/engine/mob"
"lab.zaar.be/thefish/alchemyst-go/engine/types"
@ -29,7 +30,7 @@ type PrefabRecord struct {
}
func LoadPrefabFile(filename string) (*PrefabFile, error) {
data, err := ioutil.ReadFile(filename)
data, err := os.ReadFile(filename)
if err!= nil {
return nil, err
}
@ -62,6 +63,8 @@ func (pfbl PrefabLoader) PrefabRoomsList() []Room {
for _, rawPrefab := range file.Prefabs {
appctx.Logger().Debug().Msgf("adding %s", rawPrefab.name)
for k,v := range rawPrefab.TileLegend {
currentTileLegend[k] = v
}
@ -73,8 +76,8 @@ func (pfbl PrefabLoader) PrefabRoomsList() []Room {
}
room := Room{
Rect:types.Rect{0, 0, rawPrefab.Size.X, rawPrefab.Size.Y},
Center: types.Coords{rawPrefab.Size.X / 2, rawPrefab.Size.Y / 2}, //fixme
Rect:types.Rect{X: 0, Y: 0, W: rawPrefab.Size.X, H: rawPrefab.Size.Y},
Center: types.Coords{X: rawPrefab.Size.X / 2, Y: rawPrefab.Size.Y / 2}, //fixme
Geometry: make([]func()*Tile, rawPrefab.Size.X*rawPrefab.Size.Y),
Mobs: make([]mob.Mob, rawPrefab.Size.X*rawPrefab.Size.Y),
Items: make([]items.Carried, rawPrefab.Size.X*rawPrefab.Size.Y),
@ -99,7 +102,7 @@ func (pfbl PrefabLoader) PrefabRoomsList() []Room {
}
if shortName == "connector" {
f = NewWall
room.Connectors = append(room.Connectors, types.Coords{i,j})
room.Connectors = append(room.Connectors, types.Coords{X: i,Y: j})
} else {
f, ok = TileTypeMap[shortName]
if (!ok) {