mission block
This commit is contained in:
parent
3ace0707f0
commit
12521b7e47
22
server/mapobject/mission.go
Normal file
22
server/mapobject/mission.go
Normal 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
|
||||
}
|
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user