From b1570a5abc553f745e082d8fd2787b2946ab8e2a Mon Sep 17 00:00:00 2001 From: Geeves Date: Sat, 13 Jun 2020 07:51:27 +0200 Subject: [PATCH] Weapons Analyzer Fix (#9097) --- .../modules/projectiles/modular/laser_base.dm | 2 +- code/modules/research/weaponsanalyzer.dm | 38 +++++++++---------- .../geeves-weapons_analyzer_fixes.yml | 6 +++ 3 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 html/changelogs/geeves-weapons_analyzer_fixes.yml diff --git a/code/modules/projectiles/modular/laser_base.dm b/code/modules/projectiles/modular/laser_base.dm index 7111935fae0..32d7c754635 100644 --- a/code/modules/projectiles/modular/laser_base.dm +++ b/code/modules/projectiles/modular/laser_base.dm @@ -165,7 +165,7 @@ if(!istype(A)) return ..() if(!ready_to_craft) - to_chat(user, span("warning", "You cannot assemble this in your hands. You need to craft it in special eqiupment!")) + to_chat(user, SPAN_WARNING("You cannot modify \the [src] by hand, you need to use a weapons analyzer.")) return if(ismodifier(A) && gun_mods.len < modifier_cap) diff --git a/code/modules/research/weaponsanalyzer.dm b/code/modules/research/weaponsanalyzer.dm index b34955bd798..e5dc9f7d42b 100644 --- a/code/modules/research/weaponsanalyzer.dm +++ b/code/modules/research/weaponsanalyzer.dm @@ -2,8 +2,8 @@ name = "weapons analyzer" icon = 'icons/obj/machines/research.dmi' icon_state = "weapon_analyzer" - density = 1 - anchored = 1 + density = TRUE + anchored = TRUE use_power = 1 idle_power_usage = 60 active_power_usage = 2000 @@ -22,7 +22,7 @@ var/name_of_thing = "" if(item) name_of_thing = item.name - to_chat(user, span("notice", "It has [name_of_thing ? "[name_of_thing]" : "nothing"] attached.")) + to_chat(user, SPAN_NOTICE("It has [name_of_thing ? "[name_of_thing]" : "nothing"] attached.")) /obj/machinery/weapons_analyzer/attackby(var/obj/item/I, var/mob/user as mob) if(!I || !user || !ishuman(user)) @@ -31,19 +31,13 @@ var/mob/living/carbon/human/H = user if(istype(I, /obj/item/gun)) - - if(!check_gun(user)) - return - + check_swap(user, I) item = I - H.drop_from_inventory(I) I.forceMove(src) update_icon() else if(istype(I, /obj/item/device/laser_assembly)) - if(!check_gun(user)) - return - + check_swap(user, I) var/obj/item/device/laser_assembly/A = I A.ready_to_craft = TRUE item = A @@ -52,11 +46,8 @@ A.analyzer = WEAKREF(src) update_icon() else if(istype(I, /obj/item/laser_components) && istype(item, /obj/item/device/laser_assembly)) - if(!item) - to_chat(user, span("warning", "\The [src] does not have any assembly installed!")) - return if(process) - to_chat(user, span("warning", "\The [src] is busy installing component!")) + to_chat(user, SPAN_WARNING("\The [src] is busy installing a component already.")) return var/obj/item/device/laser_assembly/A = item var/success = A.attackby(I, user) @@ -72,12 +63,13 @@ process = TRUE update_icon() else if(I) + check_swap(user, I) item = I H.drop_from_inventory(I) I.forceMove(src) update_icon() -/obj/machinery/weapons_analyzer/attack_hand(mob/user as mob) +/obj/machinery/weapons_analyzer/attack_hand(mob/user) user.set_machine(src) ui_interact(user) @@ -85,11 +77,17 @@ process = FALSE update_icon() -/obj/machinery/weapons_analyzer/proc/check_gun(var/mob/user) +/obj/machinery/weapons_analyzer/proc/check_swap(var/mob/user, var/obj/I) if(item) - to_chat(user, span("warning", "\The [src] already has \the [item] mounted. Remove it first.")) - return FALSE - return TRUE + to_chat(user, SPAN_NOTICE("You swap \the [item] out for \the [I].")) + if(istype(item, /obj/item/device/laser_assembly)) + var/obj/item/device/laser_assembly/A = item + A.ready_to_craft = FALSE + A.analyzer = null + item.forceMove(get_turf(src)) + user.put_in_hands(item) + item = null + update_icon() /obj/machinery/weapons_analyzer/verb/eject() set name = "Eject Inserted Item" diff --git a/html/changelogs/geeves-weapons_analyzer_fixes.yml b/html/changelogs/geeves-weapons_analyzer_fixes.yml new file mode 100644 index 00000000000..533e5af00c4 --- /dev/null +++ b/html/changelogs/geeves-weapons_analyzer_fixes.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - bugfix: "Weapons analyzers will now longer swallow your things." \ No newline at end of file