1
0
forked from MTSR/mapserver
mapserver/mapobject/mission.go
2021-10-12 07:44:07 +02:00

29 lines
684 B
Go

package mapobject
import (
"mapserver/coords"
"mapserver/mapobjectdb"
"github.com/minetest-go/mapparser"
)
type MissionBlock struct{}
func (this *MissionBlock) onMapObject(mbpos *coords.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
md := block.Metadata.GetMetadata(x, y, z)
if md["hidden"] == "1" {
return nil
}
o := mapobjectdb.NewMapObject(mbpos, x, y, z, "mission")
o.Attributes["name"] = md["name"]
o.Attributes["time"] = md["time"]
o.Attributes["owner"] = md["owner"]
o.Attributes["description"] = md["description"]
o.Attributes["successcount"] = md["successcount"]
o.Attributes["failcount"] = md["failcount"]
return o
}