From eec29a3e9c9284659c81075aa02adf34acce0c50 Mon Sep 17 00:00:00 2001 From: taukausanake Date: Sat, 18 Jun 2016 18:10:31 -0500 Subject: [PATCH] I DID IT Finally got the HUDs to work all thanks to Crazylemon. The only thing that doesn't work is the hudharvest2 is_type_in_list() check I made but I could get rid of it --- code/game/data_huds.dm | 26 ++++++++++--------- code/modules/hydroponics/beekeeping/beebox.dm | 3 +++ code/modules/hydroponics/trays/tray.dm | 22 ++++++++++++++++ .../modules/hydroponics/trays/tray_process.dm | 6 +++++ 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm index cd6957ffd9f..d63a68046ae 100644 --- a/code/game/data_huds.dm +++ b/code/game/data_huds.dm @@ -303,23 +303,23 @@ ~~~~~~~~~~~~~~~*/ /proc/RoundPlantBar(value) switch(value * 100) - if(90 to INFINITY) + if(91 to INFINITY) return "max" - if(80 to 90) + if(81 to 90) return "90" - if(70 to 80) + if(71 to 80) return "80" - if(60 to 70) + if(61 to 70) return "70" - if(50 to 60) + if(51 to 60) return "60" - if(40 to 50) + if(41 to 50) return "50" - if(30 to 40) + if(31 to 40) return "40" - if(20 to 30) + if(21 to 30) return "30" - if(10 to 20) + if(11 to 20) return "20" if(1 to 10) return "10" @@ -333,11 +333,11 @@ /obj/machinery/portable_atmospherics/hydroponics/proc/plant_hud_set_water() var/image/holder = hud_list[PLANT_WATER_HUD] - holder.icon_state = "hudnutrient[RoundPlantBar(waterlevel/maxwater)]" + holder.icon_state = "hudwater[RoundPlantBar(waterlevel/maxwater)]" /obj/machinery/portable_atmospherics/hydroponics/proc/plant_hud_set_status() var/image/holder = hud_list[PLANT_STATUS_HUD] - // Dis be drugs here. And special mention plants + // Dis be drugs here. And special mention plants //TODO: make it work var/list/special = list(/datum/seed/nettle, /datum/seed/apple/poison, /datum/seed/ambrosia, /datum/seed/tobacco, /datum/seed/mushroom, \ /datum/seed/weeds, /datum/seed/grass, /datum/seed/kudzu, /datum/seed/diona, /datum/seed/clown) if (!seed) @@ -355,7 +355,9 @@ /obj/machinery/portable_atmospherics/hydroponics/proc/plant_hud_set_health() var/image/holder = hud_list[PLANT_HEALTH_HUD] - if (!seed) return + if (!seed) + holder.icon_state = "" + return holder.icon_state = "hudplanthealth[RoundPlantBar(health/seed.get_trait(TRAIT_ENDURANCE))]" /obj/machinery/portable_atmospherics/hydroponics/proc/plant_hud_set_toxin() diff --git a/code/modules/hydroponics/beekeeping/beebox.dm b/code/modules/hydroponics/beekeeping/beebox.dm index b3deb421ad9..d8f128d2a5a 100644 --- a/code/modules/hydroponics/beekeeping/beebox.dm +++ b/code/modules/hydroponics/beekeeping/beebox.dm @@ -37,6 +37,9 @@ icon_state = "beebox" anchored = 1 density = 1 + +// hud_possible = list (PLANT_HONEY_HUD) + var/mob/living/simple_animal/hostile/poison/bees/queen/queen_bee = null var/list/bees = list() //bees owned by the box, not those inside it var/list/honeycombs = list() diff --git a/code/modules/hydroponics/trays/tray.dm b/code/modules/hydroponics/trays/tray.dm index c95e425a5c2..42d22d82b2c 100644 --- a/code/modules/hydroponics/trays/tray.dm +++ b/code/modules/hydroponics/trays/tray.dm @@ -7,6 +7,8 @@ flags = OPENCONTAINER volume = 100 + hud_possible = list (PLANT_NUTRIENT_HUD, PLANT_WATER_HUD, PLANT_STATUS_HUD, PLANT_HEALTH_HUD, PLANT_TOXIN_HUD, PLANT_PEST_HUD, PLANT_WEED_HUD, PLANT_HONEY_HUD) + var/mechanical = 1 // Set to 0 to stop it from drawing the alert lights. var/base_name = "tray" @@ -129,6 +131,8 @@ maxnutri = tmp_capacity * 5 // Up to 30 //waterlevel = maxwater //nutrilevel = 3 + plant_hud_set_nutrient() + plant_hud_set_water() /obj/machinery/portable_atmospherics/hydroponics/bullet_act(var/obj/item/projectile/Proj) @@ -161,12 +165,16 @@ die() check_level_sanity() update_icon() + plant_hud_set_status() + plant_hud_set_health() /obj/machinery/portable_atmospherics/hydroponics/proc/die() dead = 1 harvest = 0 weedlevel += 1 * HYDRO_SPEED_MULTIPLIER pestlevel = 0 + plant_hud_set_status() + plant_hud_set_health() //Harvests the product of a plant. /obj/machinery/portable_atmospherics/hydroponics/proc/harvest(var/mob/user) @@ -244,6 +252,9 @@ pestlevel = 0 sampled = 0 update_icon() + plant_hud_set_weed() + plant_hud_set_status() + plant_hud_set_health() visible_message("[src] has been overtaken by [seed.display_name].") return @@ -402,6 +413,14 @@ toxins = max(0,min(toxins,10)) yield_mod = min(100, yield_mod) + plant_hud_set_nutrient() + plant_hud_set_water() + plant_hud_set_status() + plant_hud_set_health() + plant_hud_set_toxin() + plant_hud_set_pest() + plant_hud_set_weed() + /obj/machinery/portable_atmospherics/hydroponics/proc/mutate_species() var/previous_plant = seed.display_name @@ -420,6 +439,9 @@ harvest = 0 weedlevel = 0 + plant_hud_set_health() + plant_hud_set_weed() + update_icon() visible_message("\red The \blue [previous_plant] \red has suddenly mutated into \blue [seed.display_name]!") diff --git a/code/modules/hydroponics/trays/tray_process.dm b/code/modules/hydroponics/trays/tray_process.dm index 855d053008c..653b6c9d788 100644 --- a/code/modules/hydroponics/trays/tray_process.dm +++ b/code/modules/hydroponics/trays/tray_process.dm @@ -133,4 +133,10 @@ harvest() check_health() +// No idea what happens in here so sticking all these here for now + plant_hud_set_nutrient() + plant_hud_set_water() + plant_hud_set_toxin() + plant_hud_set_pest() + plant_hud_set_weed() return