From b216ffe4577874442a4d9c59178eacba65f7df48 Mon Sep 17 00:00:00 2001 From: AnturK Date: Mon, 30 Nov 2015 13:54:13 +0100 Subject: [PATCH 1/2] Fixes Player bots moving while deactivated Fixes Player bot radios Removes unused HEADSET_SECURE radio mode Adds secbot/ed209 stuns to attack log Allows player mulebots to drop the cargo by resisting --- code/__DEFINES/say.dm | 1 - code/modules/mob/living/carbon/human/say.dm | 5 ---- .../mob/living/simple_animal/bot/bot.dm | 26 ++++++++++++++++++- .../mob/living/simple_animal/bot/ed209bot.dm | 6 ++++- .../mob/living/simple_animal/bot/mulebot.dm | 5 ++++ .../mob/living/simple_animal/bot/secbot.dm | 5 ++-- .../mob/living/simple_animal/parrot.dm | 5 ---- 7 files changed, 38 insertions(+), 15 deletions(-) diff --git a/code/__DEFINES/say.dm b/code/__DEFINES/say.dm index 8eae01b4869..472f85a6a1b 100644 --- a/code/__DEFINES/say.dm +++ b/code/__DEFINES/say.dm @@ -11,7 +11,6 @@ #define MODE_INTERCOM "intercom" #define MODE_BINARY "binary" #define MODE_WHISPER "whisper" -#define MODE_SECURE_HEADSET "secure headset" #define MODE_DEPARTMENT "department" #define MODE_ALIEN "alientalk" #define MODE_HOLOPAD "holopad" diff --git a/code/modules/mob/living/carbon/human/say.dm b/code/modules/mob/living/carbon/human/say.dm index 4e6ecfd507d..272222dc8ef 100644 --- a/code/modules/mob/living/carbon/human/say.dm +++ b/code/modules/mob/living/carbon/human/say.dm @@ -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) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index e49f6782062..27fc94a988a 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -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) @@ -149,6 +155,7 @@ locked = 1 //Access denied forever! bot_reset() turn_on() //The bot automatically turns on when emagged, unless recently hit with EMP. + src << "(#$*#$^^( OVERRIDE DETECTED" else //Bot is unlocked, but the maint panel has not been opened with a screwdriver yet. user << "You need to open maintenance panel first!" @@ -293,6 +300,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 +455,6 @@ Pass a positive integer as an argument to override a bot's default speed. - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Patrol and summon code! //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/code/modules/mob/living/simple_animal/bot/ed209bot.dm b/code/modules/mob/living/simple_animal/bot/ed209bot.dm index 925ffbfbe14..0151cf2e58b 100644 --- a/code/modules/mob/living/simple_animal/bot/ed209bot.dm +++ b/code/modules/mob/living/simple_animal/bot/ed209bot.dm @@ -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 [C] in [location].", radio_channel) diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index cedd06e6f3e..d4ff74d7fa6 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -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 diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index 0f8b9849e76..71dc09c7e40 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -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 [C] in [location].", radio_channel) diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index 2f6e8ac0f61..eb62324b13f 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -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) From a8ea3e25c1f90db5af5ec9231c183eceb147b7cd Mon Sep 17 00:00:00 2001 From: AnturK Date: Mon, 30 Nov 2015 16:43:43 +0100 Subject: [PATCH 2/2] 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)