priv protector block

This commit is contained in:
NatureFreshMilk 2019-02-22 12:50:39 +01:00
parent f4b3eaaa9d
commit b4425fe008
4 changed files with 22 additions and 0 deletions

View File

@ -5,6 +5,7 @@ require (
github.com/gorilla/websocket v1.4.0
github.com/lib/pq v1.0.0
github.com/mattn/go-sqlite3 v1.10.0
github.com/mjibson/esc v0.1.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/prometheus/client_golang v0.9.2
github.com/sirupsen/logrus v1.3.0

View File

@ -19,6 +19,8 @@ github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK86
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mjibson/esc v0.1.0 h1:5ch+murgrcwDFLOE2hwj0f7kE4xJfJhkSCAjSLY182o=
github.com/mjibson/esc v0.1.0/go.mod h1:9Hw9gxxfHulMF5OJKCyhYD7PzlSdhzXyaGEBRPH1OPs=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

View File

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

View File

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