fix: 部分图块设置操作没有被捕获

This commit is contained in:
unanmed 2025-10-11 14:23:31 +08:00
parent 92f0881be8
commit 14aa4d6109
3 changed files with 41 additions and 1 deletions

View File

@ -3104,6 +3104,14 @@ maps.prototype.showBlock = function (x, y, floorId) {
block.disable = false;
core.setMapBlockDisabled(floorId, x, y, false);
this._updateMapArray(floorId, block.x, block.y);
Mota.require('@user/data-base').hook.emit(
'setBlock',
x,
y,
floorId,
block?.id ?? 0,
0
);
// 在本层,添加动画
if (floorId == core.status.floorId) {
if (block.event.cls == 'autotile') {
@ -3128,6 +3136,14 @@ maps.prototype.hideBlock = function (x, y, floorId) {
block.disable = true;
core.setMapBlockDisabled(floorId, block.x, block.y, true);
this._updateMapArray(floorId, block.x, block.y);
Mota.require('@user/data-base').hook.emit(
'setBlock',
x,
y,
floorId,
0,
block?.id ?? 0
);
// 删除动画,清除地图
this._removeBlockFromMap(floorId, block);
@ -3143,6 +3159,14 @@ maps.prototype.hideBlockByIndex = function (index, floorId) {
block.disable = true;
core.setMapBlockDisabled(floorId, block.x, block.y, true);
this._updateMapArray(floorId, block.x, block.y);
Mota.require('@user/data-base').hook.emit(
'setBlock',
x,
y,
floorId,
0,
block?.id ?? 0
);
};
////// 一次性隐藏多个block //////
@ -3562,6 +3586,14 @@ maps.prototype.replaceBlock = function (fromNumber, toNumber, floorId) {
block.event[one] = core.clone(toBlock.event[one]);
}
this._updateMapArray(floorId, block.x, block.y);
Mota.require('@user/data-base').hook.emit(
'setBlock',
x,
y,
floorId,
fromNumber,
toNumber
);
}
}, this);
if (floorId == core.status.floorId) core.redrawMap();

View File

@ -361,6 +361,10 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"type": "text",
"text": "同时 2.B 样板也新增了很多接口,在造塔时可以提供非常大的帮助!"
},
{
"type": "text",
"text": "不过由于重构并不简单,有一些 2.x 有的功能在 2.B 中暂时被移除,将会在 2.B 的后续更新中重新添加回来。"
},
{
"type": "text",
"text": "这里是开场剧情,可以在编辑器全塔属性中修改,试着修改一下吧!"

View File

@ -8,7 +8,7 @@ main.floors.sample0=
"canUseQuickShop": true,
"defaultGround": "ground",
"images": [],
"bgm": "bgm.opus",
"bgm": "bgm.mp3",
"ratio": 1,
"map": [
[ 0, 0,220, 0, 0, 20, 87, 3, 58, 59, 60, 61, 64],
@ -57,6 +57,10 @@ main.floors.sample0=
{
"type": "text",
"text": "除此之外还有一些因为各种原因在 2.B 中暂时删除的功能,将会在之后的版本中逐步重新添加。"
},
{
"type": "text",
"text": "由于一些原因,当前版本中隐藏图块的动画也无法显示,将会在 2.B.1 中修复。"
}
],
"events": {