aboutsummaryrefslogtreecommitdiff
path: root/internal/world/room.go
blob: a92a4280568b59f899397e0f0447c582f82a5b61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package world

type ExitDir string

const (
	North ExitDir = "north"
	South ExitDir = "south"
	East  ExitDir = "east"
	West  ExitDir = "west"
	Up    ExitDir = "up"
	Down  ExitDir = "down"
)

var ExitAliases = map[string]ExitDir{
	"n":  North,
	"s":  South,
	"e":  East,
	"w":  West,
	"u":  Up,
	"d":  Down,
}

var OppositeExit = map[ExitDir]ExitDir{
	North: South,
	South: North,
	East:  West,
	West:  East,
	Up:    Down,
	Down:  Up,
}

var ExitOrder = []ExitDir{
	"northwest", North, "northeast",
	East, "southeast", South, "southwest",
	West, Up, Down,
}

type SpawnDef struct {
	ItemID       string `yaml:"item_id"`
	Quantity     int    `yaml:"quantity"`
	RespawnTicks int    `yaml:"respawn_ticks"`
}

type Room struct {
	ID          int             `yaml:"id"`
	Name        string          `yaml:"name"`
	Description string          `yaml:"description"`
	MapSymbol   string          `yaml:"map_symbol"`
	Exits       map[ExitDir]int `yaml:"exits"`
	Objects     []string        `yaml:"objects"`
	Spawns      []SpawnDef      `yaml:"spawns"`
	Mobs        []string        `yaml:"mobs"`
}