Show link range details for partially deployed portals.
Calculates the link range for portals with <8 resonators as well, but uses a dashed circle and a striked-through range value for those. The tooltip over the range value in the details pane shows base range, link amp boost and total range. The range for portals with missing resonators can be important because links with shorter lengths might originate here. Those will collapse when the total link range drops below their length, but not as soon as a resonator is destroyed.
This commit is contained in:
parent
767275fdf5
commit
a33bdcbf38
@ -145,8 +145,13 @@ window.setPortalIndicators = function(d) {
|
|||||||
|
|
||||||
var range = getPortalRange(d);
|
var range = getPortalRange(d);
|
||||||
var coord = [d.locationE6.latE6/1E6, d.locationE6.lngE6/1E6];
|
var coord = [d.locationE6.latE6/1E6, d.locationE6.lngE6/1E6];
|
||||||
portalRangeIndicator = (range > 0
|
portalRangeIndicator = (range.range > 0
|
||||||
? L.geodesicCircle(coord, range, { fill: false, color: RANGE_INDICATOR_COLOR, weight: 3, clickable: false })
|
? L.geodesicCircle(coord, range.range, {
|
||||||
|
fill: false,
|
||||||
|
color: RANGE_INDICATOR_COLOR,
|
||||||
|
weight: 3,
|
||||||
|
dashArray: range.isLinkable ? undefined : "10,10",
|
||||||
|
clickable: false })
|
||||||
: L.circle(coord, range, { fill: false, stroke: false, clickable: false })
|
: L.circle(coord, range, { fill: false, stroke: false, clickable: false })
|
||||||
).addTo(map);
|
).addTo(map);
|
||||||
|
|
||||||
|
@ -5,11 +5,20 @@
|
|||||||
// returns displayable text+link about portal range
|
// returns displayable text+link about portal range
|
||||||
window.getRangeText = function(d) {
|
window.getRangeText = function(d) {
|
||||||
var range = getPortalRange(d);
|
var range = getPortalRange(d);
|
||||||
|
|
||||||
|
var title = 'Base range:\t' + digits(Math.floor(range.base))+'m'
|
||||||
|
+ '\nLink amp boost:\t×'+range.boost
|
||||||
|
+ '\nRange:\t'+digits(Math.floor(range.range))+'m';
|
||||||
|
|
||||||
|
if(!range.isLinkable) title += '\nPortal is missing resonators,\nno new links can be made';
|
||||||
|
|
||||||
return ['range',
|
return ['range',
|
||||||
'<a onclick="window.rangeLinkClick()">'
|
'<a onclick="window.rangeLinkClick()"'
|
||||||
+ (range > 1000
|
+ (range.isLinkable ? '' : ' style="text-decoration:line-through;"')
|
||||||
? Math.floor(range/1000) + ' km'
|
+ ' title="'+title+'">'
|
||||||
: Math.floor(range) + ' m')
|
+ (range.range > 1000
|
||||||
|
? Math.floor(range.range/1000) + ' km'
|
||||||
|
: Math.floor(range.range) + ' m')
|
||||||
+ '</a>'];
|
+ '</a>'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,18 +47,20 @@ window.getPortalRange = function(d) {
|
|||||||
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||||
if(!reso) {
|
if(!reso) {
|
||||||
resoMissing = true;
|
resoMissing = true;
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
lvl += parseInt(reso.level);
|
lvl += parseInt(reso.level);
|
||||||
});
|
});
|
||||||
if(resoMissing) return 0;
|
|
||||||
|
|
||||||
var range = 160*Math.pow(getPortalLevel(d), 4);
|
var range = {
|
||||||
|
base: 160*Math.pow(getPortalLevel(d), 4),
|
||||||
|
boost: getLinkAmpRangeBoost(d)
|
||||||
|
};
|
||||||
|
|
||||||
var boost = getLinkAmpRangeBoost(d);
|
range.range = range.boost * range.base;
|
||||||
|
range.isLinkable = !resoMissing;
|
||||||
return range*boost;
|
|
||||||
|
|
||||||
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.getLinkAmpRangeBoost = function(d) {
|
window.getLinkAmpRangeBoost = function(d) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user