1
0
forked from MTSR/mapserver

more mapobject flags

This commit is contained in:
NatureFreshMilk 2019-02-14 14:21:47 +01:00
parent e197012c7e
commit efbfddcd56
3 changed files with 33 additions and 10 deletions

View File

@ -31,6 +31,11 @@ type MapObjectConfig struct {
Digilines bool `json:"digilines"` Digilines bool `json:"digilines"`
Travelnet bool `json:"travelnet"` Travelnet bool `json:"travelnet"`
Mapserver bool `json:"mapserver"` Mapserver bool `json:"mapserver"`
Mission bool `json:"mission"`
Jumpdrive bool `json:"jumpdrive"`
Smartshop bool `json:"smartshop"`
Fancyvend bool `json:"fancyvend"`
ATM bool `json:"atm"`
} }
type WebApiConfig struct { type WebApiConfig struct {
@ -94,6 +99,11 @@ func ParseConfig(filename string) (*Config, error) {
Digilines: true, Digilines: true,
Travelnet: true, Travelnet: true,
Mapserver: true, Mapserver: true,
Mission: true,
Jumpdrive: true,
Smartshop: true,
Fancyvend: true,
ATM: true,
} }
cfg := Config{ cfg := Config{

View File

@ -188,15 +188,27 @@ func Setup(ctx *app.App) {
} }
//missions //missions
l.AddMapObject("missions:mission", &MissionBlock{}) if ctx.Config.MapObjects.Mission {
l.AddMapObject("missions:mission", &MissionBlock{})
}
//jumpdrive, TODO: fleet controller //jumpdrive, TODO: fleet controller
l.AddMapObject("jumpdrive:engine", &JumpdriveBlock{}) if ctx.Config.MapObjects.Jumpdrive {
l.AddMapObject("jumpdrive:engine", &JumpdriveBlock{})
}
//smartshop //smartshop
l.AddMapMultiObject("smartshop:shop", &SmartShopBlock{}) if ctx.Config.MapObjects.Smartshop {
l.AddMapMultiObject("smartshop:shop", &SmartShopBlock{})
}
//TODO: atm, shops (smart, fancy) if ctx.Config.MapObjects.Fancyvend {
//TODO
}
if ctx.Config.MapObjects.ATM {
//TODO
}
ctx.BlockAccessor.Eventbus.AddListener(&l) ctx.BlockAccessor.Eventbus.AddListener(&l)
} }

View File

@ -33,6 +33,10 @@ api.getConfig().then(function(cfg){
overlays["Player"] = new PlayerOverlay(wsChannel, layerMgr); overlays["Player"] = new PlayerOverlay(wsChannel, layerMgr);
overlays["POI"] = new PoiOverlay(wsChannel, layerMgr); overlays["POI"] = new PoiOverlay(wsChannel, layerMgr);
overlays["Labels"] = new LabelOverlay(wsChannel, layerMgr); overlays["Labels"] = new LabelOverlay(wsChannel, layerMgr);
map.addLayer(overlays["Player"]);
map.addLayer(overlays["POI"]);
map.addLayer(overlays["Labels"]);
} }
if (cfg.mapobjects.travelnet) { if (cfg.mapobjects.travelnet) {
@ -65,12 +69,9 @@ api.getConfig().then(function(cfg){
overlays["Protector"] = new ProtectorOverlay(wsChannel, layerMgr); overlays["Protector"] = new ProtectorOverlay(wsChannel, layerMgr);
} }
overlays["Missions"] = new MissionOverlay(wsChannel, layerMgr); if (cfg.mapobjects.mission) {
overlays["Missions"] = new MissionOverlay(wsChannel, layerMgr);
//Default enabled overlays }
map.addLayer(overlays["Player"]);
map.addLayer(overlays["POI"]);
map.addLayer(overlays["Labels"]);
L.control.layers(layers, overlays).addTo(map); L.control.layers(layers, overlays).addTo(map);