summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-12-17 19:33:17 +0100
committerTor Andersson <tor@ccxvii.net>2024-12-17 19:34:46 +0100
commitf5345ae64df592884aa74920c7c77919d787ecdf (patch)
treeb02730fda7cb26d193b2d437cb5b7d7c20e5c2b0
parent65ab63d1894ee9bb175adfa054793f01b667b02f (diff)
downloadandean-abyss-f5345ae64df592884aa74920c7c77919d787ecdf.tar.gz
Add "ping" function to negotiation menu in AA.HEADmaster
-rw-r--r--play.html1
-rw-r--r--play.js3
-rw-r--r--rules.js68
3 files changed, 72 insertions, 0 deletions
diff --git a/play.html b/play.html
index ff504c7..a4f0dfc 100644
--- a/play.html
+++ b/play.html
@@ -42,6 +42,7 @@
<li id="transfer_shipment_menu" onclick="send_action('transfer_shipment')">Transfer Shipment
<li id="ask_resources_menu" onclick="send_action('ask_resources')">Ask for Resources
<li id="ask_shipment_menu" onclick="send_action('ask_shipment')">Ask for Shipment
+ <li id="ping_menu" onclick="send_action('ping')">Ping Player
</menu>
</details>
<button onclick="toggle_pieces()"><img src="/images/earth-america.svg"></button>
diff --git a/play.js b/play.js
index c68b7fd..a9f793c 100644
--- a/play.js
+++ b/play.js
@@ -1379,6 +1379,7 @@ function on_update() {
"transfer_shipment",
"ask_resources",
"ask_shipment",
+ "ping",
])
// Select Faction
@@ -1447,6 +1448,8 @@ function on_update() {
action_button("end_event", "End Event")
+ action_button("resume", "Resume")
+
action_button("deny", "Deny")
action_button("done", "Done")
action_button("undo", "Undo")
diff --git a/rules.js b/rules.js
index 36605e5..551142a 100644
--- a/rules.js
+++ b/rules.js
@@ -8146,6 +8146,64 @@ function goto_game_over(result) {
return true
}
+// === PING ===
+
+function action_ping() {
+ game.ping = { save_current: game.current, save_state: game.state }
+ game.state = "ping"
+}
+
+states.ping = {
+ disable_negotiation: true,
+ inactive: "Ping",
+ prompt() {
+ view.prompt = "Ping which faction to respond to chat?"
+ if (game.current !== GOVT)
+ view.actions.govt = 1
+ if (game.current !== FARC)
+ view.actions.farc = 1
+ if (game.current !== AUC)
+ view.actions.auc = 1
+ if (game.current !== CARTELS)
+ view.actions.cartels = 1
+ view.actions.undo = 1
+ },
+ govt() {
+ game.current = GOVT
+ game.state = "pong"
+ },
+ farc() {
+ game.current = FARC
+ game.state = "pong"
+ },
+ auc() {
+ game.current = AUC
+ game.state = "pong"
+ },
+ cartels() {
+ game.current = CARTELS
+ game.state = "pong"
+ },
+ undo() {
+ states.pong.resume()
+ },
+}
+
+states.pong = {
+ disable_negotiation: true,
+ inactive: "Ping",
+ prompt() {
+ view.prompt = faction_name[game.ping.save_current] + " has requested your response in chat."
+ view.actions.resume = 1
+ view.actions.undo = 0
+ },
+ resume() {
+ game.current = game.ping.save_current
+ game.state = game.ping.save_state
+ delete game.ping
+ },
+}
+
// === UNCOMMON TEMPLATE ===
function gen_action(action, argument) {
@@ -8306,6 +8364,14 @@ exports.view = function (state, role) {
view.actions.ask_shipment = 1
else
view.actions.ask_shipment = 0
+ view.actions.ping = 1
+ } else {
+ view.actions.remove_pieces = 0
+ view.actions.ask_resources = 0
+ view.actions.transfer_resources = 0
+ view.actions.transfer_shipment = 0
+ view.actions.ask_shipment = 0
+ view.actions.ping = 1
}
if (view.actions.undo === undefined) {
@@ -8338,6 +8404,8 @@ exports.action = function (state, role, action, arg) {
action_transfer_resources()
else if (action === "transfer_shipment")
action_transfer_shipment()
+ else if (action === "ping")
+ action_ping()
else if (game.op && action in special_activities)
special_activities[action](arg)
else