1
0
forked from MTSR/mapserver

jumpdrive object

This commit is contained in:
NatureFreshMilk 2019-01-29 08:24:03 +01:00
parent 12521b7e47
commit aee3bf3742
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,18 @@
package mapobject
import (
"mapserver/mapblockparser"
"mapserver/mapobjectdb"
)
type JumpdriveBlock struct{}
func (this *JumpdriveBlock) 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, "jumpdrive")
o.Attributes["owner"] = md["owner"]
o.Attributes["radius"] = md["radius"]
return o
}

View File

@ -90,5 +90,8 @@ func Setup(ctx *app.App) {
//missions
l.AddMapObject("missions:mission", &MissionBlock{})
//jumpdrive
l.AddMapObject("jumpdrive:engine", &JumpdriveBlock{})
ctx.BlockAccessor.Eventbus.AddListener(&l)
}