forked from MTSR/mapserver
jumpdrive object
This commit is contained in:
parent
12521b7e47
commit
aee3bf3742
18
server/mapobject/jumpdrive.go
Normal file
18
server/mapobject/jumpdrive.go
Normal 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
|
||||
}
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user