Skip to content

Commit

Permalink
[MIRROR] Fixes the light replacer not being stowable
Browse files Browse the repository at this point in the history
  • Loading branch information
Hubblenaut authored and SierraHelper committed Nov 1, 2024
1 parent 15848fe commit a53f82d
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions code/game/objects/items/devices/lightreplacer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a53f82d

Please sign in to comment.