From f3ea83e4d9e425cef9e2c8ff53de3322e3ef6a55 Mon Sep 17 00:00:00 2001 From: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Tue, 28 Dec 2021 18:15:33 -0500 Subject: [PATCH] Fixes some reported bugs for Mules/Bots (#63138) Bots will now allow pAI's to be placed in them again MULEbots can be turned on/off again MULEbots' wires can now be interacted with again Closes #63133 (Can't turn on/off MULEbots) Closes #63101 (Can't put pais in new bots) Fixes bugs, improves code, I see no downside here. --- .../mob/living/simple_animal/bot/bot.dm | 16 ++++++------- .../mob/living/simple_animal/bot/cleanbot.dm | 2 +- .../mob/living/simple_animal/bot/firebot.dm | 2 +- .../mob/living/simple_animal/bot/floorbot.dm | 2 +- .../mob/living/simple_animal/bot/medbot.dm | 1 + .../mob/living/simple_animal/bot/mulebot.dm | 23 +++++++++---------- .../mob/living/simple_animal/bot/secbot.dm | 2 +- 7 files changed, 23 insertions(+), 25 deletions(-) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 8546d96900e..ee3319ac6f4 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -234,6 +234,8 @@ return TRUE if(!maints_access_required) // No requirements to access it. return TRUE + if(!(bot_cover_flags & BOT_COVER_LOCKED)) // Unlocked. + return TRUE var/obj/item/card/id/id_card = user.get_idcard(TRUE) if(!id_card || !id_card.access) @@ -421,9 +423,9 @@ else if(attacking_item.force) //if force is non-zero do_sparks(5, TRUE, src) - ..() + ..() -/mob/living/simple_animal/bot/bullet_act(obj/projectile/Proj) +/mob/living/simple_animal/bot/bullet_act(obj/projectile/Proj, def_zone, piercing_hit = FALSE) if(Proj && (Proj.damage_type == BRUTE || Proj.damage_type == BURN)) if(prob(75) && Proj.damage > 0) do_sparks(5, TRUE, src) @@ -907,9 +909,6 @@ Pass a positive integer as an argument to override a bot's default speed. if(action == "lock") bot_cover_flags ^= BOT_COVER_LOCKED - if(bot_cover_flags & BOT_COVER_LOCKED && !(issilicon(usr) || isAdminGhostAI(usr))) - return - switch(action) if("power") if(bot_mode_flags & BOT_MODE_ON) @@ -943,7 +942,6 @@ Pass a positive integer as an argument to override a bot's default speed. if(paicard) to_chat(usr, span_notice("You eject [paicard] from [initial(src.name)].")) ejectpai(usr) - return /mob/living/simple_animal/bot/update_icon_state() icon_state = "[initial(icon_state)][get_bot_flag(bot_mode_flags, BOT_MODE_ON)]" @@ -964,12 +962,12 @@ Pass a positive integer as an argument to override a bot's default speed. if(paicard) to_chat(user, span_warning("A [paicard] is already inserted!")) return - if(!(bot_mode_flags & BOT_MODE_PAI_CONTROLLABLE) || !key) - to_chat(user, span_warning("[src] is not compatible with [card]!")) - return if(bot_cover_flags & BOT_COVER_LOCKED || !(bot_cover_flags & BOT_COVER_OPEN)) to_chat(user, span_warning("The personality slot is locked.")) return + if(!(bot_mode_flags & BOT_MODE_PAI_CONTROLLABLE) || key) //Not pAI controllable or is already player controlled. + to_chat(user, span_warning("[src] is not compatible with [card]!")) + return if(!card.pai || !card.pai.mind) to_chat(user, span_warning("[card] is inactive.")) return diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 0e12392a93d..988d5eb7f29 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -386,6 +386,7 @@ . = ..() if(. || (bot_cover_flags & BOT_COVER_LOCKED && !usr.has_unlimited_silicon_privilege)) return + switch(action) if("clean_blood") blood = !blood @@ -396,4 +397,3 @@ if("clean_graffiti") drawn = !drawn get_targets() - return diff --git a/code/modules/mob/living/simple_animal/bot/firebot.dm b/code/modules/mob/living/simple_animal/bot/firebot.dm index 5c4bd669223..af48f814350 100644 --- a/code/modules/mob/living/simple_animal/bot/firebot.dm +++ b/code/modules/mob/living/simple_animal/bot/firebot.dm @@ -135,6 +135,7 @@ . = ..() if(. || (bot_cover_flags & BOT_COVER_LOCKED && !usr.has_unlimited_silicon_privilege)) return + switch(action) if("extinguish_fires") extinguish_fires = !extinguish_fires @@ -143,7 +144,6 @@ if("stationary_mode") stationary_mode = !stationary_mode update_appearance() - return /mob/living/simple_animal/bot/firebot/proc/is_burning(atom/target) if(ismob(target)) diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index ad5db8b15ba..08f2ed34d26 100644 --- a/code/modules/mob/living/simple_animal/bot/floorbot.dm +++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm @@ -146,6 +146,7 @@ . = ..() if(. || (bot_cover_flags & BOT_COVER_LOCKED && !usr.has_unlimited_silicon_privilege)) return + switch(action) if("place_custom") replacetiles = !replacetiles @@ -173,7 +174,6 @@ targetdirection = 8 if("disable") targetdirection = null - return /mob/living/simple_animal/bot/floorbot/handle_automated_action() if(!..()) diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index d815ec907d9..85e311fec0c 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -182,6 +182,7 @@ . = ..() if(. || (bot_cover_flags & BOT_COVER_LOCKED && !usr.has_unlimited_silicon_privilege)) return + switch(action) if("heal_threshold") var/adjust_num = round(text2num(params["threshold"])) diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index 33e3e0970d2..dd96ead5d84 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -130,6 +130,14 @@ /mob/living/simple_animal/bot/mulebot/proc/has_power() return cell && cell.charge > 0 && (!wires.is_cut(WIRE_POWER1) && !wires.is_cut(WIRE_POWER2)) +/mob/living/simple_animal/bot/mulebot/attack_hand(mob/living/carbon/human/user, list/modifiers) + if(bot_cover_flags & BOT_COVER_OPEN && !isAI(user)) + wires.interact(user) + return + if(wires.is_cut(WIRE_RX) && isAI(user)) + return + + . = ..() /mob/living/simple_animal/bot/mulebot/proc/set_id(new_id) id = new_id @@ -224,14 +232,6 @@ visible_message(span_danger("Something shorts out inside [src]!")) wires.cut_random() -/mob/living/simple_animal/bot/mulebot/interact(mob/user) - if(bot_cover_flags & BOT_COVER_OPEN && !isAI(user)) - wires.interact(user) - else - if(wires.is_cut(WIRE_RX) && isAI(user)) - return - ui_interact(user) - /mob/living/simple_animal/bot/mulebot/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) if(!ui) @@ -240,8 +240,8 @@ /mob/living/simple_animal/bot/mulebot/ui_data(mob/user) var/list/data = list() - data["on"] = get_bot_flag(BOT_MODE_ON) - data["locked"] = get_bot_flag(BOT_COVER_LOCKED) + data["on"] = bot_mode_flags & BOT_MODE_ON + data["locked"] = bot_cover_flags & BOT_COVER_LOCKED data["siliconUser"] = user.has_unlimited_silicon_privilege data["mode"] = mode ? mode_name[mode] : "Ready" data["modeStatus"] = "" @@ -267,7 +267,6 @@ /mob/living/simple_animal/bot/mulebot/ui_act(action, params) . = ..() - if(. || (bot_cover_flags & BOT_COVER_LOCKED && !usr.has_unlimited_silicon_privilege)) return @@ -288,7 +287,7 @@ return . = TRUE else - bot_control(action, usr, params) // Kill this later. + bot_control(action, usr, params) // Kill this later. // Kill PDAs in general please . = TRUE /mob/living/simple_animal/bot/mulebot/bot_control(command, mob/user, list/params = list(), pda = FALSE) diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index 05507e9c924..ca2375dbc09 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -160,6 +160,7 @@ . = ..() if(. || (bot_cover_flags & BOT_COVER_LOCKED && !usr.has_unlimited_silicon_privilege)) return + switch(action) if("check_id") security_mode_flags ^= SECBOT_CHECK_IDS @@ -171,7 +172,6 @@ security_mode_flags ^= SECBOT_HANDCUFF_TARGET if("arrest_alert") security_mode_flags ^= SECBOT_DECLARE_ARRESTS - return /mob/living/simple_animal/bot/secbot/proc/retaliate(mob/living/carbon/human/attacking_human) var/judgement_criteria = judgement_criteria()