xp protector obj
This commit is contained in:
parent
8b27a7e61f
commit
3ace0707f0
@ -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{})
|
||||
|
18
server/mapobject/xpprotector.go
Normal file
18
server/mapobject/xpprotector.go
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user