]> git.lizzy.rs Git - mtmap.git/blob - types.go
Properly serialize special node id mappings
[mtmap.git] / types.go
1 package mtmap
2
3 import (
4         "fmt"
5         "github.com/anon55555/mt"
6 )
7
8 type MapBlk struct {
9         mt.MapBlk
10         Flags            MapBlkFlags
11         LightingComplete uint16
12         StaticObjs       []StaticObj
13         Timestamp        uint32
14 }
15
16 type MapBlkFlags uint8
17
18 const (
19         IsUnderground MapBlkFlags = 1 << iota
20         DayNightDiffers
21         NotGenerated = 1 << 4
22 )
23
24 var (
25         SerializeVer uint8 = 28
26         ContentWidth uint8 = 2
27         ParamsWidth  uint8 = 2
28         NodeMetaVer  uint8 = 2
29         StaticObjVer uint8 = 0
30         NameIdMapVer uint8 = 0
31 )
32
33 type StaticObj struct {
34         Type uint8
35         Pos  [3]float32
36         Data string
37 }
38
39 type ErrInvalidNodeName struct {
40         Name string
41 }
42
43 func (e ErrInvalidNodeName) Error() string {
44         return fmt.Sprintf("invalid node \"%v\"", e.Name)
45 }
46
47 type ErrInvalidNodeId struct {
48         Id mt.Content
49 }
50
51 func (e ErrInvalidNodeId) Error() string {
52         return fmt.Sprintf("invalid node %v", e.Id)
53 }