From f01b5b6ff3c8b37b553d13ab0ea50f4a80c23866 Mon Sep 17 00:00:00 2001 From: VerySoft Date: Fri, 18 Feb 2022 18:36:53 -0500 Subject: [PATCH] Fix a runtime with capture crystals You can't tell a mob with no client or AI holder to follow you. --- .../objects/items/weapons/capture_crystal.dm | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/code/game/objects/items/weapons/capture_crystal.dm b/code/game/objects/items/weapons/capture_crystal.dm index 5e492eec349..d9c4d79a3dd 100644 --- a/code/game/objects/items/weapons/capture_crystal.dm +++ b/code/game/objects/items/weapons/capture_crystal.dm @@ -99,6 +99,10 @@ else if(bound_mob.client) to_chat(bound_mob, "\The [owner] wishes for you to follow them.") else if(bound_mob in contents) + if(!bound_mob.ai_holder) + to_chat(M, "\The [src] emits an unpleasant tone... \The [bound_mob] is not able to follow your command.") + playsound(src, 'sound/effects/capture-crystal-negative.ogg', 75, 1, -1) + return var/datum/ai_holder/AI = bound_mob.ai_holder if(AI.leader) to_chat(M, "\The [src] chimes~ \The [bound_mob] stopped following [AI.leader].") @@ -109,13 +113,17 @@ else if(!(bound_mob in view(M))) to_chat(M, "\The [src] emits an unpleasant tone... \The [bound_mob] is not able to hear your command.") playsound(src, 'sound/effects/capture-crystal-negative.ogg', 75, 1, -1) - var/datum/ai_holder/AI = bound_mob.ai_holder - if(AI.leader) - to_chat(M, "\The [src] chimes~ \The [bound_mob] stopped following [AI.leader].") - AI.lose_follow(AI.leader) - else - AI.set_follow(M) - to_chat(M, "\The [src] chimes~ \The [bound_mob] started following following [AI.leader].") + if(!bound_mob.ai_holder) + to_chat(M, "\The [src] emits an unpleasant tone... \The [bound_mob] is not able to follow your command.") + playsound(src, 'sound/effects/capture-crystal-negative.ogg', 75, 1, -1) + return + var/datum/ai_holder/AI = bound_mob.ai_holder + if(AI.leader) + to_chat(M, "\The [src] chimes~ \The [bound_mob] stopped following [AI.leader].") + AI.lose_follow(AI.leader) + else + AI.set_follow(M) + to_chat(M, "\The [src] chimes~ \The [bound_mob] started following following [AI.leader].") //Don't really want people 'haha funny' capturing and releasing one another willy nilly. So! If you wanna release someone, you gotta destroy the thingy. //(Which is consistent with how it works with digestion anyway.)