mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Better feedback for variant renaming
Initialize variant to null, so the prev check doesn't mess up the first time Add removal message to modder "remove" for consistency No message if variant was not changed
This commit is contained in:
@@ -407,6 +407,7 @@
|
||||
return
|
||||
seed.variant = null
|
||||
seed.apply_variant_name()
|
||||
to_chat(usr, "<span class='notice'>You remove the [seed.plantname]'s variant designation.</span>")
|
||||
|
||||
interact(usr)
|
||||
|
||||
|
||||
@@ -10,7 +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 = "" // Optional custom name to track modified plants. Can be set with pen or from gene modder.
|
||||
var/variant = null // Optional custom name to track modified plants. Can be set with pen or from gene modder.
|
||||
|
||||
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.
|
||||
@@ -335,6 +335,7 @@
|
||||
|
||||
// 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/container = null)
|
||||
var/prev = variant
|
||||
var/V = input(user, "Choose variant name:", "Plant Variant Naming", variant) as text|null
|
||||
if(isnull(V)) // Did the user cancel?
|
||||
return
|
||||
@@ -349,7 +350,8 @@
|
||||
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, "<span class='notice'>You [variant ? "change" : "remove"] the [plantname]'s variant designation.</span>")
|
||||
if(prev != variant)
|
||||
to_chat(user, "<span class='notice'>You [variant ? "change" : "remove"] the [plantname]'s variant designation.</span>")
|
||||
apply_variant_name()
|
||||
|
||||
/obj/item/seeds/proc/apply_variant_name()
|
||||
|
||||
Reference in New Issue
Block a user