From 07eea73ae04c3216699e07defb244362b15c355a Mon Sep 17 00:00:00 2001
From: cacogen <25089914+cacogen@users.noreply.github.com>
Date: Thu, 13 Feb 2020 22:39:52 +1300
Subject: [PATCH] Soil is no longer called hydroponics tray when something is
planted (#49304)
* Soil is no longer called hydroponics tray when something is planted
- Simplifies tray renaming and reduces the copypasted code by making it a proc
- Removes description changes, couldn't make them work grammatically with the plant name and they don't make sense on their own
- Makes soil PLURAL gender so it's referred to as some soil instead of a soil
- Removes unnecessary setting of a seed's productdesc when planting, it already gets that when customising it with a pen and that's the only time it's relevant
- Updates the tray name when weeds are mutated, which didn't used to happen
* uses a define instead of a proc
---
code/modules/hydroponics/hydroponics.dm | 35 +++++++------------------
1 file changed, 9 insertions(+), 26 deletions(-)
diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm
index d435a9a7d3f..c902f18f391 100644
--- a/code/modules/hydroponics/hydroponics.dm
+++ b/code/modules/hydroponics/hydroponics.dm
@@ -1,3 +1,5 @@
+#define TRAY_NAME_UPDATE name = myseed ? "[initial(name)] ([myseed.plantname])" : initial(name)
+
/obj/machinery/hydroponics
name = "hydroponics tray"
icon = 'icons/obj/hydroponics/equipment.dmi'
@@ -90,7 +92,6 @@
return connected
-
/obj/machinery/hydroponics/bullet_act(obj/projectile/Proj) //Works with the Somatoray to modify plant variables.
if(!myseed)
return ..()
@@ -388,12 +389,7 @@
pestlevel = 0 // Reset
update_icon()
visible_message("The [oldPlantName] is overtaken by some [myseed.plantname]!")
- name = "hydroponics tray ([myseed.plantname])"
- if(myseed.product)
- desc = initial(myseed.product.desc)
- else
- desc = initial(desc)
-
+ TRAY_NAME_UPDATE
/obj/machinery/hydroponics/proc/mutate(lifemut = 2, endmut = 5, productmut = 1, yieldmut = 2, potmut = 25, wrmut = 2, wcmut = 5, traitmut = 0) // Mutates the current seed
if(!myseed)
@@ -427,12 +423,7 @@
sleep(5) // Wait a while
update_icon()
visible_message("[oldPlantName] suddenly mutates into [myseed.plantname]!")
- name = "hydroponics tray ([myseed.plantname])"
- if(myseed.product)
- desc = initial(myseed.product.desc)
- else
- desc = initial(desc)
-
+ TRAY_NAME_UPDATE
/obj/machinery/hydroponics/proc/mutateweed() // If the weeds gets the mutagent instead. Mind you, this pretty much destroys the old plant
if( weedlevel > 5 )
@@ -452,6 +443,7 @@
sleep(5) // Wait a while
update_icon()
visible_message("The mutated weeds in [src] spawn some [myseed.plantname]!")
+ TRAY_NAME_UPDATE
else
to_chat(usr, "The few weeds in [src] seem to react, but only for a moment...")
@@ -797,15 +789,7 @@
to_chat(user, "You plant [O].")
dead = 0
myseed = O
- name = "hydroponics tray ([myseed.plantname])"
- if(!myseed.productdesc) //we haven't changed our produce's description
- if(myseed.product)
- myseed.productdesc = initial(myseed.product.desc)
- else if(myseed.desc)
- myseed.productdesc = myseed.desc
- else
- myseed.productdesc = "A fascinating specimen."
- desc = myseed.productdesc
+ TRAY_NAME_UPDATE
age = 1
plant_health = myseed.endurance
lastcycle = world.time
@@ -907,8 +891,7 @@
qdel(myseed)
myseed = null
update_icon()
- name = initial(name)
- desc = initial(desc)
+ TRAY_NAME_UPDATE
else
if(user)
examine(user)
@@ -926,8 +909,7 @@
qdel(myseed)
myseed = null
dead = 0
- name = initial(name)
- desc = initial(desc)
+ TRAY_NAME_UPDATE
update_icon()
/// Tray Setters - The following procs adjust the tray or plants variables, and make sure that the stat doesn't go out of bounds.///
@@ -970,6 +952,7 @@
desc = "A patch of dirt."
icon = 'icons/obj/hydroponics/equipment.dmi'
icon_state = "soil"
+ gender = PLURAL
circuit = null
density = FALSE
use_power = NO_POWER_USE