summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-11-01 15:55:15 +0100
committerTor Andersson <tor@ccxvii.net>2023-11-01 16:06:38 +0100
commit916879d092219443cc0b1e7a4119e7bab08adb57 (patch)
tree513406b0b020a32a4599827af5a27719d6568d08
parent577cfaf947980a7d11fbecdbc9feddb67b965c4a (diff)
downloadalgeria-916879d092219443cc0b1e7a4119e7bab08adb57.tar.gz
First undo deselects all in more states.
-rw-r--r--rules.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/rules.js b/rules.js
index 66dc447..c1ae2c8 100644
--- a/rules.js
+++ b/rules.js
@@ -3440,8 +3440,15 @@ states.fln_move = {
// Allow deselect
gen_action_unit(first_unit)
+ view.actions.undo = 1
}
},
+ undo() {
+ if (game.selected.length > 0)
+ set_clear(game.selected)
+ else
+ pop_undo()
+ },
unit(u) {
set_toggle(game.selected, u)
},
@@ -3510,9 +3517,17 @@ states.fln_raid = {
}
})
+ view.actions.undo = 1
+
gen_action("roll")
}
},
+ undo() {
+ if (game.selected.length > 0)
+ set_clear(game.selected)
+ else
+ pop_undo()
+ },
unit(u) {
set_toggle(game.selected, u)
},
@@ -3628,8 +3643,16 @@ states.fln_harass = {
if (!has_target || set_has(game.selected, u))
gen_action_unit(u)
})
+
+ view.actions.undo = 1
}
},
+ undo() {
+ if (game.selected.length > 0)
+ set_clear(game.selected)
+ else
+ pop_undo()
+ },
unit(u) {
set_toggle(game.selected, u)
},
@@ -4022,6 +4045,8 @@ states.gov_flush_select_units = {
gen_action_unit(first_unit)
}
+ view.actions.undo = 1
+
gen_action("roll")
}
},
@@ -4034,6 +4059,12 @@ states.gov_flush_select_units = {
game.air_avail -= 1
game.mission_air_pts += 1
},
+ undo() {
+ if (game.selected.length > 0)
+ set_clear(game.selected)
+ else
+ pop_undo()
+ },
unit(u) {
set_toggle(game.selected, u)
},
@@ -4221,9 +4252,17 @@ states.gov_react = {
gen_action_unit(first_unit)
}
+ view.actions.undo = 1
+
gen_action("roll")
}
},
+ undo() {
+ if (game.selected.length > 0)
+ set_clear(game.selected)
+ else
+ pop_undo()
+ },
airmobilize() {
push_undo()
goto_gov_airmobilize()
@@ -4974,10 +5013,18 @@ states.gov_coup_attempt_free_mobilize = {
})
}
}
+
+ view.actions.undo = 1
}
gen_action("done")
},
+ undo() {
+ if (game.selected.length > 0)
+ set_clear(game.selected)
+ else
+ pop_undo()
+ },
unit(u) {
set_toggle(game.selected, u)
},
@@ -5034,6 +5081,14 @@ states.gov_coup_attempt_select_units = {
if (target >= game.events.gov_remove_num) {
gen_action("done")
}
+
+ view.actions.undo = 1
+ },
+ undo() {
+ if (game.selected.length > 0)
+ set_clear(game.selected)
+ else
+ pop_undo()
},
unit(u) {
set_toggle(game.selected, u)