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.
This commit is contained in:
John Willard
2021-12-28 18:15:33 -05:00
committed by GitHub
parent a4929f6914
commit f3ea83e4d9
7 changed files with 23 additions and 25 deletions
@@ -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
@@ -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
@@ -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))
@@ -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(!..())
@@ -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"]))
@@ -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)
@@ -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()