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
This commit is contained in:
taukausanake
2016-06-18 18:10:31 -05:00
parent e9d9a4c345
commit eec29a3e9c
4 changed files with 45 additions and 12 deletions
+14 -12
View File
@@ -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()
@@ -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()
+22
View File
@@ -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("<span class='notice'>[src] has been overtaken by [seed.display_name].</span>")
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]!")
@@ -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