From f5345ae64df592884aa74920c7c77919d787ecdf Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 17 Dec 2024 19:33:17 +0100 Subject: Add "ping" function to negotiation menu in AA. --- play.html | 1 + play.js | 3 +++ rules.js | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/play.html b/play.html index ff504c7..a4f0dfc 100644 --- a/play.html +++ b/play.html @@ -42,6 +42,7 @@
  • Transfer Shipment
  • Ask for Resources
  • Ask for Shipment +
  • Ping Player 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 -- cgit v1.2.3