polyfill & kill bug

This commit is contained in:
unamed 2022-02-01 22:22:52 +08:00
parent 01fbd7647c
commit 4a801cbc85
5 changed files with 354 additions and 340 deletions

View File

@ -189,6 +189,7 @@
</div> </div>
</div> </div>
<!-- injection --> <!-- injection -->
<script src='libs/thirdparty/browser-polyfill.min.js'></script>
<script src='libs/thirdparty/lz-string.min.js'></script> <script src='libs/thirdparty/lz-string.min.js'></script>
<script src='libs/thirdparty/priority-queue.min.js'></script> <script src='libs/thirdparty/priority-queue.min.js'></script>
<script src='libs/thirdparty/localforage.min.js'></script> <script src='libs/thirdparty/localforage.min.js'></script>

View File

@ -1160,17 +1160,23 @@ events.prototype.checkAutoEvents = function () {
event = [ event = [
// 用do-while(0)包一层防止break影响事件流 // 用do-while(0)包一层防止break影响事件流
{ "type": "dowhile", "condition": "false", "data": autoEvent.data }, { "type": "dowhile", "condition": "false", "data": autoEvent.data },
{"type": "function", "function": {
"function() { core.autoEventExecuting('" + symbol + "', false); }"} "type": "function", "function":
"function() { core.autoEventExecuting('" + symbol + "', false); }"
}
]; ];
} else { } else {
event = [ event = [
{"type": "function", "function": {
"function() { core.pushEventLoc(" + x + ", " + y + ", '" + floorId + "' ); }"}, "type": "function", "function":
"function() { core.pushEventLoc(" + x + ", " + y + ", '" + floorId + "' ); }"
},
// 用do-while(0)包一层防止break影响事件流 // 用do-while(0)包一层防止break影响事件流
{ "type": "dowhile", "condition": "false", "data": autoEvent.data }, { "type": "dowhile", "condition": "false", "data": autoEvent.data },
{"type": "function", "function": {
"function() { core.popEventLoc(); core.autoEventExecuting('" + symbol + "', false); }"} "type": "function", "function":
"function() { core.popEventLoc(); core.autoEventExecuting('" + symbol + "', false); }"
}
]; ];
} }
@ -2778,7 +2784,7 @@ events.prototype.useFly = function (fromUserAction) {
if (!core.hasItem('fly')) { if (!core.hasItem('fly')) {
core.playSound('操作失败'); core.playSound('操作失败');
core.drawTip('你没有' + core.material.items['fly'].name, 'fly'); core.drawTip('你没有' + core.material.items['fly'].name, 'fly');
} else if (!core.canUseItem('fly')) { } else if (!core.canUseItem('fly') || (core.flags.flyNearStair && !core.nearStair())) {
core.playSound('操作失败'); core.playSound('操作失败');
core.drawTip('无法传送到当前层', 'fly'); core.drawTip('无法传送到当前层', 'fly');
} else { } else {

View File

@ -1495,7 +1495,8 @@ maps.prototype._drawAutotile = function (ctx, mapArr, block, size, left, top, st
iG[_x] = []; iG[_x] = [];
[-1, 0, 1].forEach(function (_y) { [-1, 0, 1].forEach(function (_y) {
iG[_x][_y] = isGrass(xx + _x, yy + _y); iG[_x][_y] = isGrass(xx + _x, yy + _y);
})}); })
});
if (iG[-1][-1] + iG[0][-1] + iG[0][0] + iG[-1][0] == 3 && !iG[-1][-1]) { if (iG[-1][-1] + iG[0][-1] + iG[0][0] + iG[-1][0] == 3 && !iG[-1][-1]) {
this._drawAutotile_render(ctx, xx * size + left, yy * size + top, size, autotile, status, 16, null, onMap); this._drawAutotile_render(ctx, xx * size + left, yy * size + top, size, autotile, status, 16, null, onMap);
done[0] = true; done[0] = true;
@ -1975,8 +1976,10 @@ maps.prototype.getBlockInfo = function (block) {
if (!doorInfo && bigImage != null) animate = 4; if (!doorInfo && bigImage != null) animate = 4;
} }
return {number: number, id: id, cls: cls, name: name, image: image, posX: posX, doorInfo: doorInfo, return {
posY: posY, height: height, faceIds: faceIds, animate: animate, face: face, bigImage: bigImage}; number: number, id: id, cls: cls, name: name, image: image, posX: posX, doorInfo: doorInfo,
posY: posY, height: height, faceIds: faceIds, animate: animate, face: face, bigImage: bigImage
};
} }
////// 搜索某个图块出现的所有位置 ////// ////// 搜索某个图块出现的所有位置 //////
@ -2433,6 +2436,8 @@ maps.prototype.setBgFgBlock = function (name, number, x, y, floorId) {
core.status[name + "maps"][floorId] = null; core.status[name + "maps"][floorId] = null;
this._getBgFgMapArray(name, floorId, true);
if (floorId == core.status.floorId) { if (floorId == core.status.floorId) {
core.clearMap(name); core.clearMap(name);
if (name.startsWith('bg')) core.drawBg(floorId); if (name.startsWith('bg')) core.drawBg(floorId);

File diff suppressed because one or more lines are too long

View File

@ -145,7 +145,7 @@ utils.prototype.calValue = function (value, prefix) {
if (!core.isset(value)) return null; if (!core.isset(value)) return null;
if (typeof value === 'string') { if (typeof value === 'string') {
if (value.indexOf(':') >= 0 || value.indexOf("flag") >= 0 || value.indexOf('global') >= 0) { if (value.indexOf(':') >= 0 || value.indexOf("flag") >= 0 || value.indexOf('global') >= 0) {
if (value.indexOf('switch:' >= 0)) if (value.indexOf('switch:') >= 0)
value = value.replace(/switch:([a-zA-Z0-9_]+)/g, "core.getFlag('" + (prefix || ":f@x@y") + "@$1', 0)"); value = value.replace(/switch:([a-zA-Z0-9_]+)/g, "core.getFlag('" + (prefix || ":f@x@y") + "@$1', 0)");
value = this.replaceValue(value); value = this.replaceValue(value);
} }