diff --git a/_server/table/plugins.comment.js b/_server/table/plugins.comment.js index f012cdc1..059b7e5d 100644 --- a/_server/table/plugins.comment.js +++ b/_server/table/plugins.comment.js @@ -26,6 +26,12 @@ var plugins_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_range": "typeof(thiseval)=='string' || thiseval==null", "_data": "灯光效果" }, + "removeMap": { + "_leaf": true, + "_type": "textarea", + "_range": "typeof(thiseval)=='string' || thiseval==null", + "_data": "砍层插件" + }, "itemShop": { "_leaf": true, "_type": "textarea", diff --git a/libs/events.js b/libs/events.js index 3e2e46f6..6fa74489 100644 --- a/libs/events.js +++ b/libs/events.js @@ -2067,7 +2067,7 @@ events.prototype._action_wait = function (data, x, y, prefix) { } else if (data.timeout) { core.status.event.interval = setTimeout(function() { core.status.route.push("input:none"); - core.removeFlag("type"); + core.setFlag("type", -1); core.doAction(); }, data.timeout); } diff --git a/libs/maps.js b/libs/maps.js index a2477497..9254a1cc 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -42,6 +42,10 @@ maps.prototype.loadFloor = function (floorId, map) { if (notCopy.indexOf(name) == -1 && map[name] != null) content[name] = core.clone(map[name]); } + if (map.deleted) { + content['blocks'] = []; + return content; + } map = this.decompressMap(map.map, floorId); // 事件处理 content['blocks'] = this._mapIntoBlocks(map, floor, floorId); @@ -267,7 +271,7 @@ maps.prototype.saveMap = function (floorId) { } // 砍层状态:直接返回 if (main.mode == 'play' && (flags.__removed__ || []).indexOf(floorId) >= 0) { - return { canFlyTo: false, cannotViewMap: true }; + return { deleted: true, canFlyTo: false, cannotViewMap: true }; } var map = maps[floorId], floor = core.floors[floorId]; @@ -305,23 +309,6 @@ maps.prototype.loadMap = function (data, floorId) { return this.loadFloor(floorId, data[floorId]); } -////// 删除地图,不计入存档 ////// -maps.prototype.removeMaps = function (fromId, toId) { - if (!core.isPlaying()) return; - toId = toId || fromId; - var fromIndex = core.floorIds.indexOf(fromId), - toIndex = core.floorIds.indexOf(toId); - if (toIndex < 0) toIndex = core.floorIds.length - 1; - flags.__removed__ = flags.__removed__ || []; - for (var i = fromIndex; i <= toIndex; ++i) { - var floorId = core.floorIds[i]; - delete flags.__visited__[floorId]; - flags.__removed__.push(floorId); - core.status.maps[floorId].canFlyTo = false; - core.status.maps[floorId].cannotViewMap = true; - } -} - ////// 更改地图画布的尺寸 maps.prototype.resizeMap = function (floorId) { floorId = floorId || core.status.floorId; diff --git a/project/materials/icons.png b/project/materials/icons.png index 2a602bf3..a24d21eb 100644 Binary files a/project/materials/icons.png and b/project/materials/icons.png differ diff --git a/project/materials/icons_old.png b/project/materials/icons_old.png new file mode 100644 index 00000000..311b6392 Binary files /dev/null and b/project/materials/icons_old.png differ diff --git a/project/plugins.js b/project/plugins.js index b8a4776e..2cc5e6f3 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -220,6 +220,49 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = return null; } +}, + "removeMap": function () { + // 高层塔砍层插件,删除后不会存入存档,不可浏览地图也不可飞到。 + // 推荐用法: + // 对于超高层或分区域塔,当在1区时将2区以后的地图删除;1区结束时恢复2区,进二区时删除1区地图,以此类推 + // 这样可以大幅减少存档空间,以及加快存读档速度 + + // 删除楼层 + // core.removeMaps("MT1", "MT300") 删除MT1~MT300之间的全部层 + // core.removeMaps("MT10") 只删除MT10层 + this.removeMaps = function (fromId, toId) { + toId = toId || fromId; + var fromIndex = core.floorIds.indexOf(fromId), + toIndex = core.floorIds.indexOf(toId); + if (toIndex < 0) toIndex = core.floorIds.length - 1; + flags.__removed__ = flags.__removed__ || []; + for (var i = fromIndex; i <= toIndex; ++i) { + var floorId = core.floorIds[i]; + delete flags.__visited__[floorId]; + flags.__removed__.push(floorId); + core.status.maps[floorId].deleted = true; + core.status.maps[floorId].canFlyTo = false; + core.status.maps[floorId].cannotViewMap = true; + } + } + + // 恢复楼层 + // core.resumeMaps("MT1", "MT300") 恢复MT1~MT300之间的全部层 + // core.resumeMaps("MT10") 只恢复MT10层 + this.resumeMaps = function (fromId, toId) { + toId = toId || fromId; + var fromIndex = core.floorIds.indexOf(fromId), + toIndex = core.floorIds.indexOf(toId); + if (toIndex < 0) toIndex = core.floorIds.length - 1; + flags.__removed__ = flags.__removed__ || []; + for (var i = fromIndex; i <= toIndex; ++i) { + var floorId = core.floorIds[i]; + flags.__removed__ = flags.__removed__.filter(function (f) { return f != floorId; }); + if (core.status.maps[floorId].deleted) { + core.status.maps[floorId] = core.loadFloor(floorId); + } + } + } }, "itemShop": function () { // 道具商店相关的插件