summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-02-08 18:24:31 +0100
committerTor Andersson <tor@ccxvii.net>2024-02-08 18:24:31 +0100
commit84e21a0ab351ad76b5dcf85bea51a83bb9239cf5 (patch)
tree2efaccab2313c2df7d674e63c99e2cade38a1aac
parent3bba00b794e9956a4f4ca5b851774af5a6506013 (diff)
downloadandean-abyss-84e21a0ab351ad76b5dcf85bea51a83bb9239cf5.tar.gz
Add confirmation when selecting another faction to execute event.
-rw-r--r--play.js5
-rw-r--r--rules.js73
2 files changed, 70 insertions, 8 deletions
diff --git a/play.js b/play.js
index 4a4cece..a686319 100644
--- a/play.js
+++ b/play.js
@@ -1387,6 +1387,11 @@ function on_update() {
action_button("auc", "AUC")
action_button("cartels", "Cartels")
+ confirm_action_button("choose_govt", "Government", "Choose GOVERNMENT to execute this event?")
+ confirm_action_button("choose_farc", "FARC", "Choose FARC to execute this event?")
+ confirm_action_button("choose_auc", "AUC", "Choose AUC to execute this event?")
+ confirm_action_button("choose_cartels", "Cartels", "Choose CARTELS to execute this event?")
+
// Select Operation
action_button("train", "Train")
action_button("patrol", "Patrol")
diff --git a/rules.js b/rules.js
index 4514a4d..896b15a 100644
--- a/rules.js
+++ b/rules.js
@@ -7324,14 +7324,37 @@ states.vm_current = {
prompt() {
let list = vm_operand(1)
event_prompt("Select Faction.")
- if (list === GOVT || (Array.isArray(list) && list.includes(GOVT)))
- view.actions.govt = 1
- if (list === FARC || (Array.isArray(list) && list.includes(FARC)))
- view.actions.farc = 1
- if (list === AUC || (Array.isArray(list) && list.includes(AUC)))
- view.actions.auc = 1
- if (list === CARTELS || (Array.isArray(list) && list.includes(CARTELS)))
- view.actions.cartels = 1
+ if (Array.isArray(list)) {
+ if (list.includes(GOVT))
+ gen_choose_faction(GOVT)
+ if (list.includes(FARC))
+ gen_choose_faction(FARC)
+ if (list.includes(AUC))
+ gen_choose_faction(AUC)
+ if (list.includes(CARTELS))
+ gen_choose_faction(CARTELS)
+ } else {
+ if (list === GOVT)
+ gen_choose_faction(GOVT)
+ if (list === FARC)
+ gen_choose_faction(FARC)
+ if (list === AUC)
+ gen_choose_faction(AUC)
+ if (list === CARTELS)
+ gen_choose_faction(CARTELS)
+ }
+ },
+ choose_govt() {
+ this.govt()
+ },
+ choose_farc() {
+ this.farc()
+ },
+ choose_auc() {
+ this.auc()
+ },
+ choose_cartels() {
+ this.cartels()
},
govt() {
if (game.current !== GOVT)
@@ -8147,6 +8170,40 @@ function gen_action_shipment(sh) {
gen_action("shipment", sh)
}
+function gen_choose_faction(faction) {
+ if (game.current === faction) {
+ switch (faction) {
+ case GOVT:
+ view.actions.govt = 1
+ break
+ case FARC:
+ view.actions.farc = 1
+ break
+ case AUC:
+ view.actions.auc = 1
+ break
+ case CARTELS:
+ view.actions.cartels = 1
+ break
+ }
+ } else {
+ switch (faction) {
+ case GOVT:
+ view.actions.choose_govt = 1
+ break
+ case FARC:
+ view.actions.choose_farc = 1
+ break
+ case AUC:
+ view.actions.choose_auc = 1
+ break
+ case CARTELS:
+ view.actions.choose_cartels = 1
+ break
+ }
+ }
+}
+
function is_current_role(role) {
switch (role) {
case NAME_GOVT_AUC: