From 23ae9996d29cba585bca42f6a80693ccd8005616 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sun, 16 Feb 2020 15:24:15 +0100 Subject: [PATCH] Something more about runtime errors. --- code/game/objects/items/implants/implant_hijack.dm | 10 +++++----- code/modules/antagonists/clockcult/clockcult.dm | 11 +++++++---- code/modules/mob/living/carbon/human/human.dm | 2 +- code/modules/mob/living/carbon/human/human_defense.dm | 2 +- code/modules/mob/living/carbon/inventory.dm | 2 +- code/modules/mob/living/simple_animal/bot/bot.dm | 9 ++++++--- code/modules/mob/living/simple_animal/bot/mulebot.dm | 4 ++-- .../xenobiology/crossbreeding/_status_effects.dm | 4 ++-- 8 files changed, 25 insertions(+), 19 deletions(-) diff --git a/code/game/objects/items/implants/implant_hijack.dm b/code/game/objects/items/implants/implant_hijack.dm index 8a08232859..64da439bdc 100644 --- a/code/game/objects/items/implants/implant_hijack.dm +++ b/code/game/objects/items/implants/implant_hijack.dm @@ -37,18 +37,18 @@ eye_color = H.eye_color return TRUE -/obj/item/implant/hijack/removed(mob/target, silent = FALSE, special = 0) +/obj/item/implant/hijack/removed(mob/living/source, silent = FALSE, special = 0) if(..()) REMOVE_TRAIT(target, TRAIT_HIJACKER, "implant") - for (var/area/area in imp_in.siliconaccessareas) - imp_in.toggleSiliconAccessArea(area) + for (var/area/area in source.siliconaccessareas) + source.toggleSiliconAccessArea(area) var/obj/machinery/power/apc/apc = area.get_apc() if (apc) apc.hijacker = null apc.set_hijacked_lighting() apc.update_icon() - if (ishuman(target)) - var/mob/living/carbon/human/H = target + if (ishuman(source)) + var/mob/living/carbon/human/H = source H.eye_color = eye_color return TRUE diff --git a/code/modules/antagonists/clockcult/clockcult.dm b/code/modules/antagonists/clockcult/clockcult.dm index d68e9b594d..1869414ab6 100644 --- a/code/modules/antagonists/clockcult/clockcult.dm +++ b/code/modules/antagonists/clockcult/clockcult.dm @@ -120,7 +120,7 @@ hierophant_network.Grant(current) current.throw_alert("clockinfo", /obj/screen/alert/clockwork/infodump) var/obj/structure/destructible/clockwork/massive/celestial_gateway/G = GLOB.ark_of_the_clockwork_justiciar - if(G.active && ishuman(current)) + if(G && G.active && ishuman(current)) current.add_overlay(mutable_appearance('icons/effects/genetics.dmi', "servitude", -MUTATIONS_LAYER)) /datum/antagonist/clockcult/remove_innate_effects(mob/living/mob_override) @@ -174,9 +174,12 @@ log_admin("[key_name(admin)] has made [new_owner.current] into a servant of Ratvar.") /datum/antagonist/clockcult/admin_remove(mob/user) - remove_servant_of_ratvar(owner.current, TRUE) - message_admins("[key_name_admin(user)] has removed clockwork servant status from [owner.current].") - log_admin("[key_name(user)] has removed clockwork servant status from [owner.current].") + var/mob/target = owner.current + if(!target) + return + remove_servant_of_ratvar(target, TRUE) + message_admins("[key_name_admin(user)] has removed clockwork servant status from [target].") + log_admin("[key_name(user)] has removed clockwork servant status from [target].") /datum/antagonist/clockcult/get_admin_commands() . = ..() diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index ef3d4cbb98..e2317354df 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -834,7 +834,7 @@ ..() /mob/living/carbon/human/vomit(lost_nutrition = 10, blood = 0, stun = 1, distance = 0, message = 1, toxic = 0) - if(blood && (NOBLOOD in dna.species.species_traits)) + if(blood && dna?.species && (NOBLOOD in dna.species.species_traits)) if(message) visible_message("[src] dry heaves!", \ "You try to throw up, but there's nothing in your stomach!") diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index accaab3ac1..57b8f59780 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -20,7 +20,7 @@ /mob/living/carbon/human/proc/checkarmor(obj/item/bodypart/def_zone, d_type) - if(!d_type) + if(!d_type || !def_zone) return 0 var/protection = 0 var/list/body_parts = list(head, wear_mask, wear_suit, w_uniform, back, gloves, shoes, belt, s_store, glasses, ears, wear_id, wear_neck) //Everything but pockets. Pockets are l_store and r_store. (if pockets were allowed, putting something armored, gloves or hats for example, would double up on the armor) diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm index bbae050bba..24acccdd2e 100644 --- a/code/modules/mob/living/carbon/inventory.dm +++ b/code/modules/mob/living/carbon/inventory.dm @@ -72,7 +72,7 @@ put_in_hands(I) update_inv_hands() if(SLOT_IN_BACKPACK) - if(!SEND_SIGNAL(back, COMSIG_TRY_STORAGE_INSERT, I, src, TRUE)) + if(!back || !SEND_SIGNAL(back, COMSIG_TRY_STORAGE_INSERT, I, src, TRUE)) not_handled = TRUE else not_handled = TRUE diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 7da0ad13da..8515aa4534 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -194,10 +194,12 @@ if(locked) //First emag application unlocks the bot's interface. Apply a screwdriver to use the emag again. locked = FALSE emagged = 1 - to_chat(user, "You bypass [src]'s controls.") + if(user) + to_chat(user, "You bypass [src]'s controls.") return TRUE if(!open) - to_chat(user, "You need to open maintenance panel first!") + if(user) + to_chat(user, "You need to open maintenance panel first!") return emagged = 2 remote_disabled = 1 //Manually emagging the bot locks out the AI built in panel. @@ -205,7 +207,8 @@ bot_reset() turn_on() //The bot automatically turns on when emagged, unless recently hit with EMP. to_chat(src, "(#$*#$^^( OVERRIDE DETECTED") - log_combat(user, src, "emagged") + if(user) + log_combat(user, src, "emagged") return TRUE /mob/living/simple_animal/bot/examine(mob/user) diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index b23f3f2baa..bc8a5e07d5 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -123,7 +123,8 @@ emagged = TRUE if(!open) locked = !locked - to_chat(user, "You [locked ? "lock" : "unlock"] [src]'s controls!") + if(user) + to_chat(user, "You [locked ? "lock" : "unlock"] [src]'s controls!") flick("mulebot-emagged", src) playsound(src, "sparks", 100, FALSE) @@ -766,4 +767,3 @@ /obj/machinery/bot_core/mulebot req_access = list(ACCESS_CARGO) - \ No newline at end of file diff --git a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm index 0838e70bfd..9efbe58a29 100644 --- a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm +++ b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm @@ -890,8 +890,8 @@ datum/status_effect/stabilized/blue/on_remove() healing_types += TOX if(owner.getCloneLoss() > 0) healing_types += CLONE - - owner.apply_damage_type(-heal_amount, damagetype=pick(healing_types)) + if(length(healing_types)) + owner.apply_damage_type(-heal_amount, damagetype=pick(healing_types)) owner.nutrition += 3 M.adjustCloneLoss(heal_amount * 1.2) //This way, two people can't just convert each other's damage away. else