From e86909d8f7444710afcaa5abd5f6b71032213e14 Mon Sep 17 00:00:00 2001 From: mikomyazaki <47489928+mikomyazaki@users.noreply.github.com> Date: Sat, 22 Feb 2020 19:49:39 +0000 Subject: [PATCH] Light ICs work inside clothing assemblies (#8321) Fixes #8185 Also light ICs no longer produce UV for Dionas to bask in Light ICs now project a cone like flashlights rather than an omnidirectional light --- .../core/assemblies/clothing.dm | 3 +++ .../core/assemblies/generic.dm | 3 +++ .../integrated_electronics/subtypes/output.dm | 17 +++++++++-------- html/changelogs/lights_in_clothes.yml | 8 ++++++++ 4 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 html/changelogs/lights_in_clothes.yml diff --git a/code/modules/integrated_electronics/core/assemblies/clothing.dm b/code/modules/integrated_electronics/core/assemblies/clothing.dm index acf4322f2bf..fe851c173f2 100644 --- a/code/modules/integrated_electronics/core/assemblies/clothing.dm +++ b/code/modules/integrated_electronics/core/assemblies/clothing.dm @@ -18,6 +18,9 @@ /obj/item/device/electronic_assembly/clothing/resolve_ui_host() return clothing +/obj/item/device/electronic_assembly/clothing/get_assembly_holder() + return clothing + /obj/item/device/electronic_assembly/clothing/update_icon() ..() clothing.icon_state = icon_state diff --git a/code/modules/integrated_electronics/core/assemblies/generic.dm b/code/modules/integrated_electronics/core/assemblies/generic.dm index aac232f8d67..6a77e645b8d 100644 --- a/code/modules/integrated_electronics/core/assemblies/generic.dm +++ b/code/modules/integrated_electronics/core/assemblies/generic.dm @@ -249,3 +249,6 @@ w_class = ITEMSIZE_TINY max_components = IC_COMPONENTS_BASE / 2 max_complexity = IC_COMPLEXITY_BASE / 2 + +/obj/item/device/electronic_assembly/proc/get_assembly_holder() + return src \ No newline at end of file diff --git a/code/modules/integrated_electronics/subtypes/output.dm b/code/modules/integrated_electronics/subtypes/output.dm index a425b3b92b1..f0f9fae1ce6 100644 --- a/code/modules/integrated_electronics/subtypes/output.dm +++ b/code/modules/integrated_electronics/subtypes/output.dm @@ -65,22 +65,23 @@ outputs = list() activators = list("toggle light" = IC_PINTYPE_PULSE_IN) spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH - var/light_toggled = 0 + var/light_toggled = FALSE var/light_brightness = 3 - var/light_rgb = "#FFFFFF" + var/light_rgb = COLOR_WHITE power_draw_idle = 0 // Adjusted based on brightness. + light_wedge = LIGHT_WIDE /obj/item/integrated_circuit/output/light/do_work() light_toggled = !light_toggled update_lighting() /obj/item/integrated_circuit/output/light/proc/update_lighting() - if(light_toggled) - if(assembly) - assembly.set_light(l_range = light_brightness, l_power = light_brightness, l_color = light_rgb) - else - if(assembly) - assembly.set_light(0) + if(assembly) + var/atom/atom_holder = assembly.get_assembly_holder() + if(light_toggled) + atom_holder.set_light(l_range = light_brightness, l_power = light_brightness, l_color = light_rgb, uv = 0, angle = light_wedge) + else + atom_holder.set_light(0) power_draw_idle = light_toggled ? light_brightness * 2 : 0 /obj/item/integrated_circuit/output/light/disconnect_all() diff --git a/html/changelogs/lights_in_clothes.yml b/html/changelogs/lights_in_clothes.yml new file mode 100644 index 00000000000..e09367d3a7a --- /dev/null +++ b/html/changelogs/lights_in_clothes.yml @@ -0,0 +1,8 @@ +author: mikomyazaki + +delete-after: True + +changes: + - bugfix: "Lights will now work properly when inside clothing assemblies." + - tweak: "Lighting ICs now only illuminate a cone infront of them, like flashlights." + - balance: "Lighting ICs now do not produce UV." \ No newline at end of file