批量开门事件

This commit is contained in:
ckcz123 2021-08-05 19:21:03 +08:00
parent 4dc47a5d58
commit f73208a9a7
3 changed files with 13 additions and 7 deletions

View File

@ -562,7 +562,7 @@ return code;
// doorInfo 事件编辑器入口之一 // doorInfo 事件编辑器入口之一
doorInfo_m doorInfo_m
: '门信息' '开关门时间' Int '开门音效' EvalString? '关门音效' EvalString? BGNL? Newline '需要钥匙' doorKeyList+ '如需撞到开门还需要把图块触发器改成 openDoor' BEND : '门信息' '开关门时间' Int '开门音效' EvalString? '关门音效' EvalString? BGNL? Newline '需要钥匙' doorKeyList+ '如需撞到开门还需要把图块触发器改成 openDoor' BGNL? Newline '开门后事件' action+ BEND
/* doorInfo_m /* doorInfo_m
@ -571,7 +571,8 @@ default : [160, 'door.mp3', 'door.mp3']
helpUrl : /_docs/#/instruction helpUrl : /_docs/#/instruction
EvalString_0 = EvalString_0 && (', "openSound": "' + EvalString_0 + '"'); EvalString_0 = EvalString_0 && (', "openSound": "' + EvalString_0 + '"');
EvalString_1 = EvalString_1 && (', "closeSound": "' + EvalString_1 + '"'); EvalString_1 = EvalString_1 && (', "closeSound": "' + EvalString_1 + '"');
var code = '{"time": '+Int_0+EvalString_0+EvalString_1+', "keys": {\n'+doorKeyList_0+'\n}}'; if (action_0.trim()) action_0 = ', "afterOpenDoor": [\n' + action_0 + ']';
var code = '{"time": '+Int_0+EvalString_0+EvalString_1+', "keys": {\n'+doorKeyList_0+'\n}'+action_0.trim()+'}';
return code; return code;
*/; */;

View File

@ -101,7 +101,7 @@ ActionParser.prototype.parse = function (obj,type) {
}) })
return text_choices; return text_choices;
} }
return MotaActionBlocks['doorInfo_m'].xmlText([obj.time || 160, obj.openSound, obj.closeSound, buildKeys(obj.keys)]); return MotaActionBlocks['doorInfo_m'].xmlText([obj.time || 160, obj.openSound, obj.closeSound, buildKeys(obj.keys), this.parseList(obj.afterOpenDoor)]);
case 'floorImage': case 'floorImage':
if(!obj) obj=[]; if(!obj) obj=[];

View File

@ -435,10 +435,15 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 开一个门后触发的事件 // 开一个门后触发的事件
var todo = []; var todo = [];
// 检查该点的获得开门后事件。 // 检查该点的开门后事件
if (core.status.floorId == null) return; if (core.status.floorId) {
var event = core.floors[core.status.floorId].afterOpenDoor[x + "," + y]; core.push(todo, core.floors[core.status.floorId].afterOpenDoor[x + "," + y]);
if (event) core.unshift(todo, event); }
// 检查批量开门事件
var door = core.getBlockById(doorId);
if (door && door.event.doorInfo) {
core.push(todo, door.event.doorInfo.afterOpenDoor);
}
if (todo.length > 0) core.insertAction(todo, x, y); if (todo.length > 0) core.insertAction(todo, x, y);