From dcd2a1f606ffac5aa193da9bf2e79838452fde17 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 8 Apr 2019 16:15:29 -0400 Subject: [PATCH 1/4] Ports Chemistry/NanoUI Fixes Early Direct port of https://github.com/PolarisSS13/Polaris/pull/6039 --- code/controllers/subsystems/nanoui.dm | 11 ++++- .../subsystems/processing/chemistry.dm | 12 +++-- code/modules/nano/nanomanager.dm | 16 +------ code/modules/reagents/Chemistry-Holder.dm | 46 ++++++++----------- 4 files changed, 36 insertions(+), 49 deletions(-) diff --git a/code/controllers/subsystems/nanoui.dm b/code/controllers/subsystems/nanoui.dm index c31449addcf..7512ad872e9 100644 --- a/code/controllers/subsystems/nanoui.dm +++ b/code/controllers/subsystems/nanoui.dm @@ -1,6 +1,6 @@ SUBSYSTEM_DEF(nanoui) name = "NanoUI" - wait = 20 + wait = 5 // a list of current open /nanoui UIs, grouped by src_object and ui_key var/list/open_uis = list() // a list of current open /nanoui UIs, not grouped, for use in processing @@ -23,6 +23,8 @@ SUBSYSTEM_DEF(nanoui) if(copytext(filename, length(filename)) != "/") // filenames which end in "/" are actually directories, which we want to ignore if(fexists(path + filename)) asset_files.Add(fcopy_rsc(path + filename)) // add this file to asset_files for sending to clients when they connect + for(var/i in GLOB.clients) + addtimer(CALLBACK(src, .proc/send_resources, i), 10) return ..() /datum/controller/subsystem/nanoui/Recover() @@ -40,3 +42,10 @@ SUBSYSTEM_DEF(nanoui) for(var/thing in processing_uis) var/datum/nanoui/UI = thing UI.process() + +//Sends asset files to a client, called on client/New() +/datum/controller/subsystem/nanoui/proc/send_resources(client) + if(!subsystem_initialized) + return + for(var/file in asset_files) + client << browse_rsc(file) // send the file to the client \ No newline at end of file diff --git a/code/controllers/subsystems/processing/chemistry.dm b/code/controllers/subsystems/processing/chemistry.dm index 67b74d3ab64..34094f9fe39 100644 --- a/code/controllers/subsystems/processing/chemistry.dm +++ b/code/controllers/subsystems/processing/chemistry.dm @@ -4,6 +4,7 @@ PROCESSING_SUBSYSTEM_DEF(chemistry) flags = SS_BACKGROUND|SS_POST_FIRE_TIMING init_order = INIT_ORDER_CHEMISTRY var/list/chemical_reactions = list() + var/list/chemical_reactions_by_reagent = list() var/list/chemical_reagents = list() /datum/controller/subsystem/processing/chemistry/Recover() @@ -22,15 +23,16 @@ PROCESSING_SUBSYSTEM_DEF(chemistry) // more than one chemical it will still only appear in only one of the sublists. /datum/controller/subsystem/processing/chemistry/proc/initialize_chemical_reactions() var/paths = typesof(/datum/chemical_reaction) - /datum/chemical_reaction - SSchemistry.chemical_reactions = list() + chemical_reactions = list() + chemical_reactions_by_reagent = list() for(var/path in paths) - var/datum/chemical_reaction/D = new path() + var/datum/chemical_reaction/D = new path + chemical_reactions += D if(D.required_reagents && D.required_reagents.len) var/reagent_id = D.required_reagents[1] - if(!chemical_reactions[reagent_id]) - chemical_reactions[reagent_id] = list() - chemical_reactions[reagent_id] += D + LAZYINITLIST(chemical_reactions_by_reagent[reagent_id]) + chemical_reactions_by_reagent[reagent_id] += D //Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id /datum/controller/subsystem/processing/chemistry/proc/initialize_chemical_reagents() diff --git a/code/modules/nano/nanomanager.dm b/code/modules/nano/nanomanager.dm index afa779895af..69b0e7b77ea 100644 --- a/code/modules/nano/nanomanager.dm +++ b/code/modules/nano/nanomanager.dm @@ -221,18 +221,4 @@ oldMob.open_uis.Cut() - return 1 // success - - /** - * Sends all nano assets to the client - * This is called on user login - * - * @param client /client The user's client - * - * @return nothing - */ - -/datum/controller/subsystem/nanoui/proc/send_resources(client) - for(var/file in asset_files) - client << browse_rsc(file) // send the file to the client - + return 1 // success \ No newline at end of file diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 2d906381d12..7a39bfcb321 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -77,41 +77,31 @@ return /datum/reagents/proc/handle_reactions() - START_PROCESSING(SSchemistry, src) - -//returns 1 if the holder should continue reactiong, 0 otherwise. -/datum/reagents/process() - if(QDELETED(my_atom)) //No container, no reaction. - return PROCESS_KILL - if(my_atom.flags & NOREACT) // No reactions here - return PROCESS_KILL - - var/reaction_occured - var/list/effect_reactions = list() + if(QDELETED(my_atom)) + return FALSE + if(my_atom.flags & NOREACT) + return FALSE + var/reaction_occurred var/list/eligible_reactions = list() - for(var/i in 1 to PROCESS_REACTION_ITER) - reaction_occured = 0 + var/list/effect_reactions = list() + do + reaction_occurred = FALSE + for(var/i in reagent_list) + var/datum/reagent/R = i + eligible_reactions |= SSchemistry.chemical_reactions_by_reagent[R.id] - //need to rebuild this to account for chain reactions - for(var/datum/reagent/R in reagent_list) - eligible_reactions |= SSchemistry.chemical_reactions[R.id] - - for(var/datum/chemical_reaction/C in eligible_reactions) + for(var/i in eligible_reactions) + var/datum/chemical_reaction/C = i if(C.can_happen(src) && C.process(src)) effect_reactions |= C - reaction_occured = 1 - eligible_reactions.Cut() - - if(!reaction_occured) - break - - for(var/datum/chemical_reaction/C in effect_reactions) + reaction_occurred = TRUE + eligible_reactions.len = 0 + while(reaction_occurred) + for(var/i in effect_reactions) + var/datum/chemical_reaction/C = i C.post_reaction(src) - update_total() - if(!reaction_occured) - return PROCESS_KILL /* Holder-to-chemical */ From 26317c4017adbc7ab195299e9fcc2f70fd1a8e82 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 8 Apr 2019 16:18:53 -0400 Subject: [PATCH 2/4] Removes whitespace --- code/modules/reagents/Chemistry-Holder.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 7a39bfcb321..4d863d80461 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -94,7 +94,6 @@ var/datum/chemical_reaction/C = i if(C.can_happen(src) && C.process(src)) effect_reactions |= C - reaction_occurred = TRUE eligible_reactions.len = 0 while(reaction_occurred) From cecbac283172f6bdb81563fcde8ec4110973bee6 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 10 Apr 2019 18:53:15 -0400 Subject: [PATCH 3/4] Emergency fix to Timer Subsystem --- code/__defines/_tick.dm | 2 +- code/__defines/subsystems.dm | 1 + code/controllers/subsystems/timer.dm | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/__defines/_tick.dm b/code/__defines/_tick.dm index 54ac7d398d9..c57f7702968 100644 --- a/code/__defines/_tick.dm +++ b/code/__defines/_tick.dm @@ -1,5 +1,5 @@ -#define TICK_LIMIT_RUNNING 80 +#define TICK_LIMIT_RUNNING 120 //VOREStation Emergency Edit #define TICK_LIMIT_TO_RUN 70 #define TICK_LIMIT_MC 70 #define TICK_LIMIT_MC_INIT_DEFAULT 98 diff --git a/code/__defines/subsystems.dm b/code/__defines/subsystems.dm index ac480237b5e..767941d58f5 100644 --- a/code/__defines/subsystems.dm +++ b/code/__defines/subsystems.dm @@ -73,6 +73,7 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G // Subsystem fire priority, from lowest to highest priority // If the subsystem isn't listed here it's either DEFAULT or PROCESS (if it's a processing subsystem child) #define FIRE_PRIORITY_SHUTTLES 5 +#define FIRE_PRIORITY_TIMERS 7 //VOREStation Emergency Edit #define FIRE_PRIORITY_ORBIT 8 #define FIRE_PRIORITY_VOTE 9 #define FIRE_PRIORITY_AI 10 diff --git a/code/controllers/subsystems/timer.dm b/code/controllers/subsystems/timer.dm index 3cd4ffe6bab..b743e8ff9e3 100644 --- a/code/controllers/subsystems/timer.dm +++ b/code/controllers/subsystems/timer.dm @@ -6,6 +6,7 @@ SUBSYSTEM_DEF(timer) name = "Timer" wait = 1 //SS_TICKER subsystem, so wait is in ticks + priority = FIRE_PRIORITY_TIMERS //VOREStation Emergency Edit init_order = INIT_ORDER_TIMER flags = SS_TICKER|SS_NO_INIT From 569723547cfc10035c49a144176b0d0e84a31392 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 10 Apr 2019 18:55:36 -0400 Subject: [PATCH 4/4] Okay this was not a good change --- code/__defines/_tick.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/__defines/_tick.dm b/code/__defines/_tick.dm index c57f7702968..1f112f711ba 100644 --- a/code/__defines/_tick.dm +++ b/code/__defines/_tick.dm @@ -1,5 +1,5 @@ -#define TICK_LIMIT_RUNNING 120 //VOREStation Emergency Edit +#define TICK_LIMIT_RUNNING 85 //VOREStation Emergency Edit #define TICK_LIMIT_TO_RUN 70 #define TICK_LIMIT_MC 70 #define TICK_LIMIT_MC_INIT_DEFAULT 98