From 55ae1ceb70257e2e4c057374a4f791fa5980aa0f Mon Sep 17 00:00:00 2001 From: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Date: Tue, 7 Apr 2020 15:46:26 -0400 Subject: [PATCH] Instability is now shown on the seed extractor. (#50413) * Instability is now shown on the seed extractor. * Adds doccumentation. * Adds class level documentation to seed_pile datums --- code/modules/hydroponics/seed_extractor.dm | 33 ++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/code/modules/hydroponics/seed_extractor.dm b/code/modules/hydroponics/seed_extractor.dm index c1bf3b359ab..71f1402f19f 100644 --- a/code/modules/hydroponics/seed_extractor.dm +++ b/code/modules/hydroponics/seed_extractor.dm @@ -102,6 +102,12 @@ else return ..() +/** Seed Pile + * Takes stats from the seed, as dictated by the New proc, and assigned them to the datum's vars. + * Name is the Seed's name. + * All stats are taken from the seed's core stats. + * Amount is the number of seeds present of that specific type. + **/ /datum/seed_pile var/name = "" var/lifespan = 0 //Saved stats @@ -110,9 +116,14 @@ var/production = 0 var/yield = 0 var/potency = 0 + var/instability = 0 var/amount = 0 -/datum/seed_pile/New(name, life, endur, matur, prod, yie, poten, am = 1) +/** Seed Pile Creation. + * Takes a seed's name, core stats, and amount when creating a seed pile datum. + * This is read by the HTML Ui for display in-game. + **/ +/datum/seed_pile/New(name, life, endur, matur, prod, yie, poten, insta, am = 1) src.name = name src.lifespan = life src.endurance = endur @@ -120,6 +131,7 @@ src.production = prod src.yield = yie src.potency = poten + src.instability = insta src.amount = am /obj/machinery/seed_extractor/ui_interact(mob/user) @@ -132,11 +144,11 @@ if (contents.len == 0) dat += "No seeds" else - dat += "" + dat += "
NameLifespanEnduranceMaturationProductionYieldPotencyStock
" for (var/datum/seed_pile/O in piles) dat += "" - dat += "" + dat += "" dat += "
NameLifespanEnduranceMaturationProductionYieldPotencyInstabilityStock
[O.name][O.lifespan][O.endurance][O.maturation][O.production][O.yield][O.potency]" - dat += "Vend ([O.amount] left)
[O.production][O.yield][O.potency][O.instability]" + dat += "Vend ([O.amount] left)
" var/datum/browser/popup = new(user, "seed_ext", name, 700, 400) popup.set_content(dat) @@ -154,9 +166,10 @@ href_list["pr"] = text2num(href_list["pr"]) href_list["yi"] = text2num(href_list["yi"]) href_list["pot"] = text2num(href_list["pot"]) + href_list["ist"] = text2num(href_list["ist"]) for (var/datum/seed_pile/N in piles)//Find the pile we need to reduce... - if (href_list["name"] == N.name && href_list["li"] == N.lifespan && href_list["en"] == N.endurance && href_list["ma"] == N.maturation && href_list["pr"] == N.production && href_list["yi"] == N.yield && href_list["pot"] == N.potency) + if (href_list["name"] == N.name && href_list["li"] == N.lifespan && href_list["en"] == N.endurance && href_list["ma"] == N.maturation && href_list["pr"] == N.production && href_list["yi"] == N.yield && href_list["pot"] == N.potency && href_list["ist"] == N.instability) if(N.amount <= 0) return N.amount = max(N.amount - 1, 0) @@ -167,13 +180,17 @@ for (var/obj/T in contents)//Now we find the seed we need to vend var/obj/item/seeds/O = T - if (O.plantname == href_list["name"] && O.lifespan == href_list["li"] && O.endurance == href_list["en"] && O.maturation == href_list["ma"] && O.production == href_list["pr"] && O.yield == href_list["yi"] && O.potency == href_list["pot"]) + if (O.plantname == href_list["name"] && O.lifespan == href_list["li"] && O.endurance == href_list["en"] && O.maturation == href_list["ma"] && O.production == href_list["pr"] && O.yield == href_list["yi"] && O.potency == href_list["pot"] && O.instability == href_list["ist"]) O.forceMove(drop_location()) break src.updateUsrDialog() return +/** Add Seeds Proc. + * Takes a seed into the machine, and breaks it down into it's core stats. + * These core stats are then passed to the machine UI for display in-game through a seed pile datum.. + **/ /obj/machinery/seed_extractor/proc/add_seed(obj/item/seeds/O) if(contents.len >= 999) to_chat(usr, "\The [src] is full.") @@ -190,8 +207,8 @@ . = TRUE for (var/datum/seed_pile/N in piles) - if (O.plantname == N.name && O.lifespan == N.lifespan && O.endurance == N.endurance && O.maturation == N.maturation && O.production == N.production && O.yield == N.yield && O.potency == N.potency) + if (O.plantname == N.name && O.lifespan == N.lifespan && O.endurance == N.endurance && O.maturation == N.maturation && O.production == N.production && O.yield == N.yield && O.potency == N.potency && O.instability == N.instability) ++N.amount return - piles += new /datum/seed_pile(O.plantname, O.lifespan, O.endurance, O.maturation, O.production, O.yield, O.potency) + piles += new /datum/seed_pile(O.plantname, O.lifespan, O.endurance, O.maturation, O.production, O.yield, O.potency, O.instability)