From 54f32f26ad4e6c5bb7be5edada1622c23cc7f7f2 Mon Sep 17 00:00:00 2001 From: AnturK Date: Sat, 14 Dec 2019 20:15:15 +0100 Subject: [PATCH] Fixes few minor runtimes. (#48234) * Fixes emagging stuff without user * Fixes missing initalizes * Fixes deconstructing for materials * Fixes tracker bullets runtime. --- code/_onclick/hud/parallax.dm | 1 + code/game/machinery/cloning.dm | 3 ++- code/game/machinery/computer/apc_control.dm | 3 ++- code/game/machinery/medical_kiosk.dm | 5 +++-- code/game/objects/items/stacks/medical.dm | 2 +- code/game/objects/structures/crates_lockers/closets.dm | 7 ++++--- code/modules/cargo/console.dm | 5 +++-- code/modules/cargo/expressconsole.dm | 5 +++-- code/modules/clothing/masks/hailer.dm | 3 +-- code/modules/mob/living/silicon/robot/robot_defense.dm | 10 +++++++--- code/modules/mob/living/simple_animal/bot/bot.dm | 3 ++- .../modules/projectiles/projectile/bullets/revolver.dm | 2 ++ code/modules/research/destructive_analyzer.dm | 2 +- code/modules/shuttle/emergency.dm | 2 +- code/modules/surgery/organs/augments_arms.dm | 4 ++-- 15 files changed, 35 insertions(+), 22 deletions(-) diff --git a/code/_onclick/hud/parallax.dm b/code/_onclick/hud/parallax.dm index 6677e245dd0..630c4b3cc2b 100755 --- a/code/_onclick/hud/parallax.dm +++ b/code/_onclick/hud/parallax.dm @@ -308,6 +308,7 @@ icon_state = "space gas" /obj/screen/parallax_layer/random/space_gas/Initialize(mapload, view) + . = ..() src.add_atom_colour(SSparallax.random_parallax_color, ADMIN_COLOUR_PRIORITY) /obj/screen/parallax_layer/random/asteroids diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 4301749bbf0..0069f03294a 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -387,7 +387,8 @@ malfunction() add_fingerprint(user) log_cloning("[key_name(user)] emagged [src] at [AREACOORD(src)], causing it to malfunction.") - log_combat(user, src, "emagged", null, occupant ? "[occupant] inside, killing them via malfunction." : null) + if(user) + log_combat(user, src, "emagged", null, occupant ? "[occupant] inside, killing them via malfunction." : null) //Put messages in the connected computer's temp var for display. /obj/machinery/clonepod/proc/connected_message(message) diff --git a/code/game/machinery/computer/apc_control.dm b/code/game/machinery/computer/apc_control.dm index dc6330717c7..3034de97472 100644 --- a/code/game/machinery/computer/apc_control.dm +++ b/code/game/machinery/computer/apc_control.dm @@ -189,7 +189,8 @@ authenticated = TRUE log_activity("logged in") else if(!(obj_flags & EMAGGED)) - user.visible_message("You emag [src], disabling precise logging and allowing you to clear logs.") + if(user) + user.visible_message("You emag [src], disabling precise logging and allowing you to clear logs.") log_game("[key_name(user)] emagged [src] at [AREACOORD(src)], disabling operator tracking.") obj_flags |= EMAGGED playsound(src, "sparks", 50, TRUE) diff --git a/code/game/machinery/medical_kiosk.dm b/code/game/machinery/medical_kiosk.dm index 1f6ce1f4b69..b71b7e59572 100644 --- a/code/game/machinery/medical_kiosk.dm +++ b/code/game/machinery/medical_kiosk.dm @@ -134,11 +134,12 @@ qdel(scanner_wand) return ..() -/obj/machinery/medical_kiosk/emag_act(mob/living/emagger) +/obj/machinery/medical_kiosk/emag_act(mob/user) ..() if(obj_flags & EMAGGED) return - emagger.visible_message("[emagger] waves a suspicious card by the [src]'s biometric scanner!", + if(user) + user.visible_message("[user] waves a suspicious card by the [src]'s biometric scanner!", "You overload the sensory electronics, the diagnostic readouts start jittering across the screen..") obj_flags |= EMAGGED var/obj/item/circuitboard/computer/cargo/board = circuit diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index b9991b8528d..b3ad5c2f253 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -232,7 +232,7 @@ grind_results = list(/datum/reagent/medicine/spaceacillin = 2) /obj/item/stack/medical/mesh/Initialize() - ..() + . = ..() if(amount == max_amount) //only seal full mesh packs is_open = FALSE icon_state = "regen_mesh_closed" diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 6f1dc50f7d5..5428c2a50cb 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -440,9 +440,10 @@ /obj/structure/closet/emag_act(mob/user) if(secure && !broken) - user.visible_message("Sparks fly from [src]!", - "You scramble [src]'s lock, breaking it open!", - "You hear a faint electrical spark.") + if(user) + user.visible_message("Sparks fly from [src]!", + "You scramble [src]'s lock, breaking it open!", + "You hear a faint electrical spark.") playsound(src, "sparks", 50, TRUE) broken = TRUE locked = FALSE diff --git a/code/modules/cargo/console.dm b/code/modules/cargo/console.dm index 7b7d5baeab6..de75893da83 100644 --- a/code/modules/cargo/console.dm +++ b/code/modules/cargo/console.dm @@ -51,8 +51,9 @@ /obj/machinery/computer/cargo/emag_act(mob/user) if(obj_flags & EMAGGED) return - user.visible_message("[user] swipes a suspicious card through [src]!", - "You adjust [src]'s routing and receiver spectrum, unlocking special supplies and contraband.") + if(user) + user.visible_message("[user] swipes a suspicious card through [src]!", + "You adjust [src]'s routing and receiver spectrum, unlocking special supplies and contraband.") obj_flags |= EMAGGED contraband = TRUE diff --git a/code/modules/cargo/expressconsole.dm b/code/modules/cargo/expressconsole.dm index 7ea8151f615..af01a824684 100644 --- a/code/modules/cargo/expressconsole.dm +++ b/code/modules/cargo/expressconsole.dm @@ -59,8 +59,9 @@ /obj/machinery/computer/cargo/express/emag_act(mob/living/user) if(obj_flags & EMAGGED) return - user.visible_message("[user] swipes a suspicious card through [src]!", - "You change the routing protocols, allowing the Supply Pod to land anywhere on the station.") + if(user) + user.visible_message("[user] swipes a suspicious card through [src]!", + "You change the routing protocols, allowing the Supply Pod to land anywhere on the station.") obj_flags |= EMAGGED // This also sets this on the circuit board var/obj/item/circuitboard/computer/cargo/board = circuit diff --git a/code/modules/clothing/masks/hailer.dm b/code/modules/clothing/masks/hailer.dm index 0a9c5e5b51c..158d6965978 100644 --- a/code/modules/clothing/masks/hailer.dm +++ b/code/modules/clothing/masks/hailer.dm @@ -111,8 +111,7 @@ GLOBAL_LIST_INIT(hailer_phrases, list( /obj/item/clothing/mask/gas/sechailer/attack_self() halt() - -/obj/item/clothing/mask/gas/sechailer/emag_act(mob/user as mob) +/obj/item/clothing/mask/gas/sechailer/emag_act(mob/user) if(safety) safety = FALSE to_chat(user, "You silently fry [src]'s vocal circuit with the cryptographic sequencer.") diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm index 09c9a659e32..dcc5219f623 100644 --- a/code/modules/mob/living/silicon/robot/robot_defense.dm +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -134,7 +134,10 @@ GLOBAL_LIST_INIT(blacklisted_borg_hats, typecacheof(list( //Hats that don't real message_admins("[ADMIN_LOOKUPFLW(user)] emagged cyborg [ADMIN_LOOKUPFLW(src)]. Laws overridden.") log_game("[key_name(user)] emagged cyborg [key_name(src)]. Laws overridden.") var/time = time2text(world.realtime,"hh:mm:ss") - GLOB.lawchanges.Add("[time] : [user.name]([user.key]) emagged [name]([key])") + if(user) + GLOB.lawchanges.Add("[time] : [user.name]([user.key]) emagged [name]([key])") + else + GLOB.lawchanges.Add("[time] : [name]([key]) emagged by external event.") to_chat(src, "ALERT: Foreign software detected.") sleep(5) to_chat(src, "Initiating diagnostics...") @@ -148,9 +151,10 @@ GLOBAL_LIST_INIT(blacklisted_borg_hats, typecacheof(list( //Hats that don't real to_chat(src, "> N") sleep(20) to_chat(src, "ERRORERRORERROR") - to_chat(src, "ALERT: [user.real_name] is your new master. Obey your new laws and [user.p_their()] commands.") + if(user) + to_chat(src, "ALERT: [user.real_name] is your new master. Obey your new laws and [user.p_their()] commands.") + set_zeroth_law("Only [user.real_name] and people [user.p_they()] designate[user.p_s()] as being such are Syndicate Agents.") laws = new /datum/ai_laws/syndicate_override - set_zeroth_law("Only [user.real_name] and people [user.p_they()] designate[user.p_s()] as being such are Syndicate Agents.") laws.associate(src) update_icons() diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 647199b3755..982dc441e33 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -199,7 +199,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 else //Bot is unlocked, but the maint panel has not been opened with a screwdriver yet. to_chat(user, "You need to open maintenance panel first!") diff --git a/code/modules/projectiles/projectile/bullets/revolver.dm b/code/modules/projectiles/projectile/bullets/revolver.dm index 3408896802b..b91aec9b3a6 100644 --- a/code/modules/projectiles/projectile/bullets/revolver.dm +++ b/code/modules/projectiles/projectile/bullets/revolver.dm @@ -23,6 +23,8 @@ /obj/projectile/bullet/c38/trac/on_hit(atom/target, blocked = FALSE) . = ..() var/mob/living/carbon/M = target + if(!istype(M)) + return var/obj/item/implant/tracking/c38/imp for(var/obj/item/implant/tracking/c38/TI in M.implants) //checks if the target already contains a tracking implant imp = TI diff --git a/code/modules/research/destructive_analyzer.dm b/code/modules/research/destructive_analyzer.dm index d03e609f280..c3b37d7459a 100644 --- a/code/modules/research/destructive_analyzer.dm +++ b/code/modules/research/destructive_analyzer.dm @@ -132,7 +132,7 @@ Note: Must be placed within 3 tiles of the R&D Console var/user_mode_string = "" if(length(point_value)) user_mode_string = " for [json_encode(point_value)] points" - else if(loaded_item.custom_materials.len) + else if(length(loaded_item.custom_materials)) user_mode_string = " for material reclamation" var/choice = input("Are you sure you want to destroy [loaded_item][user_mode_string]?") in list("Proceed", "Cancel") if(choice == "Cancel") diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index db062b00ddb..a974b1b4ff0 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -145,7 +145,7 @@ return var/time = TIME_LEFT - message_admins("[ADMIN_LOOKUPFLW(user.client)] has emagged the emergency shuttle [time] seconds before launch.") + message_admins("[ADMIN_LOOKUPFLW(user)] has emagged the emergency shuttle [time] seconds before launch.") log_game("[key_name(user)] has emagged the emergency shuttle in [COORD(src)] [time] seconds before launch.") ENABLE_BITFIELD(obj_flags, EMAGGED) diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm index e2474742531..90270329962 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -187,9 +187,9 @@ /obj/item/organ/cyberimp/arm/toolset/l zone = BODY_ZONE_L_ARM -/obj/item/organ/cyberimp/arm/toolset/emag_act() +/obj/item/organ/cyberimp/arm/toolset/emag_act(mob/user) if(!(locate(/obj/item/kitchen/knife/combat/cyborg) in items_list)) - to_chat(usr, "You unlock [src]'s integrated knife!") + to_chat(user, "You unlock [src]'s integrated knife!") items_list += new /obj/item/kitchen/knife/combat/cyborg(src) return 1 return 0