mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-18 19:39:42 +01:00
Fix some issues with SSplants processing (#3417)
Fixes some issues where plants would not get removed from their processing list properly.
This commit is contained in:
+1
-1
@@ -168,6 +168,7 @@
|
||||
#include "code\controllers\subsystems\orbit.dm"
|
||||
#include "code\controllers\subsystems\pai.dm"
|
||||
#include "code\controllers\subsystems\parallax.dm"
|
||||
#include "code\controllers\subsystems\plants.dm"
|
||||
#include "code\controllers\subsystems\power.dm"
|
||||
#include "code\controllers\subsystems\radio.dm"
|
||||
#include "code\controllers\subsystems\statistics.dm"
|
||||
@@ -193,7 +194,6 @@
|
||||
#include "code\controllers\subsystems\processing\nanoui.dm"
|
||||
#include "code\controllers\subsystems\processing\overlays.dm"
|
||||
#include "code\controllers\subsystems\processing\pipenet.dm"
|
||||
#include "code\controllers\subsystems\processing\plants.dm"
|
||||
#include "code\controllers\subsystems\processing\processing.dm"
|
||||
#include "code\controllers\subsystems\processing\shuttle.dm"
|
||||
#include "code\datums\ai_law_sets.dm"
|
||||
|
||||
+29
-6
@@ -1,6 +1,6 @@
|
||||
/var/datum/controller/subsystem/processing/plants/SSplants
|
||||
/var/datum/controller/subsystem/plants/SSplants
|
||||
|
||||
/datum/controller/subsystem/processing/plants
|
||||
/datum/controller/subsystem/plants
|
||||
name = "Seeds & Plants"
|
||||
flags = 0 // Override parent's flags.
|
||||
wait = 75
|
||||
@@ -14,10 +14,15 @@
|
||||
var/list/plant_sprites = list() // List of all harvested product sprites.
|
||||
var/list/plant_product_sprites = list() // List of all growth sprites plus number of growth stages.
|
||||
|
||||
/datum/controller/subsystem/processing/plants/New()
|
||||
var/list/processing = list()
|
||||
|
||||
/datum/controller/subsystem/plants/New()
|
||||
NEW_SS_GLOBAL(SSplants)
|
||||
|
||||
/datum/controller/subsystem/processing/plants/Initialize(timeofday)
|
||||
/datum/controller/subsystem/plants/stat_entry()
|
||||
..("P:[processing.len]")
|
||||
|
||||
/datum/controller/subsystem/plants/Initialize(timeofday)
|
||||
// Build the icon lists.
|
||||
for(var/icostate in icon_states('icons/obj/hydroponics_growing.dmi'))
|
||||
var/split = findtext(icostate,"-")
|
||||
@@ -63,7 +68,7 @@
|
||||
|
||||
..()
|
||||
|
||||
/datum/controller/subsystem/processing/plants/Recover()
|
||||
/datum/controller/subsystem/plants/Recover()
|
||||
if (istype(SSplants))
|
||||
src.product_descs = SSplants.product_descs
|
||||
src.seeds = SSplants.seeds
|
||||
@@ -72,8 +77,26 @@
|
||||
src.plant_sprites = SSplants.plant_sprites
|
||||
src.plant_product_sprites = SSplants.plant_product_sprites
|
||||
|
||||
/datum/controller/subsystem/plants/fire(resumed = 0)
|
||||
var/list/queue = processing
|
||||
while (queue.len)
|
||||
var/obj/effect/plant/P = queue[queue.len]
|
||||
queue.len--
|
||||
|
||||
if (!QDELETED(P))
|
||||
P.process()
|
||||
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/plants/proc/add_plant(obj/effect/plant/plant)
|
||||
processing[plant] = TRUE
|
||||
|
||||
/datum/controller/subsystem/plants/proc/remove_plant(obj/effect/plant/plant)
|
||||
processing -= plant
|
||||
|
||||
// Proc for creating a random seed type.
|
||||
/datum/controller/subsystem/processing/plants/proc/create_random_seed(var/survive_on_station)
|
||||
/datum/controller/subsystem/plants/proc/create_random_seed(var/survive_on_station)
|
||||
var/datum/seed/seed = new()
|
||||
seed.randomize()
|
||||
seed.uid = seeds.len + 1
|
||||
@@ -67,11 +67,10 @@
|
||||
var/last_biolum = null
|
||||
|
||||
/obj/effect/plant/Destroy()
|
||||
if(SSplants)
|
||||
STOP_PROCESSING(SSplants, src)
|
||||
SSplants.remove_plant(src)
|
||||
for(var/obj/effect/plant/neighbor in range(1,src))
|
||||
if (!QDELETED(neighbor))
|
||||
START_PROCESSING(SSplants, neighbor)
|
||||
SSplants.add_plant(neighbor)
|
||||
return ..()
|
||||
|
||||
/obj/effect/plant/single
|
||||
@@ -129,7 +128,7 @@
|
||||
/obj/effect/plant/proc/post_initialize()
|
||||
set_dir(calc_dir())
|
||||
update_icon()
|
||||
START_PROCESSING(SSplants, src)
|
||||
SSplants.add_plant(src)
|
||||
// Some plants eat through plating.
|
||||
if(islist(seed.chems) && !isnull(seed.chems["pacid"]))
|
||||
var/turf/T = get_turf(src)
|
||||
@@ -239,9 +238,9 @@
|
||||
/obj/effect/plant/attackby(var/obj/item/weapon/W, var/mob/user)
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
START_PROCESSING(SSplants, src)
|
||||
SSplants.add_plant(src)
|
||||
|
||||
if(istype(W, /obj/item/weapon/wirecutters) || istype(W, /obj/item/weapon/scalpel))
|
||||
if(iswirecutter(W) || istype(W, /obj/item/weapon/scalpel))
|
||||
if(sampled)
|
||||
user << "<span class='warning'>\The [src] has already been sampled recently.</span>"
|
||||
return
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
if(!Adjacent(floor) || !floor.Enter(src))
|
||||
continue
|
||||
neighbors |= floor
|
||||
|
||||
if (neighbors.len)
|
||||
SSplants.add_plant(src)
|
||||
|
||||
// Update all of our friends.
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/obj/effect/plant/neighbor in range(1,src))
|
||||
@@ -82,8 +86,8 @@
|
||||
|
||||
// We shouldn't have spawned if the controller doesn't exist.
|
||||
check_health()
|
||||
if(neighbors.len || health != max_health)
|
||||
START_PROCESSING(SSplants, src)
|
||||
if(neighbors.len || health != max_health || buckled_mob)
|
||||
SSplants.add_plant(src)
|
||||
|
||||
/obj/effect/plant/proc/do_spread(spread_chance, max_spread)
|
||||
for(var/i in 1 to max_spread)
|
||||
@@ -113,7 +117,7 @@
|
||||
continue
|
||||
for(var/obj/effect/plant/neighbor in check_turf.contents)
|
||||
neighbor.neighbors |= check_turf
|
||||
START_PROCESSING(SSplants, neighbor)
|
||||
SSplants.add_plant(neighbor)
|
||||
|
||||
QDEL_IN(src, 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user