From b9162fbb3e6a0b8a69d7b713ca1fcfaaa60529ad Mon Sep 17 00:00:00 2001 From: Fayrik Date: Fri, 29 Jan 2016 07:31:33 +0000 Subject: [PATCH] Tweaked card ejection slightly. --- code/game/objects/items/devices/PDA/cart.dm | 10 +++- .../mob/living/simple_animal/bot/bot.dm | 57 +++++++++++++------ .../mob/living/simple_animal/bot/mulebot.dm | 10 +++- 3 files changed, 57 insertions(+), 20 deletions(-) diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm index ff8428ffb48..658feefb2cb 100644 --- a/code/game/objects/items/devices/PDA/cart.dm +++ b/code/game/objects/items/devices/PDA/cart.dm @@ -704,7 +704,7 @@ Code: if("summon") //Args are in the correct order, they are stated here just as an easy reminder. active_bot.bot_control(command= "summon", user_turf= get_turf(usr), user_access= pda.GetAccess()) else //Forward all other bot commands to the bot itself! - active_bot.bot_control(command= href_list["op"]) + active_bot.bot_control(command= href_list["op"], user= usr) if(href_list["mule"]) //MULEbots are special snowflakes, and need different args due to how they work. @@ -728,6 +728,14 @@ Code: menu += "Model: [active_bot.model]
" menu += "Location: [get_area(active_bot)]
" menu += "Mode: [active_bot.get_mode()]" + if(active_bot.allow_pai) + menu += "
PAI: " + if(active_bot.paicard && active_bot.paicard.pai) + menu += "[active_bot.paicard.pai.name]" + if(active_bot.bot_core.allowed(usr)) + menu += " (eject)" + else + menu += "none" //MULEs! if(active_bot.bot_type == MULE_BOT) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index dcb4055e7e4..184b8aaf8d8 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -252,17 +252,22 @@ bot_name = name name = paicard.pai.name else - user << "This [W] is inactive." + user << "[W] is inactive." else user << "The personality slot is locked." else user << "[src] is not compatible with [W]" - else if (istype(W, /obj/item/weapon/hemostat) && !locked && !isnull(paicard) && user.a_intent != "harm") + else if (istype(W, /obj/item/weapon/hemostat) && !isnull(paicard)) if (open) user << "Close the access panel before manipulating the personality slot!" else - user.visible_message("[user] uses [W] to pry [paicard] out of [bot_name]!","You pry [paicard] out of [bot_name] with [W].") - ejectpai() + var/T = user.loc + user << "You attempt to pull [paicard] free..." + if(do_after(user, 30, target = src)) + if(istype(src, /mob/living/simple_animal/bot) && user && W && T) + if(user.get_active_hand() == W && user.loc == T) //The insanity of sanity checks, folks. + user.visible_message("[user] uses [W] to pull [paicard] out of [bot_name]!","You pull [paicard] out of [bot_name] with [W].") + ejectpai() else user.changeNext_move(CLICK_CD_MELEE) if(istype(W, /obj/item/weapon/weldingtool) && user.a_intent != "harm") @@ -523,6 +528,9 @@ Pass a positive integer as an argument to override a bot's default speed. /mob/living/simple_animal/bot/proc/patrol_step() + if(client) // In use by player, don't actually move. + return + if(loc == patrol_target) // reached target //Find the next beacon matching the target. if(!get_next_patrol_target()) @@ -629,6 +637,12 @@ Pass a positive integer as an argument to override a bot's default speed. speak("Responding.", radio_channel) calc_summon_path() return + + if("ejectpai") + if(bot_core.allowed(user) && !isnull(paicard)) + speak("Ejecting personality chip.", radio_channel) + ejectpai() + return return // @@ -649,6 +663,8 @@ Pass a positive integer as an argument to override a bot's default speed. if("home") src << "RETURN HOME!" + if("ejectpai") + return else src << "Unidentified control sequence recieved:[command]" @@ -673,6 +689,9 @@ Pass a positive integer as an argument to override a bot's default speed. /mob/living/simple_animal/bot/proc/summon_step() + if(client) // In use by player, don't actually move. + return + if(loc == summon_target) // Arrived to summon location. bot_reset() return @@ -769,7 +788,7 @@ Pass a positive integer as an argument to override a bot's default speed. usr << "[text_dehack]" bot_reset() if("ejectpai") - if (!isnull(paicard) && (bot_core.allowed(usr) || !locked)) + if (!isnull(paicard) && (!locked || issilicon(usr) || IsAdminGhost(usr))) usr << "You eject [paicard] from [bot_name]" ejectpai() update_controls() @@ -810,25 +829,20 @@ Pass a positive integer as an argument to override a bot's default speed. /mob/living/simple_animal/bot/proc/showpai(mob/user) var/eject = "" - if(!isnull(paicard) || allow_pai) - eject += "Personality card status: " - if(!isnull(paicard)) - if(bot_core.allowed(usr) || !locked) + if((!locked || issilicon(usr) || IsAdminGhost(usr))) + if(!isnull(paicard) || allow_pai) + eject += "Personality card status: " + if(!isnull(paicard)) if(client) eject += "Active" else eject += "Inactive" + else if (!allow_pai || !isnull(key)) + eject += "Unavailable" else - if(client) - eject += "Active" - else - eject += "Inactive" - else if (!allow_pai || !isnull(key)) - eject += "Unavailable" - else - eject += "Not inserted" + eject += "Not inserted" + eject += "
" eject += "
" - eject += "
" return eject /mob/living/simple_animal/bot/proc/ejectpai(announce = 1) @@ -856,3 +870,10 @@ Pass a positive integer as an argument to override a bot's default speed. /mob/living/simple_animal/bot/revive() ..() update_icon() + +/mob/living/simple_animal/bot/ghost() + if (stat != DEAD) // Only ghost if we're doing this while alive, the pAI probably isn't dead yet. + ..() + if (!isnull(paicard) && !isnull(paicard.pai)) + ejectpai(0) + diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index f7e39a9f132..424fb35cf1b 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -71,7 +71,10 @@ var/global/mulebot_count = 0 /mob/living/simple_animal/bot/mulebot/proc/set_suffix(suffix) src.suffix = suffix - name = "\improper MULEbot ([suffix])" + if (!isnull(paicard)) + bot_name = "\improper MULEbot ([suffix])" + else + name = "\improper MULEbot ([suffix])" /mob/living/simple_animal/bot/mulebot/bot_reset() ..() @@ -247,6 +250,11 @@ var/global/mulebot_count = 0 auto_pickup = !auto_pickup if("report") report_delivery = !report_delivery + if("ejectpai") + if(bot_core.allowed(user) && !isnull(paicard)) + speak("Ejecting personality chip.", radio_channel) + ejectpai() + return // TODO: remove this; PDAs currently depend on it /mob/living/simple_animal/bot/mulebot/get_controls(mob/user)