mirror of
https://github.com/overte-org/overte.git
synced 2025-06-19 01:01:10 +02:00
Fixes chess game (pieces were dieing as soon as you dropped them)
This commit is contained in:
parent
029af5354f
commit
c24c6ad39f
1 changed files with 4 additions and 4 deletions
|
@ -130,10 +130,10 @@
|
||||||
var others = Entities.findEntities(this.properties.position, this.properties.dimensions.y);
|
var others = Entities.findEntities(this.properties.position, this.properties.dimensions.y);
|
||||||
|
|
||||||
for (var i = 0; i < others.length; i++) {
|
for (var i = 0; i < others.length; i++) {
|
||||||
var piece = others[i];
|
var pieceID = others[i];
|
||||||
|
|
||||||
if (piece.id != this.entityID) {
|
if (pieceID != this.entityID) {
|
||||||
var properties = Entities.getEntityProperties(piece);
|
var properties = Entities.getEntityProperties(pieceID);
|
||||||
|
|
||||||
var isWhite = properties.modelURL.search("White") !== -1;
|
var isWhite = properties.modelURL.search("White") !== -1;
|
||||||
var type = (properties.modelURL.search("King") !== -1) ? 4 :
|
var type = (properties.modelURL.search("King") !== -1) ? 4 :
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
if (myPos.i === piecePos.i && myPos.j === piecePos.j && type !== -2) {
|
if (myPos.i === piecePos.i && myPos.j === piecePos.j && type !== -2) {
|
||||||
var position = this.getAbsolutePosition((isWhite) ? { i: type, j: -1 } : { i: 7 - type, j: 8 },
|
var position = this.getAbsolutePosition((isWhite) ? { i: type, j: -1 } : { i: 7 - type, j: 8 },
|
||||||
properties.dimensions.y / 2.0);
|
properties.dimensions.y / 2.0);
|
||||||
Entities.editEntity(piece, {
|
Entities.editEntity(pieceID, {
|
||||||
position: position
|
position: position
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue