Merge pull request #4691 from taukausanake/plant_hud

Hydroponics HUD
This commit is contained in:
Fox McCloud
2016-07-15 21:47:36 -04:00
committed by GitHub
11 changed files with 209 additions and 39 deletions
+19 -11
View File
@@ -16,6 +16,13 @@
#define DIAG_MECH_HUD "11"// Mech health bar
#define STATUS_HUD_OOC "12"// STATUS_HUD without virus db check for someone being ill.
#define DIAG_BOT_HUD "13"// Bot HUDS
#define PLANT_NUTRIENT_HUD "15"// Plant nutrient level
#define PLANT_WATER_HUD "16"// Plant water level
#define PLANT_STATUS_HUD "17"// Plant harvest/dead
#define PLANT_HEALTH_HUD "18"// Plant health
#define PLANT_TOXIN_HUD "19"// Toxin level
#define PLANT_PEST_HUD "20"// Pest level
#define PLANT_WEED_HUD "21"// Weed level
//for antag huds. these are used at the /mob level
#define SPECIALROLE_HUD "13"
@@ -28,16 +35,17 @@
#define DATA_HUD_MEDICAL_BASIC 3
#define DATA_HUD_MEDICAL_ADVANCED 4
#define DATA_HUD_DIAGNOSTIC 5
#define DATA_HUD_HYDROPONIC 6
//NATIONS
#define GAME_HUD_NATIONS 6
#define GAME_HUD_NATIONS 7
//antag HUD defines
#define ANTAG_HUD_CULT 7
#define ANTAG_HUD_REV 8
#define ANTAG_HUD_OPS 9
#define ANTAG_HUD_WIZ 10
#define ANTAG_HUD_SHADOW 11
#define ANTAG_HUD_TRAITOR 12
#define ANTAG_HUD_NINJA 13 //For Daves Rework
#define ANTAG_HUD_CHANGELING 14
#define ANTAG_HUD_VAMPIRE 15
#define ANTAG_HUD_ABDUCTOR 16 //For Fox
#define ANTAG_HUD_CULT 8
#define ANTAG_HUD_REV 9
#define ANTAG_HUD_OPS 10
#define ANTAG_HUD_WIZ 11
#define ANTAG_HUD_SHADOW 12
#define ANTAG_HUD_TRAITOR 13
#define ANTAG_HUD_NINJA 14 //For Daves Rework
#define ANTAG_HUD_CHANGELING 15
#define ANTAG_HUD_VAMPIRE 16
#define ANTAG_HUD_ABDUCTOR 17 //For Fox
+3 -2
View File
@@ -6,7 +6,8 @@ var/datum/atom_hud/huds = list( \
DATA_HUD_SECURITY_ADVANCED = new/datum/atom_hud/data/human/security/advanced(), \
DATA_HUD_MEDICAL_BASIC = new/datum/atom_hud/data/human/medical/basic(), \
DATA_HUD_MEDICAL_ADVANCED = new/datum/atom_hud/data/human/medical/advanced(), \
DATA_HUD_DIAGNOSTIC = new/datum/atom_hud/data/diagnostic(),
DATA_HUD_DIAGNOSTIC = new/datum/atom_hud/data/diagnostic(), \
DATA_HUD_HYDROPONIC = new/datum/atom_hud/data/hydroponic(), \
GAME_HUD_NATIONS = new/datum/atom_hud/antag(), \
ANTAG_HUD_CULT = new/datum/atom_hud/antag(), \
ANTAG_HUD_REV = new/datum/atom_hud/antag(), \
@@ -17,7 +18,7 @@ var/datum/atom_hud/huds = list( \
ANTAG_HUD_NINJA = new/datum/atom_hud/antag/hidden(),\
ANTAG_HUD_CHANGELING = new/datum/atom_hud/antag/hidden(),\
ANTAG_HUD_VAMPIRE = new/datum/atom_hud/antag/hidden(),\
ANTAG_HUD_ABDUCTOR = new/datum/atom_hud/antag/hidden(),\
ANTAG_HUD_ABDUCTOR = new/datum/atom_hud/antag/hidden()\
)
/datum/atom_hud
+81
View File
@@ -46,6 +46,9 @@
/datum/atom_hud/data/diagnostic
hud_icons = list (DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD)
/datum/atom_hud/data/hydroponic
hud_icons = list (PLANT_NUTRIENT_HUD, PLANT_WATER_HUD, PLANT_STATUS_HUD, PLANT_HEALTH_HUD, PLANT_TOXIN_HUD, PLANT_PEST_HUD, PLANT_WEED_HUD)
/* MED/SEC/DIAG HUD HOOKS */
/*
@@ -314,3 +317,81 @@
holder.icon_state = "hudmove"
else
holder.icon_state = ""
/*~~~~~~~~~~~~~~
PLANT HUD
~~~~~~~~~~~~~~~*/
/proc/RoundPlantBar(value)
switch(value * 100)
if(1 to 10)
return "10"
if(10 to 20)
return "20"
if(20 to 30)
return "30"
if(30 to 40)
return "40"
if(40 to 50)
return "50"
if(50 to 60)
return "60"
if(60 to 70)
return "70"
if(70 to 80)
return "80"
if(80 to 90)
return "90"
if(90 to INFINITY)
return "max"
else
return "zero"
return "zero"
/obj/machinery/portable_atmospherics/hydroponics/proc/plant_hud_set_nutrient()
var/image/holder = hud_list[PLANT_NUTRIENT_HUD]
holder.icon_state = "hudnutrient[RoundPlantBar(nutrilevel/maxnutri)]"
/obj/machinery/portable_atmospherics/hydroponics/proc/plant_hud_set_water()
var/image/holder = hud_list[PLANT_WATER_HUD]
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]
if(!seed)
holder.icon_state = ""
return
if(harvest)
holder.icon_state = "hudharvest"
return
if(dead)
holder.icon_state = "huddead"
return
holder.icon_state = ""
/obj/machinery/portable_atmospherics/hydroponics/proc/plant_hud_set_health()
var/image/holder = hud_list[PLANT_HEALTH_HUD]
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()
var/image/holder = hud_list[PLANT_TOXIN_HUD]
if(toxins < 1) // You don't want to see these icons if the value is small
holder.icon_state = ""
return
holder.icon_state = "hudtoxin[RoundPlantBar(toxins/10)]"
/obj/machinery/portable_atmospherics/hydroponics/proc/plant_hud_set_pest()
var/image/holder = hud_list[PLANT_PEST_HUD]
if(pestlevel < 1) // You don't want to see these icons if the value is small
holder.icon_state = ""
return
holder.icon_state = "hudpest[RoundPlantBar(pestlevel/10)]"
/obj/machinery/portable_atmospherics/hydroponics/proc/plant_hud_set_weed()
var/image/holder = hud_list[PLANT_WEED_HUD]
if(weedlevel < 1) // You don't want to see these icons if the value is small
holder.icon_state = ""
return
holder.icon_state = "hudweed[RoundPlantBar(weedlevel/10)]"
+16 -1
View File
@@ -114,4 +114,19 @@
prescription_upgradable = 1
/obj/item/clothing/glasses/hud/security/sunglasses/prescription
prescription = 1
prescription = 1
/obj/item/clothing/glasses/hud/hydroponic
name = "Hydroponic HUD"
desc = "A heads-up display capable of analyzing the health and status of plants growing in hydro trays and soil."
icon_state = "hydroponichud"
HUDType = DATA_HUD_HYDROPONIC
/obj/item/clothing/glasses/hud/hydroponic/night
name = "Night Vision Hydroponic HUD"
desc = "A hydroponic HUD fitted with a light amplifier."
icon_state = "hydroponichudnight"
item_state = "glasses"
darkness_view = 8
see_darkness = 0
prescription_upgradable = 0
@@ -251,4 +251,4 @@
if(!user.put_in_active_hand(QB))
QB.forceMove(get_turf(src))
visible_message("<span class='notice'>[user] removes the queen from the apiary.</span>")
queen_bee = null
queen_bee = null
+39
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)
var/mechanical = 1 // Set to 0 to stop it from drawing the alert lights.
var/base_name = "tray"
@@ -73,10 +75,12 @@
if(weedlevel > 0)
nymph.reagents.add_reagent("nutriment", weedlevel)
weedlevel = 0
plant_hud_set_weed()
nymph.visible_message("<font color='blue'><b>[nymph]</b> begins rooting through [src], ripping out weeds and eating them noisily.</font>","<font color='blue'>You begin rooting through [src], ripping out weeds and eating them noisily.</font>")
else if(nymph.nutrition > 100 && nutrilevel < 10)
nymph.nutrition -= ((10-nutrilevel)*5)
nutrilevel = 10
plant_hud_set_nutrient()
nymph.visible_message("<font color='blue'><b>[nymph]</b> secretes a trickle of green liquid, refilling [src].</font>","<font color='blue'>You secrete a trickle of green liquid, refilling [src].</font>")
else
nymph.visible_message("<font color='blue'><b>[nymph]</b> rolls around in [src] for a bit.</font>","<font color='blue'>You roll around in [src] for a bit.</font>")
@@ -85,6 +89,17 @@
/obj/machinery/portable_atmospherics/hydroponics/New()
..()
var/datum/atom_hud/data/hydroponic/hydro_hud = huds[DATA_HUD_HYDROPONIC]
prepare_huds()
hydro_hud.add_to_hud(src)
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()
component_parts = list()
component_parts += new /obj/item/weapon/circuitboard/hydroponics(null)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
@@ -101,6 +116,7 @@
if(closed_system)
flags &= ~OPENCONTAINER
/obj/machinery/portable_atmospherics/hydroponics/upgraded/New()
..()
component_parts = list()
@@ -118,6 +134,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)
@@ -150,12 +168,18 @@
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()
plant_hud_set_weed()
plant_hud_set_pest()
//Harvests the product of a plant.
/obj/machinery/portable_atmospherics/hydroponics/proc/harvest(var/mob/user)
@@ -233,6 +257,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
@@ -391,6 +418,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
@@ -409,6 +444,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]!")
@@ -585,6 +623,7 @@
user.visible_message("<span class='danger'>[user] starts uprooting the weeds.</span>", "<span class='danger'>You remove the weeds from the [src].</span>")
weedlevel = 0
update_icon()
plant_hud_set_weed()
else
to_chat(user, "<span class='danger'>This plot is completely devoid of weeds. It doesn't need uprooting.</span>")
@@ -21,6 +21,7 @@
// Bonus chance if the tray is unoccupied.
if(waterlevel > 10 && nutrilevel > 2 && prob(isnull(seed) ? 6 : 3))
weedlevel += 1 * HYDRO_SPEED_MULTIPLIER
plant_hud_set_weed()
// There's a chance for a weed explosion to happen if the weeds take over.
// Plants that are themselves weeds (weed_tolerance > 10) are unaffected.
@@ -48,8 +49,10 @@
// Maintain tray nutrient and water levels.
if(seed.get_trait(TRAIT_NUTRIENT_CONSUMPTION) > 0 && nutrilevel > 0 && prob(25))
nutrilevel -= max(0,seed.get_trait(TRAIT_NUTRIENT_CONSUMPTION) * HYDRO_SPEED_MULTIPLIER)
plant_hud_set_nutrient()
if(seed.get_trait(TRAIT_WATER_CONSUMPTION) > 0 && waterlevel > 0 && prob(25))
waterlevel -= max(0,seed.get_trait(TRAIT_WATER_CONSUMPTION) * HYDRO_SPEED_MULTIPLIER)
plant_hud_set_water()
// Make sure the plant is not starving or thirsty. Adequate
// water and nutrients will cause a plant to become healthier.
@@ -91,6 +94,7 @@
if(toxins > seed.get_trait(TRAIT_TOXINS_TOLERANCE))
health -= toxin_uptake
toxins -= toxin_uptake
plant_hud_set_toxin()
// Check for pests and weeds.
// Some carnivorous plants happily eat pests.
@@ -100,6 +104,7 @@
pestlevel -= HYDRO_SPEED_MULTIPLIER
else if(pestlevel >= seed.get_trait(TRAIT_PEST_TOLERANCE))
health -= HYDRO_SPEED_MULTIPLIER
plant_hud_set_pest()
// Some plants thrive and live off of weeds.
if(weedlevel > 0)
@@ -108,6 +113,7 @@
weedlevel -= HYDRO_SPEED_MULTIPLIER
else if(weedlevel >= seed.get_trait(TRAIT_WEED_TOLERANCE))
health -= HYDRO_SPEED_MULTIPLIER
plant_hud_set_weed()
// Handle life and death.
// If the plant gets too old, begin killing it each cycle
@@ -21,6 +21,16 @@
build_path = /obj/item/clothing/glasses/hud/health
category = list("Equipment")
/datum/design/health_hud_night
name = "Night Vision Health Scanner HUD"
desc = "An advanced medical head-up display that allows doctors to find patients in complete darkness."
id = "health_hud_night"
req_tech = list("biotech" = 4, "magnets" = 5)
build_type = PROTOLATHE
materials = list(MAT_METAL = 200, MAT_GLASS = 200, MAT_URANIUM = 1000, MAT_SILVER = 250)
build_path = /obj/item/clothing/glasses/hud/health/night
category = list("Equipment")
/datum/design/magboots
name = "Magnetic Boots"
desc = "Magnetic boots, often used during extravehicular activity to ensure the user remains safely attached to the vehicle."
@@ -41,14 +51,14 @@
build_path = /obj/item/clothing/glasses/night
category = list("Equipment")
/datum/design/health_hud_night
name = "Night Vision Health Scanner HUD"
desc = "An advanced medical head-up display that allows doctors to find patients in complete darkness."
id = "health_hud_night"
req_tech = list("biotech" = 4, "magnets" = 5)
/datum/design/security_hud
name = "Security HUD"
desc = "A heads-up display that scans the humans in view and provides accurate data about their ID status."
id = "security_hud"
req_tech = list("magnets" = 3, "combat" = 2)
build_type = PROTOLATHE
materials = list(MAT_METAL = 200, MAT_GLASS = 200, MAT_URANIUM = 1000, MAT_SILVER = 250)
build_path = /obj/item/clothing/glasses/hud/health/night
materials = list(MAT_METAL = 50, MAT_GLASS = 50)
build_path = /obj/item/clothing/glasses/hud/security
category = list("Equipment")
/datum/design/security_hud_night
@@ -61,16 +71,6 @@
build_path = /obj/item/clothing/glasses/hud/security/night
category = list("Equipment")
/datum/design/nvgmesons
name = "Night Vision Optical Meson Scanners"
desc = "Prototype meson scanners fitted with an extra sensor which amplifies the visible light spectrum and overlays it to the UHD display."
id = "nvgmesons"
req_tech = list("materials" = 5, "magnets" = 5, "engineering" = 4)
build_type = PROTOLATHE
materials = list(MAT_METAL = 300, MAT_GLASS = 400, MAT_PLASMA = 250, MAT_URANIUM = 1000)
build_path = /obj/item/clothing/glasses/meson/night
category = list("Equipment")
/datum/design/mesons
name = "Optical Meson Scanners"
desc = "Used for seeing walls, floors, and stuff through anything."
@@ -81,14 +81,14 @@
build_path = /obj/item/clothing/glasses/meson
category = list("Equipment")
/datum/design/security_hud
name = "Security HUD"
desc = "A heads-up display that scans the humans in view and provides accurate data about their ID status."
id = "security_hud"
req_tech = list("magnets" = 3, "combat" = 2)
/datum/design/nvgmesons
name = "Night Vision Optical Meson Scanners"
desc = "Prototype meson scanners fitted with an extra sensor which amplifies the visible light spectrum and overlays it to the UHD display."
id = "nvgmesons"
req_tech = list("materials" = 5, "magnets" = 5, "engineering" = 4)
build_type = PROTOLATHE
materials = list(MAT_METAL = 50, MAT_GLASS = 50)
build_path = /obj/item/clothing/glasses/hud/security
materials = list(MAT_METAL = 300, MAT_GLASS = 400, MAT_PLASMA = 250, MAT_URANIUM = 1000)
build_path = /obj/item/clothing/glasses/meson/night
category = list("Equipment")
/datum/design/air_horn
@@ -170,3 +170,23 @@
materials = list("$metal" = 200, "$glass" = 200, "$uranium" = 1000, "$plasma" = 300)
build_path = /obj/item/clothing/glasses/hud/diagnostic/night
category = list("Equipment")
/datum/design/hydroponic_hud
name = "Hydroponic HUD"
desc = "A HUD used to analyze the health and status of plants growing in hydro trays and soil."
id = "hydroponic_hud"
req_tech = list("magnets" = 3, "biotech" = 3)
build_type = PROTOLATHE
materials = list("$metal" = 50, "$glass" = 50)
build_path = /obj/item/clothing/glasses/hud/hydroponic
category = list("Equipment")
/datum/design/hydroponic_hud_night
name = "Night Vision Hydroponic HUD"
desc = "A HUD used to analyze the health and status of plants growing in low-light environments."
id = "hydroponic_hud_night"
req_tech = list("magnets" = 5, "biotech" = 4)
build_type = PROTOLATHE
materials = list("$metal" = 200, "$glass" = 200, "$uranium" = 1000, "$plasma" = 200)
build_path = /obj/item/clothing/glasses/hud/hydroponic/night
category = list("Equipment")