修复setBlock的bug

This commit is contained in:
ckcz123 2020-05-30 19:25:52 +08:00
parent c4d11b1ee5
commit 0770aa3201

View File

@ -1618,16 +1618,6 @@ maps.prototype.setBlock = function (number, x, y, floorId) {
}
var originBlock = core.getBlock(x, y, floorId, true);
var originEvent = originBlock == null ? null : originBlock.block.event;
if (floorId == core.status.floorId) {
core.removeGlobalAnimate(x, y);
core.clearMap('event', x * 32, y * 32, 32, 32);
if (originBlock != null) {
var height = (originBlock.block.event || {}).height || 32;
if (height > 32)
core.clearMap('event2', x * 32, y * 32 + 32 - height, 32, height - 32);
}
}
if (originBlock == null) {
core.status.maps[floorId].blocks.push(block);
}
@ -1642,15 +1632,14 @@ maps.prototype.setBlock = function (number, x, y, floorId) {
core.drawMap();
} else {
if (originEvent != null) {
this._removeBlockFromMap(floorId, {event: originEvent});
this._removeBlockFromMap(floorId, {x: x, y: y, event: originEvent});
}
if (!block.disable) {
core.drawBlock(block);
core.addGlobalAnimate(block);
core.updateStatusBar();
}
}
if (originEvent != null) {
this._removeBlockFromMap()
}
}
}