Merge pull request #13334 from AnturK/botfix

Bot fixes
This commit is contained in:
Razharas
2015-12-01 21:00:23 +03:00
8 changed files with 56 additions and 17 deletions
@@ -81,11 +81,6 @@
ears.talk_into(src, message, , spans)
return ITALICS | REDUCE_RANGE
if(MODE_SECURE_HEADSET)
if (ears)
ears.talk_into(src, message, 1, spans)
return ITALICS | REDUCE_RANGE
if(MODE_DEPARTMENT)
if (ears)
ears.talk_into(src, message, message_mode, spans)
@@ -125,6 +125,12 @@
bot_core = new bot_core_type(src)
/mob/living/simple_animal/bot/update_canmove()
. = ..()
if(!on)
. = 0
canmove = .
/mob/living/simple_animal/bot/Destroy()
qdel(Radio)
qdel(access_card)
@@ -143,12 +149,15 @@
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.
locked = 1 //Access denied forever!
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>"
@@ -175,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.
@@ -293,6 +302,24 @@
/mob/living/simple_animal/bot/get_spans()
return ..() | SPAN_ROBOT
/mob/living/simple_animal/bot/radio(message, message_mode, list/spans)
. = ..()
if(. != 0)
return .
switch(message_mode)
if(MODE_HEADSET)
Radio.talk_into(src, message, , spans)
return REDUCE_RANGE
if(MODE_DEPARTMENT)
Radio.talk_into(src, message, message_mode, spans)
return REDUCE_RANGE
if(message_mode in radiochannels)
Radio.talk_into(src, message, message_mode, spans)
return REDUCE_RANGE
return 0
//Generalized behavior code, override where needed!
@@ -430,7 +457,6 @@ Pass a positive integer as an argument to override a bot's default speed.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//Patrol and summon code!
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -556,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)
@@ -754,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()
@@ -508,6 +508,8 @@ Auto Patrol[]"},
lasercolor = "r"
/mob/living/simple_animal/bot/ed209/UnarmedAttack(atom/A)
if(!on)
return
if(iscarbon(A))
var/mob/living/carbon/C = A
if(!C.stunned || arrest_type)
@@ -518,6 +520,8 @@ Auto Patrol[]"},
..()
/mob/living/simple_animal/bot/ed209/RangedAttack(atom/A)
if(!on)
return
if(ismob(A))
shootAt(A)
else
@@ -539,7 +543,7 @@ Auto Patrol[]"},
C.Weaken(5)
C.stuttering = 5
C.Stun(5)
add_logs(src,C,"stunned")
if(declare_arrests)
var/area/location = get_area(src)
speak("[arrest_type ? "Detaining" : "Arresting"] level [threat] scumbag <b>[C]</b> in [location].", radio_channel)
@@ -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)
@@ -795,6 +795,11 @@ mob/living/simple_animal/bot/mulebot/bot_reset()
else
return null
/mob/living/simple_animal/bot/mulebot/resist()
..()
if(load)
unload()
#undef SIGH
#undef ANNOYED
#undef DELIGHT
@@ -46,7 +46,6 @@
..()
icon_state = "secbot[on]"
spawn(3)
var/datum/job/detective/J = new/datum/job/detective
access_card.access += J.get_access()
prev_access = access_card.access
@@ -162,6 +161,8 @@ Auto Patrol: []"},
/mob/living/simple_animal/bot/secbot/UnarmedAttack(atom/A)
if(!on)
return
if(iscarbon(A))
var/mob/living/carbon/C = A
if(!C.stunned || arrest_type)
@@ -201,7 +202,7 @@ Auto Patrol: []"},
C.Weaken(5)
C.stuttering = 5
C.Stun(5)
add_logs(src,C,"stunned")
if(declare_arrests)
var/area/location = get_area(src)
speak("[arrest_type ? "Detaining" : "Arresting"] level [threat] scumbag <b>[C]</b> in [location].", radio_channel)
@@ -154,11 +154,6 @@
ears.talk_into(src, message, , spans)
return ITALICS | REDUCE_RANGE
if(MODE_SECURE_HEADSET)
if (ears)
ears.talk_into(src, message, 1, spans)
return ITALICS | REDUCE_RANGE
if(MODE_DEPARTMENT)
if (ears)
ears.talk_into(src, message, message_mode, spans)