forked from MTSR/mapserver
fine grained protector selection (overlay and detection)
This commit is contained in:
parent
16c6f5f065
commit
8631d71429
@ -31,6 +31,8 @@ type MapBlockAccessorConfig struct {
|
||||
type MapObjectConfig struct {
|
||||
Bones bool `json:"bones"`
|
||||
Protector bool `json:"protector"`
|
||||
XPProtector bool `json:"xpprotector"`
|
||||
PrivProtector bool `json:"privprotector"`
|
||||
Technic bool `json:"technic"`
|
||||
LuaController bool `json:"luacontroller"`
|
||||
Digiterms bool `json:"digiterms"`
|
||||
@ -106,6 +108,8 @@ func ParseConfig(filename string) (*Config, error) {
|
||||
mapobjs := MapObjectConfig{
|
||||
Bones: true,
|
||||
Protector: true,
|
||||
XPProtector: true,
|
||||
PrivProtector: true,
|
||||
Technic: true,
|
||||
LuaController: true,
|
||||
Digiterms: true,
|
||||
|
@ -24,11 +24,19 @@ func Setup(ctx *app.App) {
|
||||
l.AddMapObject("travelnet:travelnet", &TravelnetBlock{})
|
||||
}
|
||||
|
||||
//protections
|
||||
//protector
|
||||
if ctx.Config.MapObjects.Protector {
|
||||
l.AddMapObject("protector:protect", &ProtectorBlock{})
|
||||
l.AddMapObject("protector:protect2", &ProtectorBlock{})
|
||||
}
|
||||
|
||||
//xp protector
|
||||
if ctx.Config.MapObjects.XPProtector {
|
||||
l.AddMapObject("xp_redo:protector", &XPProtectorBlock{})
|
||||
}
|
||||
|
||||
//priv protector
|
||||
if ctx.Config.MapObjects.PrivProtector {
|
||||
l.AddMapObject("priv_protector:protector", &PrivProtectorBlock{})
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,8 @@
|
||||
<script src="js/overlays/PlayerOverlay.js"></script>
|
||||
<script src="js/overlays/TrainOverlay.js"></script>
|
||||
<script src="js/overlays/ProtectorOverlay.js"></script>
|
||||
<script src="js/overlays/XPProtectorOverlay.js"></script>
|
||||
<script src="js/overlays/PrivProtectorOverlay.js"></script>
|
||||
<script src="js/overlays/BonesOverlay.js"></script>
|
||||
<script src="js/overlays/LcdOverlay.js"></script>
|
||||
<script src="js/overlays/DigitermOverlay.js"></script>
|
||||
|
@ -42,6 +42,14 @@ function Overlaysetup(cfg, map, overlays, wsChannel, layerMgr){
|
||||
overlays["Protector"] = new ProtectorOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.xpprotector) {
|
||||
overlays["XP Protector"] = new XPProtectorOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.privprotector) {
|
||||
overlays["Priv Protector"] = new PrivProtectorOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
||||
if (cfg.mapobjects.mission) {
|
||||
overlays["Missions"] = new MissionOverlay(wsChannel, layerMgr);
|
||||
}
|
||||
|
27
server/static/js/overlays/PrivProtectorOverlay.js
Normal file
27
server/static/js/overlays/PrivProtectorOverlay.js
Normal file
@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var PrivProtectorOverlay = AbstractGeoJsonOverlay.extend({
|
||||
initialize: function(wsChannel, layerMgr) {
|
||||
AbstractGeoJsonOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "privprotector");
|
||||
},
|
||||
|
||||
createFeature: function(protector){
|
||||
return {
|
||||
"type":"Feature",
|
||||
"geometry": {
|
||||
"type":"Polygon",
|
||||
"coordinates":[[
|
||||
[protector.x-5,protector.z-5],
|
||||
[protector.x-5,protector.z+6],
|
||||
[protector.x+6,protector.z+6],
|
||||
[protector.x+6,protector.z-5],
|
||||
[protector.x-5,protector.z-5]
|
||||
]]
|
||||
},
|
||||
"properties":{
|
||||
"name": protector.attributes.priv,
|
||||
"popupContent": protector.attributes.priv
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
27
server/static/js/overlays/XPProtectorOverlay.js
Normal file
27
server/static/js/overlays/XPProtectorOverlay.js
Normal file
@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var XPProtectorOverlay = AbstractGeoJsonOverlay.extend({
|
||||
initialize: function(wsChannel, layerMgr) {
|
||||
AbstractGeoJsonOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "xpprotector");
|
||||
},
|
||||
|
||||
createFeature: function(protector){
|
||||
return {
|
||||
"type":"Feature",
|
||||
"geometry": {
|
||||
"type":"Polygon",
|
||||
"coordinates":[[
|
||||
[protector.x-5,protector.z-5],
|
||||
[protector.x-5,protector.z+6],
|
||||
[protector.x+6,protector.z+6],
|
||||
[protector.x+6,protector.z-5],
|
||||
[protector.x-5,protector.z-5]
|
||||
]]
|
||||
},
|
||||
"properties":{
|
||||
"name": protector.attributes.xpthreshold,
|
||||
"popupContent": protector.attributes.xpthreshold
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user