diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-12-17 19:33:17 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-12-17 19:34:46 +0100 |
commit | f5345ae64df592884aa74920c7c77919d787ecdf (patch) | |
tree | b02730fda7cb26d193b2d437cb5b7d7c20e5c2b0 | |
parent | 65ab63d1894ee9bb175adfa054793f01b667b02f (diff) | |
download | andean-abyss-master.tar.gz |
-rw-r--r-- | play.html | 1 | ||||
-rw-r--r-- | play.js | 3 | ||||
-rw-r--r-- | rules.js | 68 |
3 files changed, 72 insertions, 0 deletions
@@ -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> @@ -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") @@ -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 |