forked from MTSR/mapserver
optional mapobjects
This commit is contained in:
parent
017cf3abc8
commit
e197012c7e
@ -23,7 +23,14 @@ type Config struct {
|
||||
}
|
||||
|
||||
type MapObjectConfig struct {
|
||||
Bones bool `json:"bones"`
|
||||
Bones bool `json:"bones"`
|
||||
Protector bool `json:"protector"`
|
||||
Technic bool `json:"technic"`
|
||||
LuaController bool `json:"luacontroller"`
|
||||
Digiterms bool `json:"digiterms"`
|
||||
Digilines bool `json:"digilines"`
|
||||
Travelnet bool `json:"travelnet"`
|
||||
Mapserver bool `json:"mapserver"`
|
||||
}
|
||||
|
||||
type WebApiConfig struct {
|
||||
@ -79,7 +86,14 @@ func ParseConfig(filename string) (*Config, error) {
|
||||
}
|
||||
|
||||
mapobjs := MapObjectConfig{
|
||||
Bones: true,
|
||||
Bones: true,
|
||||
Protector: true,
|
||||
Technic: true,
|
||||
LuaController: true,
|
||||
Digiterms: true,
|
||||
Digilines: true,
|
||||
Travelnet: true,
|
||||
Mapserver: true,
|
||||
}
|
||||
|
||||
cfg := Config{
|
||||
|
@ -1,20 +1,19 @@
|
||||
package postgres
|
||||
|
||||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
"mapserver/coords"
|
||||
"mapserver/db"
|
||||
"mapserver/layer"
|
||||
"mapserver/coords"
|
||||
"mapserver/settings"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
SETTING_LAST_LAYER = "last_layer"
|
||||
SETTING_LAST_LAYER = "last_layer"
|
||||
SETTING_LAST_X_BLOCK = "last_x_block"
|
||||
SETTING_LAST_Y_BLOCK = "last_y_block"
|
||||
)
|
||||
|
||||
|
||||
// x -> 0 ... 256
|
||||
|
||||
//zoom/mapblock-width
|
||||
@ -27,7 +26,6 @@ const (
|
||||
//Zoom 9:
|
||||
//10 mapblocks height * 16 * 16 == 2560
|
||||
|
||||
|
||||
func (this *PostgresAccessor) FindNextInitialBlocks(s settings.Settings, layers []*layer.Layer, limit int) (*db.InitialBlocksResult, error) {
|
||||
|
||||
lastlayer := s.GetInt(SETTING_LAST_LAYER, 0)
|
||||
@ -59,8 +57,8 @@ func (this *PostgresAccessor) FindNextInitialBlocks(s settings.Settings, layers
|
||||
|
||||
fields := logrus.Fields{
|
||||
"layerId": lastlayer,
|
||||
"pos1": tcr.Pos1,
|
||||
"pos2": tcr.Pos2,
|
||||
"pos1": tcr.Pos1,
|
||||
"pos2": tcr.Pos2,
|
||||
}
|
||||
log.WithFields(fields).Info("Initial-Query")
|
||||
|
||||
|
@ -114,62 +114,78 @@ func Setup(ctx *app.App) {
|
||||
}
|
||||
|
||||
//mapserver stuff
|
||||
l.AddMapObject("mapserver:poi", &PoiBlock{})
|
||||
l.AddMapObject("mapserver:train", &TrainBlock{})
|
||||
l.AddMapObject("mapserver:border", &BorderBlock{})
|
||||
l.AddMapObject("mapserver:label", &LabelBlock{})
|
||||
if ctx.Config.MapObjects.Mapserver {
|
||||
l.AddMapObject("mapserver:poi", &PoiBlock{})
|
||||
l.AddMapObject("mapserver:train", &TrainBlock{})
|
||||
l.AddMapObject("mapserver:border", &BorderBlock{})
|
||||
l.AddMapObject("mapserver:label", &LabelBlock{})
|
||||
}
|
||||
|
||||
//travelnet
|
||||
l.AddMapObject("travelnet:travelnet", &TravelnetBlock{})
|
||||
if ctx.Config.MapObjects.Travelnet {
|
||||
l.AddMapObject("travelnet:travelnet", &TravelnetBlock{})
|
||||
}
|
||||
|
||||
//protections
|
||||
l.AddMapObject("protector:protect", &ProtectorBlock{})
|
||||
l.AddMapObject("protector:protect2", &ProtectorBlock{})
|
||||
l.AddMapObject("xp_redo:protector", &XPProtectorBlock{})
|
||||
if ctx.Config.MapObjects.Protector {
|
||||
l.AddMapObject("protector:protect", &ProtectorBlock{})
|
||||
l.AddMapObject("protector:protect2", &ProtectorBlock{})
|
||||
l.AddMapObject("xp_redo:protector", &XPProtectorBlock{})
|
||||
}
|
||||
|
||||
//builtin
|
||||
l.AddMapObject("bones:bones", &BonesBlock{})
|
||||
if ctx.Config.MapObjects.Bones {
|
||||
l.AddMapObject("bones:bones", &BonesBlock{})
|
||||
}
|
||||
|
||||
//technic
|
||||
l.AddMapObject("technic:quarry", &QuarryBlock{})
|
||||
l.AddMapObject("technic:hv_nuclear_reactor_core_active", &NuclearReactorBlock{})
|
||||
l.AddMapObject("technic:admin_anchor", &TechnicAnchorBlock{})
|
||||
l.AddMapObject("technic:switching_station", &TechnicSwitchBlock{})
|
||||
if ctx.Config.MapObjects.Technic {
|
||||
l.AddMapObject("technic:quarry", &QuarryBlock{})
|
||||
l.AddMapObject("technic:hv_nuclear_reactor_core_active", &NuclearReactorBlock{})
|
||||
l.AddMapObject("technic:admin_anchor", &TechnicAnchorBlock{})
|
||||
l.AddMapObject("technic:switching_station", &TechnicSwitchBlock{})
|
||||
}
|
||||
|
||||
//digilines
|
||||
l.AddMapObject("digilines:lcd", &DigilineLcdBlock{})
|
||||
if ctx.Config.MapObjects.Digilines {
|
||||
l.AddMapObject("digilines:lcd", &DigilineLcdBlock{})
|
||||
}
|
||||
|
||||
//mesecons
|
||||
luac := &LuaControllerBlock{}
|
||||
// mesecons_luacontroller:luacontroller0000 2^4=16
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1111", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1110", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1100", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1010", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1000", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1101", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1001", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1011", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0111", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0110", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0100", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0010", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0000", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0101", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0001", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0011", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller_burnt", luac)
|
||||
if ctx.Config.MapObjects.LuaController {
|
||||
luac := &LuaControllerBlock{}
|
||||
// mesecons_luacontroller:luacontroller0000 2^4=16
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1111", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1110", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1100", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1010", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1000", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1101", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1001", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller1011", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0111", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0110", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0100", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0010", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0000", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0101", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0001", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller0011", luac)
|
||||
l.AddMapObject("mesecons_luacontroller:luacontroller_burnt", luac)
|
||||
}
|
||||
|
||||
//digiterms
|
||||
digiterms := &DigitermsBlock{}
|
||||
l.AddMapObject("digiterms:lcd_monitor", digiterms)
|
||||
l.AddMapObject("digiterms:cathodic_beige_monitor", digiterms)
|
||||
l.AddMapObject("digiterms:cathodic_white_monitor", digiterms)
|
||||
l.AddMapObject("digiterms:cathodic_black_monitor", digiterms)
|
||||
l.AddMapObject("digiterms:scifi_glassscreen", digiterms)
|
||||
l.AddMapObject("digiterms:scifi_widescreen", digiterms)
|
||||
l.AddMapObject("digiterms:scifi_tallscreen", digiterms)
|
||||
l.AddMapObject("digiterms:scifi_keysmonitor", digiterms)
|
||||
if ctx.Config.MapObjects.Digiterms {
|
||||
digiterms := &DigitermsBlock{}
|
||||
l.AddMapObject("digiterms:lcd_monitor", digiterms)
|
||||
l.AddMapObject("digiterms:cathodic_beige_monitor", digiterms)
|
||||
l.AddMapObject("digiterms:cathodic_white_monitor", digiterms)
|
||||
l.AddMapObject("digiterms:cathodic_black_monitor", digiterms)
|
||||
l.AddMapObject("digiterms:scifi_glassscreen", digiterms)
|
||||
l.AddMapObject("digiterms:scifi_widescreen", digiterms)
|
||||
l.AddMapObject("digiterms:scifi_tallscreen", digiterms)
|
||||
l.AddMapObject("digiterms:scifi_keysmonitor", digiterms)
|
||||
}
|
||||
|
||||
//missions
|
||||
l.AddMapObject("missions:mission", &MissionBlock{})
|
||||
|
@ -29,22 +29,42 @@ api.getConfig().then(function(cfg){
|
||||
//TODO: all layers
|
||||
layers["Base"] = tileLayer;
|
||||
|
||||
overlays["Player"] = new PlayerOverlay(wsChannel, layerMgr);
|
||||
overlays["POI"] = new PoiOverlay(wsChannel, layerMgr);
|
||||
overlays["Labels"] = new LabelOverlay(wsChannel, layerMgr);
|
||||
overlays["Travelnet"] = new TravelnetOverlay(wsChannel, layerMgr);
|
||||
if (cfg.mapobjects.mapserver) {
|
||||
overlays["Player"] = new PlayerOverlay(wsChannel, layerMgr);
|
||||
overlays["POI"] = new PoiOverlay(wsChannel, layerMgr);
|
||||
overlays["Labels"] = new LabelOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.travelnet) {
|
||||
overlays["Travelnet"] = new TravelnetOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.bones) {
|
||||
overlays["Bones"] = new BonesOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
overlays["Digilines LCD"] = new LcdOverlay(wsChannel, layerMgr);
|
||||
overlays["Digiterms"] = new DigitermOverlay(wsChannel, layerMgr);
|
||||
overlays["Lua Controller"] = new LuacontrollerOverlay(wsChannel, layerMgr);
|
||||
overlays["Technic Anchor"] = new TechnicAnchorOverlay(wsChannel, layerMgr);
|
||||
overlays["Technic Quarry"] = new TechnicQuarryOverlay(wsChannel, layerMgr);
|
||||
overlays["Technic Switching station"] = new TechnicSwitchOverlay(wsChannel, layerMgr);
|
||||
overlays["Protector"] = new ProtectorOverlay(wsChannel, layerMgr);
|
||||
if (cfg.mapobjects.digilines) {
|
||||
overlays["Digilines LCD"] = new LcdOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.digiterms) {
|
||||
overlays["Digiterms"] = new DigitermOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.luacontroller) {
|
||||
overlays["Lua Controller"] = new LuacontrollerOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.technic) {
|
||||
overlays["Technic Anchor"] = new TechnicAnchorOverlay(wsChannel, layerMgr);
|
||||
overlays["Technic Quarry"] = new TechnicQuarryOverlay(wsChannel, layerMgr);
|
||||
overlays["Technic Switching station"] = new TechnicSwitchOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.protector) {
|
||||
overlays["Protector"] = new ProtectorOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
overlays["Missions"] = new MissionOverlay(wsChannel, layerMgr);
|
||||
|
||||
//Default enabled overlays
|
||||
|
Loading…
Reference in New Issue
Block a user