Skip to content

Commit

Permalink
Remove sleep() from hydroponics.dm (tgstation#57344)
Browse files Browse the repository at this point in the history
remove sleep() from a couple of hydroponic procs, use addtimer and callbacks instead, closes tgstation#56435
  • Loading branch information
Ghilker authored Mar 3, 2021
1 parent a249943 commit c93bfee
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions code/modules/hydroponics/hydroponics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,8 @@
harvest = FALSE
weedlevel = 0 // Reset

sleep(5) // Wait a while
update_appearance()
visible_message("<span class='warning'>[oldPlantName] suddenly mutates into [myseed.plantname]!</span>")
TRAY_NAME_UPDATE
var/message = "<span class='warning'>[oldPlantName] suddenly mutates into [myseed.plantname]!</span>"
addtimer(CALLBACK(src, .proc/after_mutation, message), 0.5 SECONDS)

/obj/machinery/hydroponics/proc/mutateweed() // If the weeds gets the mutagent instead. Mind you, this pretty much destroys the old plant
if( weedlevel > 5 )
Expand All @@ -454,13 +452,17 @@
harvest = FALSE
weedlevel = 0 // Reset

sleep(5) // Wait a while
update_appearance()
visible_message("<span class='warning'>The mutated weeds in [src] spawn some [myseed.plantname]!</span>")
TRAY_NAME_UPDATE
var/message = "<span class='warning'>The mutated weeds in [src] spawn some [myseed.plantname]!</span>"
addtimer(CALLBACK(src, .proc/after_mutation, message), 0.5 SECONDS)
else
to_chat(usr, "<span class='warning'>The few weeds in [src] seem to react, but only for a moment...</span>")

/**
* Called after plant mutation, update the appearance of the tray content and send a visible_message()
*/
/obj/machinery/hydroponics/proc/after_mutation(message)
update_appearance()
visible_message(message)
TRAY_NAME_UPDATE
/**
* Plant Death Proc.
* Cleans up various stats for the plant upon death, including pests, harvestability, and plant health.
Expand Down

0 comments on commit c93bfee

Please sign in to comment.