mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-19 02:56:14 +01:00
Fixes infinite loop issues with plant controller.
This commit is contained in:
@@ -66,8 +66,8 @@
|
||||
del(src)
|
||||
return
|
||||
|
||||
if(plant_controller.product_descs[seed.uid])
|
||||
desc = plant_controller.product_descs[seed.uid]
|
||||
if(plant_controller.product_descs["[seed.uid]"])
|
||||
desc = plant_controller.product_descs["[seed.uid]"]
|
||||
else
|
||||
var/list/descriptors = list()
|
||||
if(reagents.has_reagent("sugar") || reagents.has_reagent("cherryjelly") || reagents.has_reagent("honey") || reagents.has_reagent("berryjuice"))
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
var/global/datum/controller/plants/plant_controller // Set in New().
|
||||
|
||||
/datum/controller/plants
|
||||
|
||||
var/plants_per_tick = PLANTS_PER_TICK
|
||||
var/plant_tick_time = PLANT_TICK_TIME
|
||||
|
||||
var/list/product_descs = list() // Stores generated fruit descs.
|
||||
var/list/next_plants = list() // All queued plants.
|
||||
var/list/seeds = list() // All seed data stored here.
|
||||
@@ -118,11 +122,12 @@ var/global/datum/controller/plants/plant_controller // Set in New().
|
||||
var/processed = 0
|
||||
while(1)
|
||||
if(!processing)
|
||||
sleep(PLANT_TICK_TIME)
|
||||
sleep(plant_tick_time)
|
||||
else
|
||||
processed = 0
|
||||
var/list/plants = next_plants
|
||||
next_plants = list()
|
||||
for(var/x=0;x<PLANTS_PER_TICK;x++)
|
||||
for(var/x=0;x<plants_per_tick;x++)
|
||||
if(!plants.len)
|
||||
break
|
||||
sleep(-1)
|
||||
@@ -132,7 +137,7 @@ var/global/datum/controller/plants/plant_controller // Set in New().
|
||||
processed++
|
||||
if(plants.len)
|
||||
next_plants |= plants
|
||||
sleep(PLANT_TICK_TIME - processed)
|
||||
sleep(plant_tick_time - processed)
|
||||
|
||||
/datum/controller/plants/proc/add_plant(var/obj/effect/plant/plant)
|
||||
next_plants |= plant
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/obj/effect/plant/HasProximity(var/atom/movable/AM)
|
||||
|
||||
plant_controller.add_plant(src)
|
||||
if(!is_mature() || seed.get_trait(TRAIT_SPREAD) != 2)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user