From 35860af706dfdbaabcae4b75f7eda34412cc83b2 Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Wed, 1 Sep 2021 20:01:11 +0200 Subject: [PATCH] add colored travelnets to mapobjectdb --- mapobject/setup.go | 14 ++++++++++++++ mapobject/travelnet.go | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mapobject/setup.go b/mapobject/setup.go index 416142c..90f3020 100644 --- a/mapobject/setup.go +++ b/mapobject/setup.go @@ -42,6 +42,20 @@ func Setup(ctx *app.App) { //travelnet if ctx.Config.MapObjects.Travelnet { l.AddMapObject("travelnet:travelnet", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_red", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_orange", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_blue", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_cyan", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_green", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_dark_green", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_violet", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_pink", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_magenta", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_brown", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_grey", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_dark_grey", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_black", &TravelnetBlock{}) + l.AddMapObject("travelnet:travelnet_white", &TravelnetBlock{}) } //protector diff --git a/mapobject/travelnet.go b/mapobject/travelnet.go index 21f8eb0..ea64174 100644 --- a/mapobject/travelnet.go +++ b/mapobject/travelnet.go @@ -8,7 +8,7 @@ import ( type TravelnetBlock struct{} -func (this *TravelnetBlock) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *mapobjectdb.MapObject { +func (tn *TravelnetBlock) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *mapobjectdb.MapObject { md := block.Metadata.GetMetadata(x, y, z) // ignore (P) prefixed stations @@ -21,6 +21,7 @@ func (this *TravelnetBlock) onMapObject(x, y, z int, block *mapblockparser.MapBl o.Attributes["owner"] = md["owner"] o.Attributes["station_name"] = md["station_name"] o.Attributes["station_network"] = md["station_network"] + o.Attributes["nodename"] = block.GetNodeName(x, y, z) return o }