Change guid format of resonator
Change: Guid format of resonator change to following, [portal guid]-resonator-[slot] Some code cleanup
This commit is contained in:
@ -97,7 +97,7 @@ window.setupMap = function() {
|
||||
window.storeMapPosition;
|
||||
|
||||
// remove all resonators if zoom out to < RESONATOR_DISPLAY_ZOOM_LEVEL
|
||||
if (isResonatorsShow()) return;
|
||||
if(isResonatorsShow()) return;
|
||||
for(var i = 1; i < portalsLayers.length; i++) {
|
||||
portalsLayers[i].eachLayer(function(item) {
|
||||
var itemGuid = item.options.guid;
|
||||
|
@ -245,7 +245,7 @@ window.renderPortal = function(ent) {
|
||||
|
||||
// remove attached resonators, skip if
|
||||
// all resonators have already removed by zooming
|
||||
if (isResonatorsShow()) {
|
||||
if(isResonatorsShow()) {
|
||||
for(var i = 0; i <= 7; i++)
|
||||
removeByGuid(portalResonatorGuid(portalGuid,i));
|
||||
}
|
||||
@ -280,9 +280,9 @@ window.renderResonators = function(ent) {
|
||||
for(var i=0; i < ent[2].resonatorArray.resonators.length; i++) {
|
||||
var rdata = ent[2].resonatorArray.resonators[i];
|
||||
|
||||
if (rdata == null) continue;
|
||||
if(rdata == null) continue;
|
||||
|
||||
if (window.resonators[portalResonatorGuid(ent[0],i)]) continue;
|
||||
if(window.resonators[portalResonatorGuid(ent[0],i)]) continue;
|
||||
|
||||
// offset in meters
|
||||
var dn = rdata.distanceToPortal*SLOT_TO_LAT[rdata.slot];
|
||||
@ -320,7 +320,7 @@ window.renderResonators = function(ent) {
|
||||
// replace .11 or .12 in portal guid with .r[slot] to
|
||||
// get guid for resonators
|
||||
window.portalResonatorGuid = function(portalGuid, slot){
|
||||
return portalGuid.slice(0,32) + '.r' + slot;
|
||||
return portalGuid + '-resonator-' + slot;
|
||||
}
|
||||
|
||||
window.isResonatorsShow = function(){
|
||||
|
@ -148,7 +148,7 @@ window.getTypeByGuid = function(guid) {
|
||||
// .c == player/creator
|
||||
// .d == chat messages
|
||||
//
|
||||
// .r0~.r7 == resonators
|
||||
// resonator guid is [portal guid]-resonator-[slot]
|
||||
switch(guid.slice(33)) {
|
||||
case '11':
|
||||
case '12':
|
||||
@ -166,17 +166,8 @@ window.getTypeByGuid = function(guid) {
|
||||
case 'd':
|
||||
return TYPE_CHAT;
|
||||
|
||||
case 'r0':
|
||||
case 'r1':
|
||||
case 'r2':
|
||||
case 'r3':
|
||||
case 'r4':
|
||||
case 'r5':
|
||||
case 'r6':
|
||||
case 'r7':
|
||||
return TYPE_RESONATOR;
|
||||
|
||||
default:
|
||||
if(guid.slice(-11,-2) == 'resonator') return TYPE_RESONATOR;
|
||||
return TYPE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user