default overlay setting
This commit is contained in:
parent
b4116e2220
commit
920d8519f7
@ -24,6 +24,7 @@ type Config struct {
|
||||
RenderingQueue int `json:"renderingqueue"`
|
||||
MapObjects *MapObjectConfig `json:"mapobjects"`
|
||||
MapBlockAccessorCfg *MapBlockAccessorConfig `json:"mapblockaccessor"`
|
||||
DefaultOverlays []string `json:"defaultoverlays"`
|
||||
}
|
||||
|
||||
type MapBlockAccessorConfig struct {
|
||||
@ -38,12 +39,19 @@ type MapObjectConfig struct {
|
||||
Protector bool `json:"protector"`
|
||||
XPProtector bool `json:"xpprotector"`
|
||||
PrivProtector bool `json:"privprotector"`
|
||||
Technic bool `json:"technic"`
|
||||
TechnicQuarry bool `json:"technic_quarry"`
|
||||
TechnicSwitch bool `json:"technic_switch"`
|
||||
TechnicAnchor bool `json:"technic_anchor"`
|
||||
TechnicReactor bool `json:"technic_reactor"`
|
||||
LuaController bool `json:"luacontroller"`
|
||||
Digiterms bool `json:"digiterms"`
|
||||
Digilines bool `json:"digilines"`
|
||||
Travelnet bool `json:"travelnet"`
|
||||
Mapserver bool `json:"mapserver"`
|
||||
MapserverPlayer bool `json:"mapserver_player"`
|
||||
MapserverPOI bool `json:"mapserver_poi"`
|
||||
MapserverLabel bool `json:"mapserver_label"`
|
||||
MapserverTrainline bool `json:"mapserver_trainline"`
|
||||
MapserverBorder bool `json:"mapserver_border"`
|
||||
TileServerLegacy bool `json:"tileserverlegacy"`
|
||||
Mission bool `json:"mission"`
|
||||
Jumpdrive bool `json:"jumpdrive"`
|
||||
@ -117,12 +125,19 @@ func ParseConfig(filename string) (*Config, error) {
|
||||
Protector: true,
|
||||
XPProtector: true,
|
||||
PrivProtector: true,
|
||||
Technic: true,
|
||||
TechnicQuarry: true,
|
||||
TechnicSwitch: true,
|
||||
TechnicAnchor: true,
|
||||
TechnicReactor: true,
|
||||
LuaController: true,
|
||||
Digiterms: true,
|
||||
Digilines: true,
|
||||
Travelnet: true,
|
||||
Mapserver: true,
|
||||
MapserverPlayer: true,
|
||||
MapserverPOI: true,
|
||||
MapserverLabel: true,
|
||||
MapserverTrainline: true,
|
||||
MapserverBorder: true,
|
||||
TileServerLegacy: true,
|
||||
Mission: true,
|
||||
Jumpdrive: true,
|
||||
@ -138,6 +153,12 @@ func ParseConfig(filename string) (*Config, error) {
|
||||
MaxItems: 5000,
|
||||
}
|
||||
|
||||
defaultoverlays := []string{
|
||||
"mapserver_poi",
|
||||
"mapserver_label",
|
||||
"mapserver_player",
|
||||
}
|
||||
|
||||
cfg := Config{
|
||||
ConfigVersion: 1,
|
||||
Port: 8080,
|
||||
@ -153,6 +174,7 @@ func ParseConfig(filename string) (*Config, error) {
|
||||
RenderingQueue: 100,
|
||||
MapObjects: &mapobjs,
|
||||
MapBlockAccessorCfg: &mapblockaccessor,
|
||||
DefaultOverlays: defaultoverlays,
|
||||
}
|
||||
|
||||
info, err := os.Stat(filename)
|
||||
|
@ -12,10 +12,19 @@ func Setup(ctx *app.App) {
|
||||
}
|
||||
|
||||
//mapserver stuff
|
||||
if ctx.Config.MapObjects.Mapserver {
|
||||
if ctx.Config.MapObjects.MapserverPOI {
|
||||
l.AddMapObject("mapserver:poi", &PoiBlock{})
|
||||
}
|
||||
|
||||
if ctx.Config.MapObjects.MapserverTrainline {
|
||||
l.AddMapObject("mapserver:train", &TrainBlock{})
|
||||
}
|
||||
|
||||
if ctx.Config.MapObjects.MapserverBorder {
|
||||
l.AddMapObject("mapserver:border", &BorderBlock{})
|
||||
}
|
||||
|
||||
if ctx.Config.MapObjects.MapserverLabel {
|
||||
l.AddMapObject("mapserver:label", &LabelBlock{})
|
||||
}
|
||||
|
||||
@ -52,10 +61,19 @@ func Setup(ctx *app.App) {
|
||||
}
|
||||
|
||||
//technic
|
||||
if ctx.Config.MapObjects.Technic {
|
||||
if ctx.Config.MapObjects.TechnicQuarry {
|
||||
l.AddMapObject("technic:quarry", &QuarryBlock{})
|
||||
}
|
||||
|
||||
if ctx.Config.MapObjects.TechnicReactor {
|
||||
l.AddMapObject("technic:hv_nuclear_reactor_core_active", &NuclearReactorBlock{})
|
||||
}
|
||||
|
||||
if ctx.Config.MapObjects.TechnicAnchor {
|
||||
l.AddMapObject("technic:admin_anchor", &TechnicAnchorBlock{})
|
||||
}
|
||||
|
||||
if ctx.Config.MapObjects.TechnicSwitch {
|
||||
l.AddMapObject("technic:switching_station", &TechnicSwitchBlock{})
|
||||
}
|
||||
|
||||
|
@ -3,61 +3,129 @@
|
||||
|
||||
function Overlaysetup(cfg, map, overlays, wsChannel, layerMgr){
|
||||
|
||||
if (cfg.mapobjects.mapserver) {
|
||||
if (cfg.mapobjects.mapserver_player) {
|
||||
overlays.Player = new PlayerOverlay(wsChannel, layerMgr);
|
||||
overlays.POI = new PoiOverlay(wsChannel, layerMgr);
|
||||
overlays.Label = new LabelOverlay(wsChannel, layerMgr);
|
||||
overlays.Border = new BorderOverlay(wsChannel, layerMgr);
|
||||
|
||||
if (cfg.defaultoverlays.contains("mapserver_player")) {
|
||||
map.addLayer(overlays.Player);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.mapserver_poi) {
|
||||
overlays.POI = new PoiOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("mapserver_poi")) {
|
||||
map.addLayer(overlays.POI);
|
||||
map.addLayer(overlays.Labels);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.mapserver_label) {
|
||||
overlays.Label = new LabelOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("mapserver_label")) {
|
||||
map.addLayer(overlays.Label);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.mapserver_trainline) {
|
||||
overlays.Trainlines = new TrainlineOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("mapserver_trainline")) {
|
||||
map.addLayer(overlays.Trainlines);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.mapserver_border) {
|
||||
overlays.Border = new BorderOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("mapserver_border")) {
|
||||
map.addLayer(overlays.Border);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.travelnet) {
|
||||
overlays.Travelnet = new TravelnetOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("travelnet")) {
|
||||
map.addLayer(overlays.Travelnet);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.bones) {
|
||||
overlays.Bones = new BonesOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("bones")) {
|
||||
map.addLayer(overlays.Bones);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.digilines) {
|
||||
overlays["Digilines LCD"] = new LcdOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("digilines")) {
|
||||
map.addLayer(overlays["Digilines LCD"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.digiterms) {
|
||||
overlays.Digiterms = new DigitermOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("digiterms")) {
|
||||
map.addLayer(overlays.Digiterms);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.luacontroller) {
|
||||
overlays["Lua Controller"] = new LuacontrollerOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("luacontroller")) {
|
||||
map.addLayer(overlays["Lua Controller"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.technic) {
|
||||
if (cfg.mapobjects.technic_anchor) {
|
||||
overlays["Technic Anchor"] = new TechnicAnchorOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("technic_anchor")) {
|
||||
map.addLayer(overlays["Technic Anchor"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.technic_quarry) {
|
||||
overlays["Technic Quarry"] = new TechnicQuarryOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("technic_quarry")) {
|
||||
map.addLayer(overlays["Technic Quarry"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.technic_switch) {
|
||||
overlays["Technic Switching station"] = new TechnicSwitchOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("technic_switch")) {
|
||||
map.addLayer(overlays["Technic Switching station"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.protector) {
|
||||
overlays.Protector = new ProtectorOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("protector")) {
|
||||
map.addLayer(overlays.Protector);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.xpprotector) {
|
||||
overlays["XP Protector"] = new XPProtectorOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("xpprotector")) {
|
||||
map.addLayer(overlays["XP Protector"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.privprotector) {
|
||||
overlays["Priv Protector"] = new PrivProtectorOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("privprotector")) {
|
||||
map.addLayer(overlays["Priv Protector"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.mission) {
|
||||
overlays.Missions = new MissionOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("mission")) {
|
||||
map.addLayer(overlays.Missions);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.train) {
|
||||
overlays.Trains = new TrainOverlay(wsChannel, layerMgr);
|
||||
overlays.Trainlines = new TrainlineOverlay(wsChannel, layerMgr);
|
||||
if (cfg.defaultoverlays.contains("train")) {
|
||||
map.addLayer(overlays.Trains);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ type PublicConfig struct {
|
||||
Version string `json:"version"`
|
||||
Layers []*layer.Layer `json:"layers"`
|
||||
MapObjects *app.MapObjectConfig `json:"mapobjects"`
|
||||
DefaultOverlays []string `json:"defaultoverlays"`
|
||||
}
|
||||
|
||||
type ConfigHandler struct {
|
||||
@ -25,6 +26,7 @@ func (h *ConfigHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
|
||||
webcfg.Layers = h.ctx.Config.Layers
|
||||
webcfg.MapObjects = h.ctx.Config.MapObjects
|
||||
webcfg.Version = app.Version
|
||||
webcfg.DefaultOverlays = h.ctx.Config.DefaultOverlays
|
||||
|
||||
json.NewEncoder(resp).Encode(webcfg)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user