mission block

This commit is contained in:
NatureFreshMilk 2019-01-29 08:21:48 +01:00
parent 3ace0707f0
commit 12521b7e47
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package mapobject
import (
"mapserver/mapblockparser"
"mapserver/mapobjectdb"
)
type MissionBlock struct{}
func (this *MissionBlock) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *mapobjectdb.MapObject {
md := block.Metadata.GetMetadata(x, y, z)
o := mapobjectdb.NewMapObject(&block.Pos, 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
}

View File

@ -87,5 +87,8 @@ func Setup(ctx *app.App) {
//digilines
l.AddMapObject("digilines:lcd", &DigilineLcdBlock{})
//missions
l.AddMapObject("missions:mission", &MissionBlock{})
ctx.BlockAccessor.Eventbus.AddListener(&l)
}