From 57c8c06e2aedd7c2adeb98530e0712c074dd1bf5 Mon Sep 17 00:00:00 2001 From: EgorDinamit Date: Wed, 14 Feb 2024 22:09:35 +0300 Subject: [PATCH] Faction link cooldown --- .../file_system/programs/generic/supply.dm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/code/modules/modular_computers/file_system/programs/generic/supply.dm b/code/modules/modular_computers/file_system/programs/generic/supply.dm index ea04f11667..1b3fb0196a 100644 --- a/code/modules/modular_computers/file_system/programs/generic/supply.dm +++ b/code/modules/modular_computers/file_system/programs/generic/supply.dm @@ -33,6 +33,10 @@ // Our associated trade faction var/faction = FACTION_INDEPENDENT + // Point at world.time when we can set/reset the faction again + var/faction_cooldown + // How often we can change faction on the console + var/faction_cooldown_time = 2 MINUTES var/prg_screen = PRG_TREE var/trade_screen = GOODS_SCREEN @@ -229,6 +233,10 @@ return TRUE if(href_list["PRG_faction"]) + if(faction_cooldown > world.time) + to_chat(usr, SPAN_WARNING("The option is currently unavailable! Try again later!")) + return + var/obj/item/stock_parts/computer/card_slot/card_slot = computer.get_component(PART_CARD) if(!istype(card_slot)) to_chat(usr, SPAN_WARNING("Card slot is not installed.")) @@ -258,9 +266,14 @@ return faction = faction_chosen + faction_cooldown = world.time + faction_cooldown_time return TRUE if(href_list["PRG_faction_unlink"]) + if(faction_cooldown > world.time) + to_chat(usr, SPAN_WARNING("The option is currently unavailable! Try again later!")) + return + faction = FACTION_INDEPENDENT return TRUE