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