Przeglądaj źródła

Merge branch '$126-shift-tab-select-enemy' into 'staging'

#126 [shift] + [tab] should select previous enemy

See merge request !77
tags/v0.1.3^2
Big Bad Waffle 7 lat temu
rodzic
commit
fed983ed3f
2 zmienionych plików z 13 dodań i 7 usunięć
  1. +4
    -4
      src/client/js/components/spellbook.js
  2. +9
    -3
      src/client/js/objects/objects.js

+ 4
- 4
src/client/js/components/spellbook.js Wyświetl plik

@@ -80,7 +80,7 @@ define([
this.spells.splice(existIndex, 1, s);
return;
}
if (this.spells.length - 1 >= s.id)
this.spells.splice(s.id, 0, s);
else
@@ -141,7 +141,7 @@ define([
},

tabTarget: function() {
this.onMouseDown(null, objects.getClosest(window.player.x, window.player.y, 10, this.target));
this.onMouseDown(null, objects.getClosest(window.player.x, window.player.y, 10, this.shiftDown, this.target));
},

build: function(destroy) {
@@ -151,7 +151,7 @@ define([
data: {
instanceModule: 'customMap',
method: 'customize',
data: {
data: {
tile: 189,
direction: this.obj.keyboardMover.direction,
destroy: destroy
@@ -288,4 +288,4 @@ define([
this.targetSprite.y = this.target.y * scale;
}
};
});
});

+ 9
- 3
src/client/js/objects/objects.js Wyświetl plik

@@ -46,7 +46,7 @@ define([
events.emit('onMobHover', mob);
},

getClosest: function(x, y, maxDistance, fromMob, callback) {
getClosest: function(x, y, maxDistance, reverse, fromMob, callback) {
var objects = this.objects;
var oLen = objects.length;

@@ -79,7 +79,13 @@ define([
return (l.id == fromMob.id);
});

return list[(fromIndex + 1) % list.length];
if (reverse) {
fromIndex = (fromIndex === 0 ? list.length : fromIndex) - 1;
} else {
fromIndex = (fromIndex + 1) % list.length;
}
return list[fromIndex];
},

onRezone: function(oldZone) {
@@ -341,4 +347,4 @@ define([
}
}
};
});
});

Ładowanie…
Anuluj
Zapisz