From d5a3fb57ea1f87d4eb3d9795939b1ab91e8b948a Mon Sep 17 00:00:00 2001 From: Markolie Date: Fri, 11 Sep 2015 06:51:14 +0200 Subject: [PATCH] Add cooldown to pAI card/drone reactivations --- code/game/objects/items/devices/paicard.dm | 8 ++++++++ .../mob/living/silicon/robot/drone/drone.dm | 15 +++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/code/game/objects/items/devices/paicard.dm b/code/game/objects/items/devices/paicard.dm index 6950d3b0361..da972725956 100644 --- a/code/game/objects/items/devices/paicard.dm +++ b/code/game/objects/items/devices/paicard.dm @@ -6,6 +6,8 @@ w_class = 2.0 slot_flags = SLOT_BELT origin_tech = "programming=2" + var/request_cooldown = 60 // one minute + var/last_request var/obj/item/device/radio/radio var/looking_for_personality = 0 var/mob/living/silicon/pai/pai @@ -241,6 +243,12 @@ pai.master_dna = dna.unique_enzymes pai << "

You have been bound to a new master.

" if(href_list["request"]) + var/delta = (world.time / 10) - last_request + if(request_cooldown > delta) + var/cooldown_time = round(request_cooldown - ((world.time / 10) - last_request), 1) + usr << "\red The request system is currently offline. Please wait another [cooldown_time] seconds." + return + last_request = world.time / 10 src.looking_for_personality = 1 paiController.findPAI(src, usr) if(href_list["wipe"]) diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm index 433a8361719..bcf862b3d92 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone.dm @@ -25,6 +25,8 @@ //Used for self-mailing. var/mail_destination = 0 + var/reboot_cooldown = 60 // one minute + var/last_reboot holder_type = /obj/item/weapon/holder/drone // var/sprite[0] @@ -123,8 +125,15 @@ if(!allowed(usr)) user << "\red Access denied." return - + + var/delta = (world.time / 10) - last_reboot + if(reboot_cooldown > delta) + var/cooldown_time = round(reboot_cooldown - ((world.time / 10) - last_reboot), 1) + usr << "\red The reboot system is currently offline. Please wait another [cooldown_time] seconds." + return + user.visible_message("\red \the [user] swipes \his ID card through \the [src], attempting to reboot it.", "\red You swipe your ID card through \the [src], attempting to reboot it.") + last_reboot = world.time / 10 var/drones = 0 for(var/mob/living/silicon/robot/drone/D in world) if(D.key && D.client) @@ -256,13 +265,11 @@ /mob/living/silicon/robot/drone/proc/question(var/client/C,var/mob/M) spawn(0) if(!C || !M || jobban_isbanned(M,"nonhumandept") || jobban_isbanned(M,"Drone")) return - var/response = alert(C, "Someone is attempting to reboot a maintenance drone. Would you like to play as one?", "Maintenance drone reboot", "Yes", "No", "Never for this round.") + var/response = alert(C, "Someone is attempting to reboot a maintenance drone. Would you like to play as one?", "Maintenance drone reboot", "Yes", "No") if(!C || ckey) return if(response == "Yes") transfer_personality(C) - else if (response == "Never for this round") - C.prefs.be_special ^= BE_PAI /mob/living/silicon/robot/drone/proc/transfer_personality(var/client/player)