diff --git a/code/game/objects/items/devices/lightreplacer.dm b/code/game/objects/items/devices/lightreplacer.dm index aefb788fe46d0..b083f7534bf4c 100644 --- a/code/game/objects/items/devices/lightreplacer.dm +++ b/code/game/objects/items/devices/lightreplacer.dm @@ -67,27 +67,6 @@ /obj/item/device/lightreplacer/use_before(atom/target, mob/living/user, click_parameters) - // Check for lights in a container, refilling our charges. - if (istype(target, /obj/item/storage)) - var/obj/item/storage/storage = target - var/amt_inserted = 0 - var/turf/turf = get_turf(src) - for (var/obj/item/light/light in storage.contents) - if (uses < max_uses && light.status == LIGHT_OK) - AddUses(1) - amt_inserted++ - storage.remove_from_storage(light, turf, TRUE) - qdel(light) - if (!amt_inserted) - USE_FEEDBACK_FAILURE("\The [target] has no lights to add to \the [src].") - return TRUE - storage.finish_bulk_removal() - user.visible_message( - SPAN_NOTICE("\The [user] transfers some lights from \a [target] to \a [src]."), - SPAN_NOTICE("You insert [amt_inserted] light\s from \the [target] to \the [src]. It now has [uses] light\s remaining.") - ) - return TRUE - // Replace light bulbs if (istype(target, /obj/machinery/light)) var/obj/machinery/light/fixture = target @@ -118,6 +97,29 @@ qdel(tool) return TRUE + // Container - Add lights + if (istype(tool, /obj/item/storage)) + if (uses >= max_uses) + USE_FEEDBACK_FAILURE("\The [src] is full.") + return TRUE + var/obj/item/storage/storage = tool + var/amt_inserted = 0 + for (var/obj/item/light/light in storage.contents) + if (uses < max_uses && light.status == LIGHT_OK) + AddUses(1) + amt_inserted++ + storage.remove_from_storage(light, src, TRUE) + qdel(light) + if (!amt_inserted) + USE_FEEDBACK_FAILURE("\The [tool] has no lights to add to \the [src].") + return TRUE + storage.finish_bulk_removal() + user.visible_message( + SPAN_NOTICE("\The [user] transfers some lights from \a [tool] to \a [src]."), + SPAN_NOTICE("You insert [amt_inserted] light\s from \the [tool] to \the [src]. It now has [uses] light\s remaining.") + ) + return TRUE + // Material Stack - Add lights if (istype(tool, /obj/item/stack/material)) if (tool.get_material_name() != MATERIAL_GLASS)