add colored travelnets to mapobjectdb

This commit is contained in:
BuckarooBanzay 2021-09-01 20:01:11 +02:00
parent 6e53fad9f3
commit 35860af706
2 changed files with 16 additions and 1 deletions

View File

@ -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

View File

@ -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
}