diff --git a/server/mapobject/bones.go b/server/mapobject/bones.go new file mode 100644 index 0000000..ad87859 --- /dev/null +++ b/server/mapobject/bones.go @@ -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 +} diff --git a/server/mapobject/nuclearreactor.go b/server/mapobject/nuclearreactor.go new file mode 100644 index 0000000..67f190c --- /dev/null +++ b/server/mapobject/nuclearreactor.go @@ -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 +} diff --git a/server/mapobject/quarry.go b/server/mapobject/quarry.go new file mode 100644 index 0000000..313e852 --- /dev/null +++ b/server/mapobject/quarry.go @@ -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 +} diff --git a/server/mapobject/setup.go b/server/mapobject/setup.go index 17d6749..dc885d1 100644 --- a/server/mapobject/setup.go +++ b/server/mapobject/setup.go @@ -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) } diff --git a/server/mapobject/technicanchor.go b/server/mapobject/technicanchor.go new file mode 100644 index 0000000..77a1c38 --- /dev/null +++ b/server/mapobject/technicanchor.go @@ -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 +}