From 994a9b5229f92a3cb4476515a38e7617c53b2e77 Mon Sep 17 00:00:00 2001 From: theo-3 <85434590+theo-3@users.noreply.github.com> Date: Fri, 16 Jul 2021 18:38:37 +0300 Subject: [PATCH] Add plant variant naming --- code/modules/hydroponics/hydroponics.dm | 5 ++++- code/modules/hydroponics/seeds.dm | 21 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 134e337fa4e..3c7742cd4f6 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -344,7 +344,10 @@ /obj/machinery/hydroponics/examine(user) . = ..() if(myseed) - . += "It has [myseed.plantname] planted." + if(myseed.variant != "") + . += "It has the [myseed.variant] variant of [myseed.plantname] planted." + else + . += "It has [myseed.plantname] planted." if (dead) . += "It's dead!" else if (harvest) diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm index cd9271379ed..7960b617609 100644 --- a/code/modules/hydroponics/seeds.dm +++ b/code/modules/hydroponics/seeds.dm @@ -10,6 +10,7 @@ var/plantname = "Plants" // Name of plant when planted. var/product // A type path. The thing that is created when the plant is harvested. var/species = "" // Used to update icons. Should match the name in the sprites unless all icon_* are overriden. + var/variant = "" // Can be set by players with a pen to help remember what a modified plant does. var/growing_icon = 'icons/obj/hydroponics/growing.dmi' //the file that stores the sprites of the growing plant from this seed. var/icon_grow // Used to override grow icon (default is "[species]-grow"). You can use one grow icon for multiple closely related plants with it. @@ -83,11 +84,13 @@ S.potency = potency S.weed_rate = weed_rate S.weed_chance = weed_chance + S.variant = variant S.genes = list() for(var/g in genes) var/datum/plant_gene/G = g S.genes += G.Copy() S.reagents_add = reagents_add.Copy() // Faster than grabbing the list from genes. + S.apply_variant_name() return S /obj/item/seeds/proc/get_gene(typepath) @@ -324,9 +327,25 @@ to_chat(user, "[text]") return + if (istype(O, /obj/item/pen)) + var/V = sanitize(stripped_input(user, "Choose variant name:", "Plant Variant Naming", variant, MAX_MESSAGE_LEN)) + if (!Adjacent(user)) //prevent remote naming of seeds + return + if (V == "" && variant != "") + user.show_message("You remove the variant designation from the [plantname].") + else if(V != "") + user.show_message("You designate the [plantname] as the [V] variant.") + variant = V + apply_variant_name() ..() // Fallthrough to item/attackby() so that bags can pick seeds up - +/obj/item/seeds/proc/apply_variant_name() + var/P = findtext(name, "-") + var/V = (variant == "") ? "" : (" - " + variant) + if (P != 0) + name = copytext(name, 1, P - 1) + V + else + name += V