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
+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")