From b6d5bccd54d10c559d2cb82795fe08f0db0f8149 Mon Sep 17 00:00:00 2001 From: warior4356 Date: Wed, 31 Oct 2018 17:32:35 -0700 Subject: [PATCH] Fixes code bugs --- .../objects/items/devices/thermal_drill.dm | 17 ++++++++- code/game/objects/structures/safe.dm | 36 +++++++------------ .../research/designs/autolathe_designs.dm | 2 +- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/code/game/objects/items/devices/thermal_drill.dm b/code/game/objects/items/devices/thermal_drill.dm index bb377b2692b..5becbf431e6 100644 --- a/code/game/objects/items/devices/thermal_drill.dm +++ b/code/game/objects/items/devices/thermal_drill.dm @@ -3,8 +3,23 @@ desc = "A tungsten carbide thermal drill with magnetic clamps for the purpose of drilling hardened objects. Guaranteed 100% jam proof." icon = 'icons/obj/items.dmi' icon_state = "hardened_drill" + var/time_multiplier = 1 + var/datum/looping_sound/thermal_drill/soundloop + var/datum/effect_system/spark_spread/spark_system + +/obj/item/thermal_drill/New() + soundloop = new(list(src), FALSE) + spark_system = new /datum/effect_system/spark_spread() + spark_system.set_up(1, 0, src) + spark_system.attach(src) + +/obj/item/thermal_drill/Destroy() + QDEL_NULL(soundloop) + QDEL_NULL(spark_system) + return ..() /obj/item/thermal_drill/diamond_drill name = "diamond tipped thermal drill" desc = "A diamond tipped thermal drill with magnetic clamps for the purpose of quickly drilling hardened objects. Guaranteed 100% jam proof." - icon_state = "diamond_drill" \ No newline at end of file + icon_state = "diamond_drill" + time_multiplier = 0.5 \ No newline at end of file diff --git a/code/game/objects/structures/safe.dm b/code/game/objects/structures/safe.dm index 0e5d2f41a8d..e1d534decd0 100644 --- a/code/game/objects/structures/safe.dm +++ b/code/game/objects/structures/safe.dm @@ -6,7 +6,7 @@ Safe Codes Safe Internals */ -var/list/global_safes = list() +GLOBAL_LIST_EMPTY(safes) //SAFES /obj/structure/safe @@ -32,15 +32,13 @@ var/list/global_safes = list() var/time_to_drill var/image/bar var/drill_start_time - var/datum/looping_sound/thermal_drill/soundloop - var/datum/effect_system/spark_spread/spark_system var/drill_x_offset = -13 var/drill_y_offset = -3 var/knownby = list() /obj/structure/safe/New() - global_safes += src + GLOB.safes += src tumbler_2_pos = rand(0, 99) // first value in the combination set first tumbler_2_open = rand(0, 99) @@ -60,10 +58,6 @@ var/list/global_safes = list() combo_to_open = "[num1] - [num2]" - soundloop = new(list(src), FALSE) - spark_system = new /datum/effect_system/spark_spread() - spark_system.set_up(1, 0, src) - spark_system.attach(src) /obj/structure/safe/Initialize() ..() @@ -130,14 +124,14 @@ var/list/global_safes = list() if(do_after(user, 2 SECONDS, target = src)) drill_timer = addtimer(CALLBACK(src, .proc/drill_open), time_to_drill) drill_start_time = world.time - soundloop.start() + drill.soundloop.start() update_icon() processing_objects.Add(src) if("Turn Off") if(do_after(user, 2 SECONDS, target = src)) deltimer(drill_timer) drill_timer = null - soundloop.stop() + drill.soundloop.stop() update_icon() processing_objects.Remove(src) if("Remove Drill") @@ -289,14 +283,11 @@ var/list/global_safes = list() to_chat(user, "There is already a drill attached!") else if(do_after(user, 2 SECONDS, target = src)) if(!user.drop_item()) - to_chat(user, "\The [I] is stuck to your hand, you cannot put it in the safe!") + to_chat(user, "[I] is stuck to your hand, you cannot put it in the safe!") return I.loc = src drill = I - if(istype(drill, /obj/item/thermal_drill/diamond_drill)) - time_to_drill = 150 SECONDS - else - time_to_drill = 300 SECONDS + time_to_drill = 300 SECONDS * drill.time_multiplier update_icon() else to_chat(user, "You can't put [I] in into the safe while it is closed!") @@ -305,10 +296,9 @@ var/list/global_safes = list() /obj/structure/safe/proc/drill_open() broken = TRUE drill_timer = null - soundloop.stop() + drill.soundloop.stop() update_icon() processing_objects.Remove(src) - return /obj/structure/safe/blob_act() return @@ -320,9 +310,8 @@ var/list/global_safes = list() return /obj/structure/safe/Destroy() - global_safes -= src - QDEL_NULL(soundloop) - QDEL_NULL(spark_system) + GLOB.safes -= src + drill.soundloop.stop() return ..() /obj/structure/safe/process() @@ -331,11 +320,12 @@ var/list/global_safes = list() bar = image('icons/effects/progessbar.dmi', src, "prog_bar_[round((((world.time - drill_start_time) / time_to_drill) * 100), 5)]", HUD_LAYER) overlays += bar if(prob(15)) - spark_system.start() + drill.spark_system.start() /obj/structure/safe/examine(mob/user) ..() - to_chat(user, "On the inside of the the door is [combo_to_open]") + if(open) + to_chat(user, "On the inside of the the door is [combo_to_open]") //FLOOR SAFES /obj/structure/safe/floor @@ -370,7 +360,7 @@ var/list/global_safes = list() addtimer(CALLBACK(src, .proc/populate_codes), 10) /obj/item/paper/safe_code/proc/populate_codes() - for(var/obj/structure/safe/S in global_safes) + for(var/obj/structure/safe/S in GLOB.safes) if(owner in S.knownby) info += "
The combination for the safe located in the [get_area(S).name] is: [S.combo_to_open]
" info_links = info diff --git a/code/modules/research/designs/autolathe_designs.dm b/code/modules/research/designs/autolathe_designs.dm index a5ff9542528..af3088b514b 100644 --- a/code/modules/research/designs/autolathe_designs.dm +++ b/code/modules/research/designs/autolathe_designs.dm @@ -882,7 +882,7 @@ build_path = /obj/item/mounted/mirror category = list("initial", "Miscellaneous") -/datum/design/rcd +/datum/design/safe_internals name = "Safe Internals" id = "safe" build_type = AUTOLATHE