mapserver/mapobject/setup.go

207 lines
6.6 KiB
Go
Raw Permalink Normal View History

2019-01-23 15:22:47 +03:00
package mapobject
import (
"mapserver/app"
)
func Setup(ctx *app.App) {
l := Listener{
2019-02-08 18:02:24 +03:00
ctx: ctx,
objectlisteners: make(map[string]MapObjectListener),
2019-02-08 13:45:56 +03:00
multiobjectlisteners: make(map[string]MapMultiObjectListener),
}
2019-01-29 10:03:49 +03:00
//mapserver stuff
2019-04-04 13:50:40 +03:00
if ctx.Config.MapObjects.MapserverPOI {
2019-05-02 12:09:29 +03:00
l.AddMapObject("mapserver:poi", &PoiBlock{Color: "blue"})
l.AddMapObject("mapserver:poi_blue", &PoiBlock{Color: "blue"})
l.AddMapObject("mapserver:poi_green", &PoiBlock{Color: "green"})
l.AddMapObject("mapserver:poi_orange", &PoiBlock{Color: "orange"})
l.AddMapObject("mapserver:poi_red", &PoiBlock{Color: "red"})
l.AddMapObject("mapserver:poi_purple", &PoiBlock{Color: "purple"})
2019-04-04 13:50:40 +03:00
}
if ctx.Config.MapObjects.MapserverTrainline {
2019-02-14 16:16:32 +03:00
l.AddMapObject("mapserver:train", &TrainBlock{})
2019-04-04 13:50:40 +03:00
}
if ctx.Config.MapObjects.MapserverBorder {
2019-02-14 16:16:32 +03:00
l.AddMapObject("mapserver:border", &BorderBlock{})
2019-04-04 13:50:40 +03:00
}
if ctx.Config.MapObjects.MapserverLabel {
2019-02-14 16:16:32 +03:00
l.AddMapObject("mapserver:label", &LabelBlock{})
}
2019-01-29 10:03:49 +03:00
2019-03-22 13:27:14 +03:00
//old tileserver stuff
if ctx.Config.MapObjects.TileServerLegacy {
l.AddMapObject("tileserver:poi", &PoiBlock{})
l.AddMapObject("tileserver:train", &TrainBlock{})
}
2019-01-29 10:03:49 +03:00
//travelnet
2019-02-14 16:16:32 +03:00
if ctx.Config.MapObjects.Travelnet {
tb := &TravelnetBlock{}
l.AddMapObject("travelnet:travelnet", tb)
l.AddMapObject("travelnet:travelnet_red", tb)
l.AddMapObject("travelnet:travelnet_orange", tb)
l.AddMapObject("travelnet:travelnet_blue", tb)
l.AddMapObject("travelnet:travelnet_cyan", tb)
l.AddMapObject("travelnet:travelnet_green", tb)
l.AddMapObject("travelnet:travelnet_dark_green", tb)
l.AddMapObject("travelnet:travelnet_violet", tb)
l.AddMapObject("travelnet:travelnet_pink", tb)
l.AddMapObject("travelnet:travelnet_magenta", tb)
l.AddMapObject("travelnet:travelnet_brown", tb)
l.AddMapObject("travelnet:travelnet_grey", tb)
l.AddMapObject("travelnet:travelnet_dark_grey", tb)
l.AddMapObject("travelnet:travelnet_black", tb)
l.AddMapObject("travelnet:travelnet_white", tb)
l.AddMapObject("fancy_travelnet:fancy_travelnet", tb)
2019-02-14 16:16:32 +03:00
}
2019-01-29 10:03:49 +03:00
//protector
2019-02-14 16:16:32 +03:00
if ctx.Config.MapObjects.Protector {
l.AddMapObject("protector:protect", &ProtectorBlock{})
l.AddMapObject("protector:protect2", &ProtectorBlock{})
}
//xp protector
if ctx.Config.MapObjects.XPProtector {
2019-02-14 16:16:32 +03:00
l.AddMapObject("xp_redo:protector", &XPProtectorBlock{})
}
//priv protector
if ctx.Config.MapObjects.PrivProtector {
2019-02-22 14:50:39 +03:00
l.AddMapObject("priv_protector:protector", &PrivProtectorBlock{})
2019-02-14 16:16:32 +03:00
}
2019-01-29 10:03:49 +03:00
//builtin
2019-02-14 16:16:32 +03:00
if ctx.Config.MapObjects.Bones {
l.AddMapObject("bones:bones", &BonesBlock{})
}
2019-01-29 10:03:49 +03:00
//technic
2019-04-04 13:50:40 +03:00
if ctx.Config.MapObjects.TechnicQuarry {
2019-02-14 16:16:32 +03:00
l.AddMapObject("technic:quarry", &QuarryBlock{})
2019-04-04 13:50:40 +03:00
}
if ctx.Config.MapObjects.TechnicReactor {
2019-02-14 16:16:32 +03:00
l.AddMapObject("technic:hv_nuclear_reactor_core_active", &NuclearReactorBlock{})
2019-04-04 13:50:40 +03:00
}
if ctx.Config.MapObjects.TechnicAnchor {
2019-02-14 16:16:32 +03:00
l.AddMapObject("technic:admin_anchor", &TechnicAnchorBlock{})
2019-04-04 13:50:40 +03:00
}
if ctx.Config.MapObjects.TechnicSwitch {
2019-02-14 16:16:32 +03:00
l.AddMapObject("technic:switching_station", &TechnicSwitchBlock{})
}
2019-01-29 10:03:49 +03:00
//digilines
2019-02-14 16:16:32 +03:00
if ctx.Config.MapObjects.Digilines {
l.AddMapObject("digilines:lcd", &DigilineLcdBlock{})
}
2019-01-29 10:03:49 +03:00
2019-02-08 11:11:25 +03:00
//mesecons
2019-02-14 16:16:32 +03:00
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)
}
2019-02-08 11:11:25 +03:00
2019-02-08 12:07:59 +03:00
//digiterms
2019-02-14 16:16:32 +03:00
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)
}
2019-02-08 12:07:59 +03:00
2019-01-29 10:21:48 +03:00
//missions
2019-02-14 16:21:47 +03:00
if ctx.Config.MapObjects.Mission {
l.AddMapObject("missions:mission", &MissionBlock{})
}
2019-01-29 10:21:48 +03:00
2019-01-29 10:26:23 +03:00
//jumpdrive, TODO: fleet controller
2019-02-14 16:21:47 +03:00
if ctx.Config.MapObjects.Jumpdrive {
l.AddMapObject("jumpdrive:engine", &JumpdriveBlock{})
}
2019-01-29 10:24:03 +03:00
2019-02-08 13:45:56 +03:00
//smartshop
2019-02-14 16:21:47 +03:00
if ctx.Config.MapObjects.Smartshop {
l.AddMapMultiObject("smartshop:shop", &SmartShopBlock{})
}
2019-02-08 13:45:56 +03:00
2019-02-14 16:21:47 +03:00
if ctx.Config.MapObjects.Fancyvend {
2019-02-15 13:25:49 +03:00
v := &FancyVend{}
l.AddMapObject("fancy_vend:admin_vendor", v)
l.AddMapObject("fancy_vend:admin_depo", v)
l.AddMapObject("fancy_vend:player_vendor", v)
l.AddMapObject("fancy_vend:player_depo", v)
2019-02-14 16:21:47 +03:00
}
if ctx.Config.MapObjects.ATM {
2019-05-14 10:01:52 +03:00
atm := &ATM{}
// ATMs and WTT of gpcf's mod
2019-05-14 10:01:52 +03:00
l.AddMapObject("atm:atm", atm)
l.AddMapObject("atm:atm2", atm)
l.AddMapObject("atm:atm3", atm)
l.AddMapObject("atm:wtt", atm)
// ATMs and WTT of Unified Money
l.AddMapObject("um_atm:atm_1", atm)
l.AddMapObject("um_atm:atm_2", atm)
l.AddMapObject("um_atm:atm_3", atm)
l.AddMapObject("um_wtt:wtt", atm)
2019-02-14 16:21:47 +03:00
}
2019-01-29 10:26:23 +03:00
2019-05-08 16:50:51 +03:00
//locator
if ctx.Config.MapObjects.Locator {
loc := &Locator{}
l.AddMapObject("locator:beacon_1", loc)
l.AddMapObject("locator:beacon_2", loc)
l.AddMapObject("locator:beacon_3", loc)
}
//signs
if ctx.Config.MapObjects.Signs {
l.AddMapObject("default:sign_wall_wood", &SignBlock{Material: "wood"})
l.AddMapObject("default:sign_wall_steel", &SignBlock{Material: "steel"})
}
//Phonograph
if ctx.Config.MapObjects.Phonograph {
l.AddMapObject("phonograph:phonograph", &Phonograph{})
}
//For Sale Sign for Unified Money
if ctx.Config.MapObjects.UnifiefMoneyAreaForSale {
l.AddMapObject("um_area_forsale:for_sale_sign", &UnifiefMoneyAreaForSale{})
}
2019-07-31 14:41:35 +03:00
ctx.MapBlockAccessor.Eventbus.AddListener(&l)
2019-01-23 15:22:47 +03:00
}