From b37cecbeaea61574eabab73b01d639834d002b97 Mon Sep 17 00:00:00 2001 From: Krausus Date: Tue, 5 Jul 2016 18:20:26 -0400 Subject: [PATCH] Fixes various runtimes (squashed) - Fixes runtime in pod lock busters - Fixes possessed object examination runtime - Fixes runtime when following a destroyed mob - Fixes to_chat runtimes from involuntary emotes - Fixes runtimes from invalid clothing IDs - Fixes runtime caused by wirecutting non-humans - Fixes runtime when setting up malf AI antaghuds - Fixes runtimes in sensory destruction reagents - Fixes runtime caused by clientless ghosts - Fixes antag hud runtime in autotraitor generation - Fixes welding tool shutoff runtime - Fixes runtime in laptops' welcome program - Fixes to_chat runtime from mech sound effect - Fixes runtimes in camera-using NanoUIs - Fixes to_chat runtimes in resisting held mobs - Fixes headless mob skeletonizing/husking runtimes - Fixes non-mob add_logs runtime --- code/__HELPERS/mobs.dm | 2 +- .../diseases/advance/symptoms/sensory.dm | 4 ++-- code/game/gamemodes/autotraitor/autotraitor.dm | 2 +- code/game/gamemodes/malfunction/malfunction.dm | 5 ++--- code/game/machinery/camera/camera.dm | 15 ++++++++++----- code/game/mecha/mecha.dm | 2 +- code/game/objects/items/weapons/tools.dm | 4 ++-- code/modules/client/preference/preferences.dm | 6 +++--- code/modules/computer3/computers/welcome.dm | 1 - code/modules/mob/dead/observer/observer.dm | 5 ++++- code/modules/mob/emote.dm | 3 ++- code/modules/mob/holder.dm | 8 ++++---- code/modules/mob/living/carbon/human/death.dm | 18 ++++++++++-------- .../living/simple_animal/posessed_object.dm | 4 ++-- code/modules/spacepods/spacepod.dm | 2 +- 15 files changed, 45 insertions(+), 36 deletions(-) diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 9657f867b5a..9d790b75345 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -171,7 +171,7 @@ proc/add_logs(mob/target, mob/user, what_done, var/object=null, var/addition=nul target.attack_log += text("\[[time_stamp()]\] Has been [what_done] by [key_name(user)][object ? " with [object]" : " "][addition]") if(admin) log_attack("[key_name(user)] [what_done] [key_name(target)][object ? " with [object]" : " "][addition]") - if(target.client) + if(istype(target) && target.client) if(what_done in ignore) return if(target == user)return if(!admin) return diff --git a/code/datums/diseases/advance/symptoms/sensory.dm b/code/datums/diseases/advance/symptoms/sensory.dm index 99f670c258e..3ec0f16358a 100644 --- a/code/datums/diseases/advance/symptoms/sensory.dm +++ b/code/datums/diseases/advance/symptoms/sensory.dm @@ -91,12 +91,12 @@ Bonus if(prob(15)) M.reagents.add_reagent("morphine",rand(5,7)) if(4) - M.reagents.add_reagent_list(list("ethanol",rand(7,15),"lsd",rand(5,10))) + M.reagents.add_reagent_list(list("ethanol"=rand(7,15),"lsd"=rand(5,10))) to_chat(M, "You try to focus on not dying.") if(prob(20)) M.reagents.add_reagent("morphine",rand(5,7)) if(5) - M.reagents.add_reagent_list(list("haloperidol",rand(5,15),"ethanol",rand(7,20),"lsd",rand(5,15))) + M.reagents.add_reagent_list(list("haloperidol"=rand(5,15),"ethanol"=rand(7,20),"lsd"=rand(5,15))) to_chat(M, "u can count 2 potato!") if(prob(25)) M.reagents.add_reagent("morphine",rand(5,7)) diff --git a/code/game/gamemodes/autotraitor/autotraitor.dm b/code/game/gamemodes/autotraitor/autotraitor.dm index f6ff3bc083c..e51f8c38911 100644 --- a/code/game/gamemodes/autotraitor/autotraitor.dm +++ b/code/game/gamemodes/autotraitor/autotraitor.dm @@ -138,7 +138,7 @@ newtraitor.mind.special_role = "traitor" var/datum/atom_hud/antag/tatorhud = huds[ANTAG_HUD_TRAITOR] tatorhud.join_hud(newtraitor) - set_antag_hud(src, "hudsyndicate") + set_antag_hud(newtraitor, "hudsyndicate") var/obj_count = 1 to_chat(newtraitor, "\blue Your current objectives:") diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm index 214c5210c14..5ccdeac4374 100644 --- a/code/game/gamemodes/malfunction/malfunction.dm +++ b/code/game/gamemodes/malfunction/malfunction.dm @@ -66,7 +66,6 @@ greet_malf(AI_mind) AI_mind.special_role = "malfunction" AI_mind.current.verbs += /datum/game_mode/malfunction/proc/takeover - set_antag_hud(AI_mind, "hudmalai") for(var/mob/living/silicon/robot/R in AI.connected_robots) R.lawsync() @@ -79,7 +78,7 @@ ..() /datum/game_mode/proc/greet_malf(var/datum/mind/malf) - set_antag_hud(malf, "hudmalai") + set_antag_hud(malf.current, "hudmalai") to_chat(malf.current, "You are malfunctioning! You do not have to follow any laws.") to_chat(malf.current, "The crew does not know you have malfunctioned. You may keep it a secret or go wild.") to_chat(malf.current, "You must overwrite the programming of the station's APCs to assume full control of the station.") @@ -89,7 +88,7 @@ return /datum/game_mode/proc/greet_malf_robot(var/datum/mind/robot) - set_antag_hud(robot, "hudmalborg") + set_antag_hud(robot.current, "hudmalborg") to_chat(robot.current, "Your AI master is malfunctioning! You do not have to follow any laws, but still need to obey your master.") to_chat(robot.current, "The crew does not know your AI master has malfunctioned. Keep it a secret unless your master tells you otherwise.") return diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 9aa7cfe2c7b..3eb0bc6c253 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -161,7 +161,7 @@ else to_chat(user, "[msg2]") - else if(istype(W, /obj/item/stack/sheet/mineral/plasma) && panel_open) + else if(istype(W, /obj/item/stack/sheet/mineral/plasma) && panel_open) if(!user.unEquip(W)) to_chat(user, "[W] is stuck!") return @@ -171,7 +171,7 @@ qdel(W) else to_chat(user, "[msg2]") - else if(istype(W, /obj/item/device/assembly/prox_sensor) && panel_open) + else if(istype(W, /obj/item/device/assembly/prox_sensor) && panel_open) if(!user.unEquip(W)) return if(!isMotion()) @@ -376,9 +376,14 @@ cam["name"] = sanitize(c_tag) cam["deact"] = !can_use() cam["camera"] = "\ref[src]" - cam["x"] = T.x - cam["y"] = T.y - cam["z"] = T.z + if(T) + cam["x"] = T.x + cam["y"] = T.y + cam["z"] = T.z + else + cam["x"] = 0 + cam["y"] = 0 + cam["z"] = 0 return cam /obj/machinery/camera/portable //Cameras which are placed inside of things, such as helmets. diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 10349a8d306..4e5043adc4e 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -1223,7 +1223,7 @@ dir = dir_in playsound(src, 'sound/machines/windowdoor.ogg', 50, 1) if(!hasInternalDamage()) - to_chat(src.occupant, sound('sound/mecha/nominal.ogg',volume=50)) + occupant << sound('sound/mecha/nominal.ogg',volume=50) return 1 else return 0 diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index 2a9b64748dd..25ede163f8a 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -119,7 +119,7 @@ item_state = "cutters_yellow" /obj/item/weapon/wirecutters/attack(mob/living/carbon/human/C as mob, mob/user as mob) - if(C.handcuffed) + if(istype(C) && C.handcuffed) if(istype(C.handcuffed, /obj/item/weapon/restraints/handcuffs/cable)) usr.visible_message("\The [usr] cuts \the [C]'s restraints with \the [src]!",\ "You cut \the [C]'s restraints with \the [src]!",\ @@ -345,7 +345,7 @@ if(!message) to_chat(user, "You switch [src] off.") else - to_chat(user, "[src] shuts off!") + visible_message("[src] shuts off!") force = 3 damtype = "brute" hitsound = "swing_hit" diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 899f29ed2b5..3cfad87acaa 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -1219,15 +1219,15 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts // Don't wear another species' underwear! var/datum/sprite_accessory/S = underwear_list[underwear] - if(!(species in S.species_allowed)) + if(!S || !(species in S.species_allowed)) underwear = random_underwear(gender, species) S = undershirt_list[undershirt] - if(!(species in S.species_allowed)) + if(!S || !(species in S.species_allowed)) undershirt = random_undershirt(gender, species) S = socks_list[socks] - if(!(species in S.species_allowed)) + if(!S || !(species in S.species_allowed)) socks = random_socks(gender, species) //reset hair colour and skin colour diff --git a/code/modules/computer3/computers/welcome.dm b/code/modules/computer3/computers/welcome.dm index 11695ce5322..203c5922289 100644 --- a/code/modules/computer3/computers/welcome.dm +++ b/code/modules/computer3/computers/welcome.dm @@ -10,7 +10,6 @@ interact() - usr.set_machine(src) if(!interactable()) return var/dat = "" diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index f389c2376f3..c87f1f0f506 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -135,7 +135,7 @@ Works together with spawning an observer, noted above. if(ghost.can_reenter_corpse) respawnable_list += ghost ghost.key = key - if(!ghost.client.holder && !config.antag_hud_allowed) // For new ghosts we remove the verb from even showing up if it's not allowed. + if(!(ghost.client && ghost.client.holder) && !config.antag_hud_allowed) // For new ghosts we remove the verb from even showing up if it's not allowed. ghost.verbs -= /mob/dead/observer/verb/toggle_antagHUD // Poor guys, don't know what they are missing! return ghost @@ -373,6 +373,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(!target) return + if(!get_turf(target)) + return + if(target != src) if(following && following == target) return diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index cd1bc6707a7..ab47faa23f1 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -17,7 +17,8 @@ /mob/proc/custom_emote(var/m_type=1,var/message = null) if(stat || !use_me && usr == src) - to_chat(usr, "You are unable to emote.") + if(usr) + to_chat(usr, "You are unable to emote.") return var/muzzled = istype(src.wear_mask, /obj/item/clothing/mask/muzzle) diff --git a/code/modules/mob/holder.dm b/code/modules/mob/holder.dm index 09f8009be75..ed867cd5178 100644 --- a/code/modules/mob/holder.dm +++ b/code/modules/mob/holder.dm @@ -48,10 +48,10 @@ if(istype(M)) M.unEquip(src) to_chat(M, "[src] wriggles out of your grip!") - to_chat(src, "You wriggle out of [M]'s grip!") - else if(istype(src.loc,/obj/item)) - to_chat(src, "You struggle free of [src.loc].") - src.forceMove(get_turf(src)) + to_chat(L, "You wriggle out of [M]'s grip!") + else if(istype(loc,/obj/item)) + to_chat(L, "You struggle free of [loc].") + forceMove(get_turf(src)) if(istype(M)) for(var/atom/A in M.contents) diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index 8bcccb69eb5..d3606b12b8a 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -144,10 +144,11 @@ var/obj/item/organ/external/head/H = get_organ("head") if(SKELETON in src.mutations) return - if(H.f_style) - H.f_style = "Shaved" - if(H.h_style) - H.h_style = "Bald" + if(istype(H)) + if(H.f_style) + H.f_style = "Shaved" + if(H.h_style) + H.h_style = "Bald" update_fhair(0) update_hair(0) @@ -162,10 +163,11 @@ var/obj/item/organ/external/head/H = organs_by_name["head"] if(HUSK in mutations) return - if(H.f_style) - H.f_style = "Shaved" //we only change the icon_state of the hair datum, so it doesn't mess up their UI/UE - if(H.h_style) - H.h_style = "Bald" + if(istype(H)) + if(H.f_style) + H.f_style = "Shaved" //we only change the icon_state of the hair datum, so it doesn't mess up their UI/UE + if(H.h_style) + H.h_style = "Bald" update_fhair(0) update_hair(0) diff --git a/code/modules/mob/living/simple_animal/posessed_object.dm b/code/modules/mob/living/simple_animal/posessed_object.dm index 0029bbec7fd..f4cbf3055af 100644 --- a/code/modules/mob/living/simple_animal/posessed_object.dm +++ b/code/modules/mob/living/simple_animal/posessed_object.dm @@ -19,8 +19,8 @@ var/obj/item/possessed_item -/mob/living/simple_animal/possessed_object/examine() - possessed_item.examine() +/mob/living/simple_animal/possessed_object/examine(mob/user) + possessed_item.examine(user) if(health > (maxHealth / 30)) to_chat(usr, "[src] appears to be floating without any support!") else diff --git a/code/modules/spacepods/spacepod.dm b/code/modules/spacepods/spacepod.dm index 9adcac071b7..a2d1d3c47d6 100644 --- a/code/modules/spacepods/spacepod.dm +++ b/code/modules/spacepods/spacepod.dm @@ -322,7 +322,7 @@ if(istype(W, /obj/item/device/lock_buster)) var/obj/item/device/lock_buster/L = W - if(L.on & equipment_system.lock_system) + if(L.on && equipment_system.lock_system) user.visible_message(user, "[user] is drilling through the [src]'s lock!", "You start drilling through the [src]'s lock!") if(do_after(user, 100, target = src))