add more map objects
This commit is contained in:
parent
1948d87a9b
commit
b42648f36e
22
server/mapobject/bones.go
Normal file
22
server/mapobject/bones.go
Normal file
@ -0,0 +1,22 @@
|
||||
package mapobject
|
||||
|
||||
import (
|
||||
"mapserver/mapblockparser"
|
||||
"mapserver/mapobjectdb"
|
||||
)
|
||||
|
||||
type BonesBlock struct{}
|
||||
|
||||
func (this *BonesBlock) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *mapobjectdb.MapObject {
|
||||
md := block.Metadata.GetMetadata(x, y, z)
|
||||
|
||||
if md["owner"] == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
o := mapobjectdb.NewMapObject(&block.Pos, x, y, z, "bones")
|
||||
o.Attributes["time"] = md["time"]
|
||||
o.Attributes["owner"] = md["owner"]
|
||||
|
||||
return o
|
||||
}
|
18
server/mapobject/nuclearreactor.go
Normal file
18
server/mapobject/nuclearreactor.go
Normal file
@ -0,0 +1,18 @@
|
||||
package mapobject
|
||||
|
||||
import (
|
||||
"mapserver/mapblockparser"
|
||||
"mapserver/mapobjectdb"
|
||||
)
|
||||
|
||||
type NuclearReactorBlock struct{}
|
||||
|
||||
func (this *NuclearReactorBlock) 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, "nuclearreactor")
|
||||
o.Attributes["burn_time"] = md["burn_time"]
|
||||
o.Attributes["structure_accumulated_badness"] = md["structure_accumulated_badness"]
|
||||
|
||||
return o
|
||||
}
|
23
server/mapobject/quarry.go
Normal file
23
server/mapobject/quarry.go
Normal file
@ -0,0 +1,23 @@
|
||||
package mapobject
|
||||
|
||||
import (
|
||||
"mapserver/mapblockparser"
|
||||
"mapserver/mapobjectdb"
|
||||
)
|
||||
|
||||
type QuarryBlock struct{}
|
||||
|
||||
func (this *QuarryBlock) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *mapobjectdb.MapObject {
|
||||
md := block.Metadata.GetMetadata(x, y, z)
|
||||
|
||||
if md["owner"] == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
o := mapobjectdb.NewMapObject(&block.Pos, x, y, z, "technicquarry")
|
||||
o.Attributes["owner"] = md["owner"]
|
||||
o.Attributes["dug"] = md["dug"]
|
||||
o.Attributes["enabled"] = md["enabled"]
|
||||
|
||||
return o
|
||||
}
|
@ -69,6 +69,10 @@ func Setup(ctx *app.App) {
|
||||
l.AddMapObject("travelnet:travelnet", &TravelnetBlock{})
|
||||
l.AddMapObject("protector:protect", &ProtectorBlock{})
|
||||
l.AddMapObject("protector:protect2", &ProtectorBlock{})
|
||||
l.AddMapObject("bones:bones", &BonesBlock{})
|
||||
l.AddMapObject("technic:quarry", &QuarryBlock{})
|
||||
l.AddMapObject("technic:hv_nuclear_reactor_core_active", &NuclearReactorBlock{})
|
||||
l.AddMapObject("technic:admin_anchor", &TechnicAnchorBlock{})
|
||||
|
||||
ctx.BlockAccessor.Eventbus.AddListener(&l)
|
||||
}
|
||||
|
20
server/mapobject/technicanchor.go
Normal file
20
server/mapobject/technicanchor.go
Normal file
@ -0,0 +1,20 @@
|
||||
package mapobject
|
||||
|
||||
import (
|
||||
"mapserver/mapblockparser"
|
||||
"mapserver/mapobjectdb"
|
||||
)
|
||||
|
||||
type TechnicAnchorBlock struct{}
|
||||
|
||||
func (this *TechnicAnchorBlock) 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, "technicanchor")
|
||||
o.Attributes["owner"] = md["owner"]
|
||||
o.Attributes["radius"] = md["radius"]
|
||||
o.Attributes["locked"] = md["locked"]
|
||||
o.Attributes["enabled"] = md["enabled"]
|
||||
|
||||
return o
|
||||
}
|
Loading…
Reference in New Issue
Block a user