From 0855144ef6033f2c5454476bd2fe688b5642bbfb Mon Sep 17 00:00:00 2001 From: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Date: Sun, 26 Apr 2020 13:18:36 -0400 Subject: [PATCH] Minor cleanup on plant analyzer modes and fixes plant instability loss (#50671) * Several misc. botany fixes * whoops, removes duplicates. --- code/__DEFINES/botany.dm | 9 +++++++++ code/modules/hydroponics/grown.dm | 4 ++-- code/modules/hydroponics/hydroitemdefines.dm | 7 ++----- code/modules/hydroponics/hydroponics.dm | 11 +++-------- code/modules/hydroponics/seeds.dm | 6 ++---- tgstation.dme | 1 + 6 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 code/__DEFINES/botany.dm diff --git a/code/__DEFINES/botany.dm b/code/__DEFINES/botany.dm new file mode 100644 index 00000000000..7214b08ea19 --- /dev/null +++ b/code/__DEFINES/botany.dm @@ -0,0 +1,9 @@ + +#define TRAY_NAME_UPDATE name = myseed ? "[initial(name)] ([myseed.plantname])" : initial(name) +#define YIELD_WEED_MINIMUM 3 +#define YIELD_WEED_MAXIMUM 10 +#define STATIC_NUTRIENT_CAPACITY 10 + +//Both available scanning modes for the plant analyzer. +#define PLANT_SCANMODE_STATS 0 +#define PLANT_SCANMODE_CHEMICALS 1 diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index 15f9c0c970e..ce41bf5bb89 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -68,10 +68,10 @@ if (istype(O, /obj/item/plant_analyzer)) var/obj/item/plant_analyzer/P_analyzer = O var/msg = "*---------*\n This is \a [src].\n" - if(seed && P_analyzer.scan_mode == 0) + if(seed && P_analyzer.scan_mode == PLANT_SCANMODE_STATS) msg += seed.get_analyzer_text() var/reag_txt = "" - if(seed && P_analyzer.scan_mode == 1) + if(seed && P_analyzer.scan_mode == PLANT_SCANMODE_CHEMICALS) msg += "
*Plant Reagents:*" for(var/reagent_id in seed.reagents_add) var/datum/reagent/R = GLOB.chemical_reagents_list[reagent_id] diff --git a/code/modules/hydroponics/hydroitemdefines.dm b/code/modules/hydroponics/hydroitemdefines.dm index 98491695630..2b9356db487 100644 --- a/code/modules/hydroponics/hydroitemdefines.dm +++ b/code/modules/hydroponics/hydroitemdefines.dm @@ -1,6 +1,3 @@ -//Both available scanning modes for the plant analyzer. -#define SCANMODE_STATS 0 -#define SCANMODE_CHEMICALS 1 // Plant analyzer /obj/item/plant_analyzer @@ -14,12 +11,12 @@ w_class = WEIGHT_CLASS_TINY slot_flags = ITEM_SLOT_BELT custom_materials = list(/datum/material/iron=30, /datum/material/glass=20) - var/scan_mode = SCANMODE_STATS + var/scan_mode = PLANT_SCANMODE_STATS /obj/item/plant_analyzer/attack_self(mob/user) . = ..() scan_mode = !scan_mode - to_chat(user, "You switch [src] to [scan_mode == SCANMODE_CHEMICALS ? "scan for chemical reagents and traits" : "scan for plant growth statistics"].") + to_chat(user, "You switch [src] to [scan_mode == PLANT_SCANMODE_CHEMICALS ? "scan for chemical reagents and traits" : "scan for plant growth statistics"].") // ************************************* // Hydroponics Tools diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 16b02d2b744..c05532ca8a9 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -1,8 +1,3 @@ -#define TRAY_NAME_UPDATE name = myseed ? "[initial(name)] ([myseed.plantname])" : initial(name) -#define YIELD_WEED_MINIMUM 3 -#define YIELD_WEED_MAXIMUM 10 -#define STATIC_NUTRIENT_CAPACITY 10 - /obj/machinery/hydroponics name = "hydroponics tray" @@ -263,7 +258,7 @@ if(myseed.instability >= 80) mutate(0, 0, 0, 0, 0, 0, 0, 5, 0) //Exceedingly low odds of gaining a trait. if(myseed.instability >= 60) - if(prob((myseed.instability)/2) && !self_sustaining) //Minimum 30%, Maximum 50% chance of mutating every age tick when not on autogrow. + if(prob((myseed.instability)/2) && !self_sustaining && length(myseed.mutatelist)) //Minimum 30%, Maximum 50% chance of mutating every age tick when not on autogrow. mutatespecie() myseed.instability = myseed.instability/2 if(myseed.instability >= 40) @@ -647,14 +642,14 @@ else if(istype(O, /obj/item/plant_analyzer)) var/obj/item/plant_analyzer/P_analyzer = O if(myseed) - if(P_analyzer.scan_mode == 0) + if(P_analyzer.scan_mode == PLANT_SCANMODE_STATS) to_chat(user, "*** [myseed.plantname] ***" ) to_chat(user, "- Plant Age: [age]") var/list/text_string = myseed.get_analyzer_text() if(text_string) to_chat(user, text_string) to_chat(user, "*---------*") - if(myseed.reagents_add && P_analyzer.scan_mode == 1) + if(myseed.reagents_add && P_analyzer.scan_mode == PLANT_SCANMODE_CHEMICALS) to_chat(user, "- Plant Reagents -") to_chat(user, "*---------*") for(var/datum/plant_gene/reagent/G in myseed.genes) diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm index 4850f54bf7c..e4c7deff705 100644 --- a/code/modules/hydroponics/seeds.dm +++ b/code/modules/hydroponics/seeds.dm @@ -432,9 +432,7 @@ continue all_traits += " [traits.get_name()]" text += "- Plant Traits:[all_traits]\n" - text += "*---------*" - return text /obj/item/seeds/proc/on_chem_reaction(datum/reagents/S) //in case seeds have some special interaction with special chems @@ -445,11 +443,11 @@ to_chat(user, "*---------*\n This is \a [src].") var/text var/obj/item/plant_analyzer/P_analyzer = O - if(P_analyzer.scan_mode == 0) + if(P_analyzer.scan_mode == PLANT_SCANMODE_STATS) text = get_analyzer_text() if(text) to_chat(user, "[text]") - if(reagents_add && P_analyzer.scan_mode == 1) + if(reagents_add && P_analyzer.scan_mode == PLANT_SCANMODE_CHEMICALS) to_chat(user, "- Plant Reagents -") to_chat(user, "*---------*") for(var/datum/plant_gene/reagent/G in genes) diff --git a/tgstation.dme b/tgstation.dme index 25c0d03983c..de63edee554 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -26,6 +26,7 @@ #include "code\__DEFINES\atmospherics.dm" #include "code\__DEFINES\atom_hud.dm" #include "code\__DEFINES\blackmarket.dm" +#include "code\__DEFINES\botany.dm" #include "code\__DEFINES\bsql.config.dm" #include "code\__DEFINES\bsql.dm" #include "code\__DEFINES\callbacks.dm"