From a8ea3e25c1f90db5af5ec9231c183eceb147b7cd Mon Sep 17 00:00:00 2001 From: AnturK Date: Mon, 30 Nov 2015 16:43:43 +0100 Subject: [PATCH] Fixes player medbot overdoses Makes braindead bots get back to work. --- code/modules/mob/living/simple_animal/bot/bot.dm | 10 ++++++++-- code/modules/mob/living/simple_animal/bot/medbot.dm | 10 ++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 27fc94a988a..9d9d8428860 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -149,6 +149,7 @@ locked = 0 emagged = 1 user << "You bypass [src]'s controls." + return if(!locked && open) //Bot panel is unlocked by ID or emag, and the panel is screwed open. Ready for emagging. emagged = 2 remote_disabled = 1 //Manually emagging the bot locks out the AI built in panel. @@ -156,6 +157,7 @@ bot_reset() turn_on() //The bot automatically turns on when emagged, unless recently hit with EMP. src << "(#$*#$^^( OVERRIDE DETECTED" + return else //Bot is unlocked, but the maint panel has not been opened with a screwdriver yet. user << "You need to open maintenance panel first!" @@ -182,7 +184,7 @@ /mob/living/simple_animal/bot/handle_automated_action() //Master process which handles code common across most bots. set background = BACKGROUND_ENABLED - if(!on || ckey) + if(!on || client) return switch(mode) //High-priority overrides are processed first. Bots can do nothing else while under direct command. @@ -580,7 +582,7 @@ Pass a positive integer as an argument to override a bot's default speed. /mob/living/simple_animal/bot/proc/bot_control(command, mob/user, turf/user_turf, list/user_access = list()) if(!on || emagged == 2 || remote_disabled) //Emagged bots do not respect anyone's authority! Bots with their remote controls off cannot get commands. return 1 //ACCESS DENIED - if(ckey) + if(client) bot_control_message(command,user,user_turf,user_access) // process control input switch(command) @@ -778,3 +780,7 @@ Pass a positive integer as an argument to override a bot's default speed. /mob/living/simple_animal/bot/Login() . = ..() access_card.access += player_access + +/mob/living/simple_animal/bot/Logout() + . = ..() + bot_reset() diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index 098cc64efe6..c38a3279817 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -447,6 +447,9 @@ bot_reset() return else + if(!emagged && check_overdose(patient,reagent_id,injection_amount)) + soft_reset() + return C.visible_message("[src] is trying to inject [patient]!", \ "[src] is trying to inject you!") @@ -470,6 +473,13 @@ reagent_id = null return +/mob/living/simple_animal/bot/medbot/proc/check_overdose(mob/living/carbon/patient,reagent_id,injection_amount) + var/datum/reagent/R = chemical_reagents_list[reagent_id] + var/current_volume = patient.reagents.get_reagent_amount(reagent_id) + if(current_volume + injection_amount > R.overdose_threshold) + return 1 + return 0 + /mob/living/simple_animal/bot/medbot/bullet_act(obj/item/projectile/Proj) if(Proj.flag == "taser") stunned = min(stunned+10,20)