diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 72117d41187..81a4f83e6a6 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -879,7 +879,7 @@ adjustWeeds(-10) //Has a side effect of cleaning up those nasty weeds update_icon() else if(istype(O, /obj/item/pen) && myseed) - myseed.variant_prompt(user, src) // adj parameter makes Adjacent use the tray instead of the seed (which would always fail) + myseed.variant_prompt(user, src) else return ..() diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm index 7e245e10154..0b8eee55145 100644 --- a/code/modules/hydroponics/seeds.dm +++ b/code/modules/hydroponics/seeds.dm @@ -334,11 +334,19 @@ // adj parameter changes what Adjacent is called from, such as the gene modder or a tray -/obj/item/seeds/proc/variant_prompt(mob/user, obj/item/adj = src) +/obj/item/seeds/proc/variant_prompt(mob/user, obj/item/container = null) var/V = input(user, "Choose variant name:", "Plant Variant Naming", variant) as text|null - if(!adj.Adjacent(user) || isnull(V)) + if(isnull(V)) // Did the user cancel? return - variant = copytext(sanitize(html_encode(trim(V))), 1, 64) + if(container) + if(loc != container) // Was the seed removed from the container? + return + if(!container.Adjacent(user)) // No remote renaming + return + else + if(!Adjacent(user)) // No remote renaming + return + variant = copytext(sanitize(html_encode(trim(V))), 1, 64) // Sanitization must happen after null check because it converts nulls to empty strings if(variant == "") variant = null to_chat(user, "You [variant ? "change" : "remove"] the [plantname]'s variant designation.")