autosave in events

This commit is contained in:
oc 2019-04-17 13:40:48 +08:00
parent cbd2f650a5
commit 32b73796da

View File

@ -1480,29 +1480,21 @@ control.prototype._replayAction_key = function (action) {
////// 自动存档 //////
control.prototype.autosave = function (removeLast) {
var inEvent = false; // 检测是否是事件中的自动存档
if (core.status.event.id!=null) {
if (core.status.event.id!='action') return;
inEvent = true;
}
var x=null;
if (removeLast) x=core.status.route.pop();
if (inEvent) {
core.setFlag("__events__", core.clone(core.status.event.data));
}
else {
if (removeLast) {
x=core.status.route.pop();
core.status.route.push("turn:"+core.getHeroLoc('direction'));
}
if (core.status.event.id == 'action') // 事件中的自动存档
core.setFlag("__events__", core.clone(core.status.event.data));
core.saves.autosave.data = core.saveData();
core.saves.autosave.updated = true;
core.saves.ids[0] = true;
if (inEvent) {
core.removeFlag("__events__");
}
else {
core.removeFlag("__events__");
if (removeLast) {
core.status.route.pop();
if (x) core.status.route.push(x);
}
if (x) core.status.route.push(x);
}
/////// 实际进行自动存档 //////