From 6d49e1f0d1deb02b524314fd34dacfdd7317bdc6 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 26 Oct 2020 09:11:16 +0100 Subject: [PATCH] [MIRROR] Fixes AI upgrades not being applied correctly (#1469) * Fixes AI upgrades not being applied correctly (#54589) Fixes AI upgrades not applying: due to the item's afterattack() proc never being called due to the attack chain ending early due to the AI's attackby() proc returning true Anyway, easiest way to fix it was to change the item to use pre_attack() instead. * Fixes AI upgrades not being applied correctly Co-authored-by: zxaber <37497534+zxaber@users.noreply.github.com> --- code/game/objects/items/robot/ai_upgrades.dm | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/code/game/objects/items/robot/ai_upgrades.dm b/code/game/objects/items/robot/ai_upgrades.dm index 39aff96c62c..b434ad34949 100644 --- a/code/game/objects/items/robot/ai_upgrades.dm +++ b/code/game/objects/items/robot/ai_upgrades.dm @@ -9,12 +9,12 @@ icon_state = "datadisk3" -/obj/item/malf_upgrade/afterattack(mob/living/silicon/ai/AI, mob/user, proximity) - . = ..() +/obj/item/malf_upgrade/pre_attack(atom/A, mob/living/user, proximity) if(!proximity) - return - if(!istype(AI)) - return + return ..() + if(!isAI(A)) + return ..() + var/mob/living/silicon/ai/AI = A if(AI.malf_picker) AI.malf_picker.processing_time += 50 to_chat(AI, "[user] has attempted to upgrade you with combat software that you already possess. You gain 50 points to spend on Malfunction Modules instead.") @@ -27,6 +27,7 @@ message_admins("[ADMIN_LOOKUPFLW(user)] has upgraded [ADMIN_LOOKUPFLW(AI)] with a [src].") to_chat(user, "You upgrade [AI]. [src] is consumed in the process.") qdel(src) + return TRUE //Lipreading @@ -36,12 +37,12 @@ icon = 'icons/obj/module.dmi' icon_state = "datadisk3" -/obj/item/surveillance_upgrade/afterattack(mob/living/silicon/ai/AI, mob/user, proximity) - . = ..() +/obj/item/surveillance_upgrade/pre_attack(atom/A, mob/living/user, proximity) if(!proximity) - return - if(!istype(AI)) - return + return ..() + if(!isAI(A)) + return ..() + var/mob/living/silicon/ai/AI = A if(AI.eyeobj) AI.eyeobj.relay_speech = TRUE to_chat(AI, "[user] has upgraded you with surveillance software!") @@ -50,3 +51,4 @@ log_game("[key_name(user)] has upgraded [key_name(AI)] with a [src].") message_admins("[ADMIN_LOOKUPFLW(user)] has upgraded [ADMIN_LOOKUPFLW(AI)] with a [src].") qdel(src) + return TRUE