xp protector obj

This commit is contained in:
NatureFreshMilk 2019-01-29 08:14:17 +01:00
parent 8b27a7e61f
commit 3ace0707f0
2 changed files with 19 additions and 0 deletions

View File

@ -74,6 +74,7 @@ func Setup(ctx *app.App) {
//protections
l.AddMapObject("protector:protect", &ProtectorBlock{})
l.AddMapObject("protector:protect2", &ProtectorBlock{})
l.AddMapObject("xp_redo:protector", &XPProtectorBlock{})
//builtin
l.AddMapObject("bones:bones", &BonesBlock{})

View File

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