From 643e4b4af211794340ba2f41cfc777c4b0cfdbaf Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Wed, 13 May 2020 00:07:08 -0400 Subject: [PATCH] Update overlaying on hydro trays to be more reasonable. --- code/modules/hydroponics/trays/tray.dm | 8 +++++ .../hydroponics/trays/tray_update_icons.dm | 36 +++++++++++++------ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/code/modules/hydroponics/trays/tray.dm b/code/modules/hydroponics/trays/tray.dm index 63b6466ac61..50da409bc23 100644 --- a/code/modules/hydroponics/trays/tray.dm +++ b/code/modules/hydroponics/trays/tray.dm @@ -44,6 +44,12 @@ // Seed details/line data. var/datum/seed/seed = null // The currently planted seed + var/image/ov_lowhealth + var/image/ov_lowwater + var/image/ov_lownutri + var/image/ov_harvest + var/image/ov_frozen + var/image/ov_alert3 // Reagent information for process(), consider moving this to a controller along // with cycle information under 'mechanical concerns' at some point. @@ -170,6 +176,8 @@ /obj/machinery/portable_atmospherics/hydroponics/Initialize() . = ..() + if(!ov_lowhealth) + setup_overlays() temp_chem_holder = new() temp_chem_holder.create_reagents(10) create_reagents(200) diff --git a/code/modules/hydroponics/trays/tray_update_icons.dm b/code/modules/hydroponics/trays/tray_update_icons.dm index 1a816abb3f5..d443b482753 100644 --- a/code/modules/hydroponics/trays/tray_update_icons.dm +++ b/code/modules/hydroponics/trays/tray_update_icons.dm @@ -1,3 +1,17 @@ +/obj/machinery/portable_atmospherics/hydroponics/proc/setup_overlays() + ov_lowhealth = image(icon = icon, icon_state = "over_lowhealth3") + ov_lowhealth.plane = PLANE_LIGHTING_ABOVE + ov_lowwater = image(icon = icon, icon_state = "over_lowwater3") + ov_lowwater.plane = PLANE_LIGHTING_ABOVE + ov_lownutri = image(icon = icon, icon_state = "over_lownutri3") + ov_lownutri.plane = PLANE_LIGHTING_ABOVE + ov_harvest = image(icon = icon, icon_state = "over_alert3") + ov_harvest.plane = PLANE_LIGHTING_ABOVE + ov_frozen = image(icon = icon, icon_state = "over_harvest3") + ov_frozen.plane = PLANE_LIGHTING_ABOVE + ov_alert3 = image(icon = icon, icon_state = "over_frozen3") + ov_alert3.plane = PLANE_LIGHTING_ABOVE + //Refreshes the icon and sets the luminosity /obj/machinery/portable_atmospherics/hydroponics/update_icon() // Update name. @@ -12,12 +26,12 @@ if(labelled) name += " ([labelled])" - overlays.Cut() + cut_overlays() // Updates the plant overlay. if(!isnull(seed)) if(mechanical && health <= (seed.get_trait(TRAIT_ENDURANCE) / 2)) - overlays += "over_lowhealth3" + add_overlay(ov_lowhealth) if(dead) var/ikey = "[seed.get_trait(TRAIT_PLANT_ICON)]-dead" @@ -25,7 +39,7 @@ if(!dead_overlay) dead_overlay = image('icons/obj/hydroponics_growing.dmi', "[ikey]") dead_overlay.color = DEAD_PLANT_COLOUR - overlays |= dead_overlay + add_overlay(dead_overlay) else if(!seed.growth_stages) seed.update_growth_stages() @@ -49,7 +63,7 @@ plant_overlay = image('icons/obj/hydroponics_growing.dmi', "[ikey]") plant_overlay.color = seed.get_trait(TRAIT_PLANT_COLOUR) plant_controller.plant_icon_cache["[ikey]-[seed.get_trait(TRAIT_PLANT_COLOUR)]"] = plant_overlay - overlays |= plant_overlay + add_overlay(plant_overlay) if(harvest && overlay_stage == seed.growth_stages) ikey = "[seed.get_trait(TRAIT_PRODUCT_ICON)]" @@ -58,25 +72,25 @@ harvest_overlay = image('icons/obj/hydroponics_products.dmi', "[ikey]") harvest_overlay.color = seed.get_trait(TRAIT_PRODUCT_COLOUR) plant_controller.plant_icon_cache["product-[ikey]-[seed.get_trait(TRAIT_PRODUCT_COLOUR)]"] = harvest_overlay - overlays |= harvest_overlay + add_overlay(harvest_overlay) //Draw the cover. if(closed_system) - overlays += "hydrocover" + add_overlay("hydrocover") //Updated the various alert icons. if(mechanical) if(waterlevel <= 10) - overlays += "over_lowwater3" + add_overlay(ov_lowwater) if(nutrilevel <= 2) - overlays += "over_lownutri3" + add_overlay(ov_lownutri) if(weedlevel >= 5 || pestlevel >= 5 || toxins >= 40) - overlays += "over_alert3" + add_overlay(ov_alert3) if(harvest) - overlays += "over_harvest3" + add_overlay(ov_harvest) if(frozen) - overlays += "over_frozen3" + add_overlay(ov_frozen) // Update bioluminescence. if(seed)