From 8a8b7b16a6b8cfca59fea6cf38eaa70929f4c52c Mon Sep 17 00:00:00 2001
From: theo-3 <85434590+theo-3@users.noreply.github.com>
Date: Thu, 12 Aug 2021 15:19:59 +0300
Subject: [PATCH] Use null instead of empty string, fix all string checks
---
code/modules/hydroponics/gene_modder.dm | 6 +++---
code/modules/hydroponics/grown.dm | 2 +-
code/modules/hydroponics/hydroponics.dm | 2 +-
code/modules/hydroponics/seeds.dm | 4 +++-
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/code/modules/hydroponics/gene_modder.dm b/code/modules/hydroponics/gene_modder.dm
index 0ab6803cb8e..1796cd487ef 100644
--- a/code/modules/hydroponics/gene_modder.dm
+++ b/code/modules/hydroponics/gene_modder.dm
@@ -279,9 +279,9 @@
dat += ""
dat += "
Variant
"
- dat += "| [(seed.variant == "") ? "None" : seed.variant] | "
+ dat += "
| [seed.variant ? seed.variant : "None"] | "
dat += "Edit | "
- if(seed.variant != "")
+ if(seed.variant)
dat += "Remove | "
dat += "
"
else
@@ -405,7 +405,7 @@
else if(href_list["del_v"])
if(!seed)
return
- seed.variant = ""
+ seed.variant = null
seed.apply_variant_name()
interact(usr)
diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm
index 1438f70a6d7..e5d4f501c5d 100644
--- a/code/modules/hydroponics/grown.dm
+++ b/code/modules/hydroponics/grown.dm
@@ -42,7 +42,7 @@
seed.prepare_result(src)
transform *= TRANSFORM_USING_VARIABLE(seed.potency, 100) + 0.5 //Makes the resulting produce's sprite larger or smaller based on potency!
add_juice()
- if(seed.variant && seed.variant != "")
+ if(seed.variant)
name += " \[[seed.variant]]"
/obj/item/reagent_containers/food/snacks/grown/Destroy()
diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm
index 356d35f8961..72117d41187 100644
--- a/code/modules/hydroponics/hydroponics.dm
+++ b/code/modules/hydroponics/hydroponics.dm
@@ -344,7 +344,7 @@
/obj/machinery/hydroponics/examine(user)
. = ..()
if(myseed)
- if(myseed.variant != "")
+ if(myseed.variant)
. += "It has the [myseed.variant] variant of [myseed.plantname] planted."
else
. += "It has [myseed.plantname] planted."
diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm
index aa9393da0bf..c8f7395aa8c 100644
--- a/code/modules/hydroponics/seeds.dm
+++ b/code/modules/hydroponics/seeds.dm
@@ -339,11 +339,13 @@
if(!adj.Adjacent(user) || isnull(V))
return
variant = copytext(sanitize(html_encode(trim(V))), 1, 64)
+ if(variant == "")
+ variant == null
to_chat(user, "You [variant ? "change" : "remove"] the [plantname]'s variant designation.")
apply_variant_name()
/obj/item/seeds/proc/apply_variant_name()
- var/V = (variant == "") ? "" : " \[[variant]]" // If we have a non-empty variant add it to the name
+ var/V = variant ? " \[[variant]]" : "" // If we have a non-empty variant add it to the name
var/N = initial(name)
if(copytext(name, 1, 13) == "experimental") // Don't delete 'experimental'
N = "experimental " + N