From 916879d092219443cc0b1e7a4119e7bab08adb57 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 1 Nov 2023 15:55:15 +0100 Subject: First undo deselects all in more states. --- rules.js | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) 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) -- cgit v1.2.3