diff --git a/code/game/objects/items/devices/lightreplacer.dm b/code/game/objects/items/devices/lightreplacer.dm index ab35b3c08fe..c15b6083dc6 100644 --- a/code/game/objects/items/devices/lightreplacer.dm +++ b/code/game/objects/items/devices/lightreplacer.dm @@ -323,15 +323,63 @@ icon_state = "lightreplacer_high" max_uses = 50 +#define BLIGHTREPLACER_SPOT_COOLDOWN (BLIGHTREPLACER_SPOT_LIFE + 1 SECONDS) +#define BLIGHTREPLACER_SPOT_RANGE 7 +#define BLIGHTREPLACER_SPOT_LIFE (5 SECONDS) + /obj/item/lightreplacer/blue name = "bluespace light replacer" desc = "A modified light replacer that zaps lights into place. Refill with broken or working lightbulbs, or sheets of glass." icon_state = "lightreplacer_blue" bluespace_toggle = TRUE + actions_types = list(/datum/action/item_action/lightreplacer_scan) + action_slots = ALL + COOLDOWN_DECLARE(lightreplacer_spot_cooldown) /obj/item/lightreplacer/blue/emag_act() return FALSE // balancing against longrange explosions +/obj/item/lightreplacer/blue/ui_action_click(mob/user, actiontype) + if(!COOLDOWN_FINISHED(src, lightreplacer_spot_cooldown)) + balloon_alert(user, "on cooldown!") + return + COOLDOWN_START(src, lightreplacer_spot_cooldown, BLIGHTREPLACER_SPOT_COOLDOWN) + lightreplacer_scan() + +/// Scans the area in search of fixtures with broken bulbs in the BLIGHTREPLACER_SPOT_RANGE range, and also marks them with the blue_firefly effect. +/obj/item/lightreplacer/blue/proc/lightreplacer_scan() + var/turf/source_turf = get_turf(src) + for(var/obj/machinery/light/broken_light in dview(BLIGHTREPLACER_SPOT_RANGE, source_turf)) + if(broken_light.status == LIGHT_OK) + continue + var/obj/effect/temp_visual/blue_firefly/firefly = new(get_turf(broken_light)) + animate(firefly, alpha = 0, time = BLIGHTREPLACER_SPOT_LIFE, easing = CIRCULAR_EASING | EASE_IN) + +/datum/action/item_action/lightreplacer_scan + name = "Scan for broken lamps" + desc = "Scans the surrounding area for fixtures with broken light bulbs and marks them." + +/obj/effect/temp_visual/blue_firefly + name = "bluespace firefly" + icon = 'icons/effects/effects.dmi' + icon_state = "bluespace_firefly" + light_power = 1 + light_range = 2 + light_color = LIGHT_COLOR_DARK_BLUE + duration = BLIGHTREPLACER_SPOT_LIFE + +/obj/effect/temp_visual/blue_firefly/Initialize(mapload) + . = ..() + update_appearance(UPDATE_OVERLAYS) + +/obj/effect/temp_visual/blue_firefly/update_overlays() + . = ..() + . += emissive_appearance(icon, icon_state, src, alpha = src.alpha) + +#undef BLIGHTREPLACER_SPOT_COOLDOWN +#undef BLIGHTREPLACER_SPOT_RANGE +#undef BLIGHTREPLACER_SPOT_LIFE + #undef GLASS_SHEET_USES #undef LIGHTBULB_COST #undef BULB_SHARDS_REQUIRED diff --git a/icons/effects/effects.dmi b/icons/effects/effects.dmi index 38d01c3076c..4ffaf0bdd22 100644 Binary files a/icons/effects/effects.dmi and b/icons/effects/effects.dmi differ