Reduced some bloat, using TRAY_NAME_UPDATE

This commit is contained in:
The0bserver
2020-08-31 05:01:51 -04:00
parent 9be7bda9bc
commit df3c2d3d8d

View File

@@ -215,9 +215,8 @@
// Harvest code
if(age > myseed.production && (age - lastproduce) > myseed.production && (!harvest && !dead))
nutrimentMutation()
if(myseed && myseed.yield != -1) // Unharvestable shouldn't be harvested
harvest = 1
harvest = TRUE
else
lastproduce = age
if(prob(5)) // On each tick, there's a 5 percent chance the pest population will increase
@@ -395,11 +394,7 @@
sleep(5) // Wait a while
update_icon()
visible_message("<span class='warning'>[oldPlantName] suddenly mutates into [myseed.plantname]!</span>")
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 )
@@ -419,17 +414,23 @@
sleep(5) // Wait a while
update_icon()
visible_message("<span class='warning'>The mutated weeds in [src] spawn some [myseed.plantname]!</span>")
TRAY_NAME_UPDATE
else
to_chat(usr, "<span class='warning'>The few weeds in [src] seem to react, but only for a moment...</span>")
/obj/machinery/hydroponics/proc/plantdies() // OH NOES!!!!! I put this all in one function to make things easier
/**
* Plant Death Proc.
* Cleans up various stats for the plant upon death, including pests, harvestability, and plant health.
*/
/obj/machinery/hydroponics/proc/plantdies()
plant_health = 0
harvest = 0
harvest = FALSE
pestlevel = 0 // Pests die
lastproduce = 0
if(!dead)
update_icon()
dead = 1
dead = TRUE
/obj/machinery/hydroponics/proc/mutatepest(mob/user)
@@ -464,7 +465,6 @@
var/target = myseed ? myseed.plantname : src
var/visi_msg = ""
var/transfer_amount
if(istype(reagent_source, /obj/item/reagent_containers/food/snacks) || istype(reagent_source, /obj/item/reagent_containers/pill))
if(istype(reagent_source, /obj/item/reagent_containers/food/snacks))
var/obj/item/reagent_containers/food/snacks/R = reagent_source
@@ -472,7 +472,7 @@
R.generate_trash(get_turf(user))
visi_msg="[user] composts [reagent_source], spreading it through [target]"
transfer_amount = reagent_source.reagents.total_volume
else
else
transfer_amount = reagent_source.amount_per_transfer_from_this
if(istype(reagent_source, /obj/item/reagent_containers/syringe/))
var/obj/item/reagent_containers/syringe/syr = reagent_source
@@ -628,22 +628,23 @@
harvest = FALSE
lastproduce = age
if(istype(myseed, /obj/item/seeds/replicapod))
if(user)//runtimes
to_chat(user, "<span class='notice'>You harvest from the [myseed.plantname].</span>")
to_chat(user, "<span class='notice'>You harvest from the [myseed.plantname].</span>")
else if(myseed.getYield() <= 0)
if(user)
to_chat(user, "<span class='warning'>You fail to harvest anything useful!</span>")
to_chat(user, "<span class='warning'>You fail to harvest anything useful!</span>")
else
if(user)
to_chat(user, "<span class='notice'>You harvest [myseed.getYield()] items from the [myseed.plantname].</span>")
to_chat(user, "<span class='notice'>You harvest [myseed.getYield()] items from the [myseed.plantname].</span>")
if(!myseed.get_gene(/datum/plant_gene/trait/repeated_harvest))
qdel(myseed)
myseed = null
dead = 0
dead = FALSE
name = initial(name)
desc = initial(desc)
TRAY_NAME_UPDATE
if(self_sustaining) //No reason to pay for an empty tray.
idle_power_usage = 0
self_sustaining = FALSE
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.///
/obj/machinery/hydroponics/proc/adjustWater(adjustamt)
waterlevel = clamp(waterlevel + adjustamt, 0, maxwater)