diff --git a/_server/blockly/MotaAction.g4 b/_server/blockly/MotaAction.g4 index 868ea986..9e811383 100644 --- a/_server/blockly/MotaAction.g4 +++ b/_server/blockly/MotaAction.g4 @@ -1176,7 +1176,7 @@ default : [null,1] colour : this.soundColor if(Int_0<1 || Int_0>10) throw new Error('天气的强度等级, 在1-10之间'); var code = '{"type": "setWeather", "name": "'+Weather_List_0+'", "level": '+Int_0+'},\n'; -if(Weather_List_0==='')code = '{"type": "setWeather"},\n'; +if(Weather_List_0===''||Weather_List_0==='null'||Weather_List_0==null)code = '{"type": "setWeather"},\n'; return code; */; @@ -1703,7 +1703,7 @@ Arithmetic_List Weather_List : '无'|'雨'|'雪'|'雾' - /*Weather_List ['','rain','snow','fog']*/; + /*Weather_List ['null','rain','snow','fog']*/; B_0_List : '不改变'|'不可通行'|'可以通行' @@ -2162,7 +2162,7 @@ ActionParser.prototype.parseAction = function() { break; case "setWeather": // 更改天气 this.next = MotaActionBlocks['setWeather_s'].xmlText([ - data.name||'无',data.level||1,this.next]); + data.name,data.level||1,this.next]); break; case "openDoor": // 开一个门, 包括暗墙 data.loc=data.loc||['',''] diff --git a/libs/control.js b/libs/control.js index 22525912..f8eb5b89 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1240,7 +1240,7 @@ control.prototype.checkBlock = function () { var x=t.x, y=t.y, direction = t.direction; var nx = x+core.utils.scan[direction].x, ny=y+core.utils.scan[direction].y; - return nx>=0 && nx=0 && ny=0 && nx=0 && ny0) @@ -1528,6 +1528,7 @@ control.prototype.chooseReplayFile = function () { ////// 开始播放 ////// control.prototype.startReplay = function (list) { + if (!core.isPlaying()) return; core.status.replay.replaying=true; core.status.replay.pausing=false; core.status.replay.speed=1.0; @@ -1543,6 +1544,7 @@ control.prototype.startReplay = function (list) { ////// 更改播放状态 ////// control.prototype.triggerReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (core.status.replay.pausing) this.resumeReplay(); else this.pauseReplay(); @@ -1550,6 +1552,7 @@ control.prototype.triggerReplay = function () { ////// 暂停播放 ////// control.prototype.pauseReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; core.status.replay.pausing = true; @@ -1559,6 +1562,7 @@ control.prototype.pauseReplay = function () { ////// 恢复播放 ////// control.prototype.resumeReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; core.status.replay.pausing = false; @@ -1569,6 +1573,7 @@ control.prototype.resumeReplay = function () { ////// 加速播放 ////// control.prototype.speedUpReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; if (core.status.replay.speed==12) core.status.replay.speed=24.0; @@ -1583,6 +1588,7 @@ control.prototype.speedUpReplay = function () { ////// 减速播放 ////// control.prototype.speedDownReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; if (core.status.replay.speed==24) core.status.replay.speed=12.0; @@ -1598,6 +1604,7 @@ control.prototype.speedDownReplay = function () { ////// 设置播放速度 ////// control.prototype.setReplaySpeed = function (speed) { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; core.status.replay.speed = speed; @@ -1606,6 +1613,7 @@ control.prototype.setReplaySpeed = function (speed) { ////// 停止播放 ////// control.prototype.stopReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; core.status.replay.toReplay = []; @@ -1621,6 +1629,7 @@ control.prototype.stopReplay = function () { ////// 回退 ////// control.prototype.rewindReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; if (!core.status.replay.pausing) { @@ -1656,6 +1665,7 @@ control.prototype.rewindReplay = function () { ////// 回放时存档 ////// control.prototype.saveReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; if (!core.status.replay.pausing) { @@ -1677,6 +1687,7 @@ control.prototype.saveReplay = function () { ////// 回放时查看怪物手册 ////// control.prototype.bookReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0) return; if (!core.status.replay.replaying) return; if (!core.status.replay.pausing) { @@ -1702,6 +1713,7 @@ control.prototype.bookReplay = function () { ////// 回放录像时浏览地图 ////// control.prototype.viewMapReplay = function () { + if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; if (!core.status.replay.replaying) return; @@ -1721,6 +1733,7 @@ control.prototype.viewMapReplay = function () { ////// 回放 ////// control.prototype.replay = function () { + if (!core.isPlaying()) return; if (!core.status.replay.replaying) return; // 没有回放 if (core.status.replay.pausing) return; // 暂停状态 diff --git a/libs/events.js b/libs/events.js index c915a462..66f5159f 100644 --- a/libs/events.js +++ b/libs/events.js @@ -835,7 +835,7 @@ events.prototype.doAction = function() { break; case "setWeather": // 更改天气 core.setWeather(data.name, data.level); - if (core.isset(data.name)) + if (data.name=='rain' || data.name=='snow' || data.name=='fog') core.setFlag('__weather__', [data.name, data.level]); else core.removeFlag('__weather__'); this.doAction(); diff --git a/libs/loader.js b/libs/loader.js index d5185100..0715d5df 100644 --- a/libs/loader.js +++ b/libs/loader.js @@ -272,6 +272,8 @@ loader.prototype.freeBgm = function (name) { loader.prototype.loadBgm = function (name) { if (!core.isset(core.material.bgms[name])) return; + // 如果没开启音乐,则不预加载 + if (!core.musicStatus.bgmStatus) return; // 是否已经预加载过 var index = core.musicStatus.cachedBgms.indexOf(name); if (index>=0) {