diff --git a/code/__defines/exosuit_fab.dm b/code/__defines/exosuit_fab.dm new file mode 100644 index 0000000000..dce03c9301 --- /dev/null +++ b/code/__defines/exosuit_fab.dm @@ -0,0 +1,28 @@ +/// Module is compatible with Security Cyborg models +#define BORG_MODULE_SECURITY (1<<0) +/// Module is compatible with Miner Cyborg models +#define BORG_MODULE_MINER (1<<1) +/// Module is compatible with Janitor Cyborg models +#define BORG_MODULE_JANITOR (1<<2) +/// Module is compatible with Medical Cyborg models +#define BORG_MODULE_MEDICAL (1<<3) +/// Module is compatible with Engineering Cyborg models +#define BORG_MODULE_ENGINEERING (1<<4) + +/// Module is compatible with Ripley Exosuit models +#define EXOSUIT_MODULE_RIPLEY (1<<0) +/// Module is compatible with Odyseeus Exosuit models +#define EXOSUIT_MODULE_ODYSSEUS (1<<1) +/// Module is compatible with Gygax Exosuit models +#define EXOSUIT_MODULE_GYGAX (1<<2) +/// Module is compatible with Durand Exosuit models +#define EXOSUIT_MODULE_DURAND (1<<3) +/// Module is compatible with Phazon Exosuit models +#define EXOSUIT_MODULE_PHAZON (1<<4) + +/// Module is compatible with "Working" Exosuit models - Ripley +#define EXOSUIT_MODULE_WORKING EXOSUIT_MODULE_RIPLEY +/// Module is compatible with "Combat" Exosuit models - Gygax, Durand and Phazon +#define EXOSUIT_MODULE_COMBAT EXOSUIT_MODULE_GYGAX | EXOSUIT_MODULE_DURAND | EXOSUIT_MODULE_PHAZON +/// Module is compatible with "Medical" Exosuit modelsm - Odysseus +#define EXOSUIT_MODULE_MEDICAL EXOSUIT_MODULE_ODYSSEUS diff --git a/code/modules/hydroponics/_hydro_setup.dm b/code/__defines/plants.dm similarity index 100% rename from code/modules/hydroponics/_hydro_setup.dm rename to code/__defines/plants.dm diff --git a/code/__defines/subsystems.dm b/code/__defines/subsystems.dm index 4e333dac06..d0a5d72c86 100644 --- a/code/__defines/subsystems.dm +++ b/code/__defines/subsystems.dm @@ -57,6 +57,7 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G #define INIT_ORDER_SKYBOX 30 #define INIT_ORDER_MAPPING 25 #define INIT_ORDER_DECALS 20 +#define INIT_ORDER_PLANTS 18 // Must initialize before atoms. #define INIT_ORDER_JOB 17 #define INIT_ORDER_ALARM 16 // Must initialize before atoms. #define INIT_ORDER_ATOMS 15 @@ -87,6 +88,7 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G #define FIRE_PRIORITY_SHUTTLES 5 #define FIRE_PRIORITY_SUPPLY 5 #define FIRE_PRIORITY_NIGHTSHIFT 5 +#define FIRE_PRIORITY_PLANTS 5 #define FIRE_PRIORITY_ORBIT 8 #define FIRE_PRIORITY_VOTE 9 #define FIRE_PRIORITY_AI 10 diff --git a/code/modules/hydroponics/seed_controller.dm b/code/controllers/subsystems/plants.dm similarity index 70% rename from code/modules/hydroponics/seed_controller.dm rename to code/controllers/subsystems/plants.dm index 28315b361a..4bcf49a3b0 100644 --- a/code/modules/hydroponics/seed_controller.dm +++ b/code/controllers/subsystems/plants.dm @@ -1,32 +1,12 @@ -// Attempts to offload processing for the spreading plants from the MC. -// Processes vines/spreading plants. - -#define PLANTS_PER_TICK 500 // Cap on number of plant segments processed. #define PLANT_TICK_TIME 75 // Number of ticks between the plant processor cycling. -// Debug for testing seed genes. -/client/proc/show_plant_genes() - set category = "Debug" - set name = "Show Plant Genes" - set desc = "Prints the round's plant gene masks." +SUBSYSTEM_DEF(plants) + name = "Plants" + init_order = INIT_ORDER_PLANTS + priority = FIRE_PRIORITY_PLANTS + wait = PLANT_TICK_TIME - if(!holder) return - - if(!plant_controller || !plant_controller.gene_tag_masks) - to_chat(usr, "Gene masks not set.") - return - - for(var/mask in plant_controller.gene_tag_masks) - to_chat(usr, "[mask]: [plant_controller.gene_tag_masks[mask]]") - -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/plant_queue = list() // All queued plants. var/list/seeds = list() // All seed data stored here. var/list/gene_tag_masks = list() // Gene obfuscation for delicious trial and error goodness. var/list/plant_icon_cache = list() // Stores images of growth, fruits and seeds. @@ -34,24 +14,26 @@ var/global/datum/controller/plants/plant_controller // Set in New(). var/list/accessible_plant_sprites = list() // List of all plant sprites allowed to appear in random generation. var/list/plant_product_sprites = list() // List of all harvested product sprites. var/list/accessible_product_sprites = list() // List of all product sprites allowed to appear in random generation. - var/processing = 0 // Off/on. var/list/gene_masked_list = list() // Stored gene masked list, rather than recreating it when needed. var/list/plant_gene_datums = list() // Stored datum versions of the gene masked list. -/datum/controller/plants/New() - if(plant_controller && plant_controller != src) - log_debug("Rebuilding plant controller.") - qdel(plant_controller) - plant_controller = src + // To be clear, the only thing this processes are spreading plants + // Hydro trays and growing food normally just chill in SSobj + var/list/processing = list() + var/list/currentrun = list() + +/datum/controller/subsystem/plants/stat_entry() + ..("P:[processing.len]|S:[seeds.len]") + +/datum/controller/subsystem/plants/Initialize(timeofday) setup() - process() + return ..() // Predefined/roundstart varieties use a string key to make it // easier to grab the new variety when mutating. Post-roundstart // and mutant varieties use their uid converted to a string instead. // Looks like shit but it's sort of necessary. -/datum/controller/plants/proc/setup() - +/datum/controller/subsystem/plants/proc/setup() // Build the icon lists. for(var/icostate in cached_icon_states('icons/obj/hydroponics_growing.dmi')) var/split = findtext(icostate,"-") @@ -116,10 +98,10 @@ var/global/datum/controller/plants/plant_controller // Set in New(). gene_masked_list.Add(list(list("tag" = gene_tag, "mask" = gene_mask))) // Proc for creating a random seed type. -/datum/controller/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 = plant_controller.seeds.len + 1 + seed.uid = SSplants.seeds.len + 1 seed.name = "[seed.uid]" seeds[seed.name] = seed @@ -138,32 +120,41 @@ var/global/datum/controller/plants/plant_controller // Set in New(). seed.set_trait(TRAIT_HIGHKPA_TOLERANCE,200) return seed -/datum/controller/plants/process() - processing = 1 - spawn(0) - set background = 1 - var/processed = 0 - while(1) - if(!processing) - sleep(plant_tick_time) - else - processed = 0 - if(plant_queue.len) - var/target_to_process = min(plant_queue.len,plants_per_tick) - for(var/x=0;x