Fixes player medbot overdoses

Makes braindead bots get back to work.
This commit is contained in:
AnturK
2015-11-30 16:43:43 +01:00
parent b216ffe457
commit a8ea3e25c1
2 changed files with 18 additions and 2 deletions
@@ -149,6 +149,7 @@
locked = 0
emagged = 1
user << "<span class='notice'>You bypass [src]'s controls.</span>"
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 << "<span class='userdanger'>(#$*#$^^( OVERRIDE DETECTED</span>"
return
else //Bot is unlocked, but the maint panel has not been opened with a screwdriver yet.
user << "<span class='warning'>You need to open maintenance panel first!</span>"
@@ -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()
@@ -447,6 +447,9 @@
bot_reset()
return
else
if(!emagged && check_overdose(patient,reagent_id,injection_amount))
soft_reset()
return
C.visible_message("<span class='danger'>[src] is trying to inject [patient]!</span>", \
"<span class='userdanger'>[src] is trying to inject you!</span>")
@@ -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)