From d0d0fc0a9b1b059f0a38b34790b70904b7e57dd3 Mon Sep 17 00:00:00 2001 From: Ovilum Date: Wed, 12 Jun 2024 16:38:21 -0500 Subject: [PATCH] down below https://github.com/shiptest-ss13/Shiptest/pull/3054 --- code/modules/hydroponics/grown.dm | 9 ++--- code/modules/hydroponics/growninedible.dm | 5 +-- code/modules/hydroponics/hydroponics.dm | 49 ++++++++++++++--------- code/modules/hydroponics/seeds.dm | 44 ++++++++++---------- 4 files changed, 57 insertions(+), 50 deletions(-) diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index 7fa71032320..ed58e86e16d 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -69,20 +69,19 @@ /obj/item/reagent_containers/food/snacks/grown/attackby(obj/item/O, mob/user, params) ..() if (istype(O, /obj/item/plant_analyzer)) - var/msg = "*---------*\n This is \a [src].\n" + var/msg = "This is \a [src].\n" if(seed) - msg += seed.get_analyzer_text() + msg += "[seed.get_analyzer_text()]\n" var/reag_txt = "" if(seed) for(var/reagent_id in seed.reagents_add) var/datum/reagent/R = GLOB.chemical_reagents_list[reagent_id] var/amt = reagents.get_reagent_amount(reagent_id) - reag_txt += "\n- [R.name]: [amt]" + reag_txt += "- [R.name]: [amt]\n" if(reag_txt) msg += reag_txt - msg += "
*---------*" - to_chat(user, msg) + to_chat(user, examine_block(msg)) else if(seed) for(var/datum/plant_gene/trait/T in seed.genes) diff --git a/code/modules/hydroponics/growninedible.dm b/code/modules/hydroponics/growninedible.dm index 3ecb34762ae..f97596c348f 100644 --- a/code/modules/hydroponics/growninedible.dm +++ b/code/modules/hydroponics/growninedible.dm @@ -35,11 +35,10 @@ /obj/item/grown/attackby(obj/item/O, mob/user, params) ..() if (istype(O, /obj/item/plant_analyzer)) - var/msg = "*---------*\n This is \a [src]\n" + var/msg = "This is \a [src]\n" if(seed) msg += seed.get_analyzer_text() - msg += "" - to_chat(usr, msg) + to_chat(usr, examine_block(msg)) return /obj/item/grown/proc/add_juice() diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index a5e66f6df4e..bbfeaeeb5b5 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -1,3 +1,6 @@ +#define HYDRO_MAX_PEST 10 +#define HYDRO_MAX_WEED 10 +#define HYDRO_MAX_TOXIC 100 /obj/machinery/hydroponics name = "hydroponics tray" icon = 'icons/obj/hydroponics/equipment.dmi' @@ -6,7 +9,9 @@ pixel_z = 1 obj_flags = CAN_BE_HIT | UNIQUE_RENAME circuit = /obj/item/circuitboard/machine/hydroponics - idle_power_usage = 0 + use_power = IDLE_POWER_USE + idle_power_usage = IDLE_DRAW_LOW + active_power_usage = ACTIVE_DRAW_HIGH var/waterlevel = 100 //The amount of water in the tray (max 100) var/maxwater = 100 //The maximum amount of water in the tray var/nutridrain = 1 // How many units of nutrient will be drained in the tray @@ -114,7 +119,7 @@ if(!powered() && self_sustaining) visible_message("[name]'s auto-grow functionality shuts off!") - idle_power_usage = 0 + set_idle_power() self_sustaining = FALSE update_appearance() @@ -253,7 +258,7 @@ adjustWeeds(1 / rating) // Weeeeeeeeeeeeeeedddssss - if(weedlevel >= 10 && prob(50)) // At this point the plant is kind of fucked. Weeds can overtake the plant spot. + if(weedlevel >= HYDRO_MAX_WEED && prob(50)) // At this point the plant is kind of fucked. Weeds can overtake the plant spot. if(myseed) if(!myseed.get_gene(/datum/plant_gene/trait/plant_type/weed_hardy) && !myseed.get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism)) // If a normal plant weedinvasion() @@ -549,25 +554,26 @@ else if(istype(O, /obj/item/plant_analyzer)) var/obj/item/plant_analyzer/P_analyzer = O + var/msg = "" if(myseed) if(P_analyzer.scan_mode == PLANT_SCANMODE_STATS) - to_chat(user, examine_block("[myseed.plantname]")) - to_chat(user, examine_block("Plant Age: [age]")) + msg += "[myseed.plantname]\n" + msg += "- Plant Age: [span_notice("[age]\n")]" var/list/text_string = myseed.get_analyzer_text() if(text_string) - to_chat(user, examine_block(text_string)) + msg += "[text_string]\n" if(myseed.reagents_add && P_analyzer.scan_mode == PLANT_SCANMODE_CHEMICALS) - to_chat(user, examine_block("Plant Reagents")) + msg += "Plant Reagents\n" for(var/datum/plant_gene/reagent/Gene in myseed.genes) - to_chat(user, examine_block("- [Gene.get_name()] -")) + msg += "[span_notice("- [Gene.get_name()] -")]\n" else - to_chat(user, examine_block( "No plant found.")) - to_chat(user, examine_block("\nWeed level: [weedlevel] / 10")) - to_chat(user, examine_block("\nPest level: [pestlevel] / 10")) - to_chat(user, examine_block("\nToxicity level: [toxic] / 100")) - to_chat(user, examine_block("\nWater level: [waterlevel] / [maxwater]")) - to_chat(user, examine_block("\nNutrition level: [reagents.total_volume] / [maxnutri]")) - to_chat(user, examine_block("
")) + msg += "No plant found.\n" + msg += "Weed level: [span_notice("[weedlevel] / [HYDRO_MAX_WEED]")]\n" + msg += "Pest level: [span_notice("[pestlevel] / [HYDRO_MAX_PEST]")]\n" + msg += "Toxicity level: [span_notice("[toxic] / [HYDRO_MAX_TOXIC]")]\n" + msg += "Water level: [span_notice("[waterlevel] / [maxwater]")]\n" + msg += "Nutrition level: [span_notice("[reagents.total_volume] / [maxnutri]")]\n" + to_chat(user, examine_block(msg)) return else if(istype(O, /obj/item/cultivator)) @@ -671,7 +677,10 @@ if(!anchored) return self_sustaining = !self_sustaining - idle_power_usage = self_sustaining ? 1250 : 0 + if(self_sustaining) + set_active_power() + else + set_idle_power() to_chat(user, "You [self_sustaining ? "activate" : "deactivated"] [src]'s autogrow function[self_sustaining ? ", maintaining the tray's health while using high amounts of power" : ""].") update_appearance() @@ -702,7 +711,7 @@ desc = initial(desc) TRAY_NAME_UPDATE if(self_sustaining) //No reason to pay for an empty tray. - idle_power_usage = 0 + set_idle_power() self_sustaining = FALSE update_appearance() @@ -718,13 +727,13 @@ plant_health = clamp(plant_health + adjustamt, 0, myseed.endurance) /obj/machinery/hydroponics/proc/adjustToxic(adjustamt) - toxic = clamp(toxic + adjustamt, 0, 100) + toxic = clamp(toxic + adjustamt, 0, HYDRO_MAX_TOXIC) /obj/machinery/hydroponics/proc/adjustPests(adjustamt) - pestlevel = clamp(pestlevel + adjustamt, 0, 10) + pestlevel = clamp(pestlevel + adjustamt, 0, HYDRO_MAX_PEST) /obj/machinery/hydroponics/proc/adjustWeeds(adjustamt) - weedlevel = clamp(weedlevel + adjustamt, 0, 10) + weedlevel = clamp(weedlevel + adjustamt, 0, HYDRO_MAX_WEED) /obj/machinery/hydroponics/proc/spawnplant() // why would you put strange reagent in a hydro tray you monster I bet you also feed them blood var/list/livingplants = list(/mob/living/simple_animal/hostile/tree, /mob/living/simple_animal/hostile/killertomato) diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm index 008009a3576..ad24dccff43 100644 --- a/code/modules/hydroponics/seeds.dm +++ b/code/modules/hydroponics/seeds.dm @@ -390,29 +390,29 @@ /obj/item/seeds/proc/get_analyzer_text() //in case seeds have something special to tell to the analyzer var/text = "" if(!get_gene(/datum/plant_gene/trait/plant_type/weed_hardy) && !get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism) && !get_gene(/datum/plant_gene/trait/plant_type/alien_properties)) - text += "- Plant type: Normal plant\n" + text += "- Plant type: [span_notice("Normal plant\n")]" if(get_gene(/datum/plant_gene/trait/plant_type/weed_hardy)) - text += "- Plant type: Weed. Can grow in nutrient-poor soil.\n" + text += "- Plant type: [span_notice("Weed. Can grow in nutrient-poor soil.\n")]" if(get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism)) - text += "- Plant type: Mushroom. Can grow in dry soil.\n" + text += "- Plant type: [span_notice("Mushroom. Can grow in dry soil.\n")]" if(get_gene(/datum/plant_gene/trait/plant_type/crystal)) - text += "- Plant type: Crystal. Revitalizes soil.\n" + text += "- Plant type: [span_notice("Crystal. Revitalizes soil.\n")]" if(get_gene(/datum/plant_gene/trait/plant_type/alien_properties)) - text += "- Plant type: UNKNOWN \n" + text += "- Plant type: [span_warning("UNKNOWN\n")]" if(potency != UNHARVESTABLE) - text += "- Potency: [potency]\n" + text += "- Potency: [span_notice("[potency]\n")]" if(yield != UNHARVESTABLE) - text += "- Yield: [yield]\n" - text += "- Maturation speed: [maturation]\n" + text += "- Yield: [span_notice("[yield]\n")]" + text += "- Maturation speed: [span_notice("[maturation]\n")]" if(yield != UNHARVESTABLE) - text += "- Production speed: [production]\n" - text += "- Endurance: [endurance]\n" - text += "- Lifespan: [lifespan]\n" - text += "- Instability: [instability]\n" - text += "- Weed Growth Rate: [weed_rate]\n" - text += "- Weed Vulnerability: [weed_chance]\n" + text += "- Production speed: [span_notice("[production]\n")]" + text += "- Endurance: [span_notice("[endurance]\n")]" + text += "- Lifespan: [span_notice("[lifespan]\n")]" + text += "- Instability: [span_notice("[instability]\n")]" + text += "- Weed Growth Rate: [span_notice("[weed_rate]\n")]" + text += "- Weed Vulnerability: [span_notice("[weed_chance]\n")]" if(rarity) - text += "- Species Discovery Value: [rarity]\n" + text += "- Species Discovery Value: [span_notice("[rarity]\n")]" var/all_traits = "" for(var/datum/plant_gene/trait/traits in genes) if(istype(traits, /datum/plant_gene/trait/plant_type)) @@ -427,20 +427,20 @@ /obj/item/seeds/attackby(obj/item/O, mob/user, params) if (istype(O, /obj/item/plant_analyzer)) - to_chat(user, "*---------*\n This is \a [src].") + var/msg = "This is \a [src]." var/text var/obj/item/plant_analyzer/P_analyzer = O if(P_analyzer.scan_mode == PLANT_SCANMODE_STATS) text = get_analyzer_text() if(text) - to_chat(user, "[text]") + msg += "\n[text]" if(reagents_add && P_analyzer.scan_mode == PLANT_SCANMODE_CHEMICALS) - to_chat(user, "- Plant Reagents -") - to_chat(user, "*---------*") + msg += "\n- Plant Reagents -" + msg += "\n*---------*" for(var/datum/plant_gene/reagent/Gene in genes) - to_chat(user, "- [Gene.get_name()] -") - to_chat(user, "*---------*") - + msg += "\n- [Gene.get_name()] -" + msg += "\n*---------*" + to_chat(user, examine_block(msg)) return