diff --git a/.editorconfig b/.editorconfig index 471170c449..954cb72e8f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,10 +1,12 @@ +# http://editorconfig.org +root = true + [*] indent_style = tab -indent_size = 4 +end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -end_of_line = lf [*.yml] indent_style = space @@ -17,4 +19,4 @@ indent_style = space trim_trailing_whitespace = false [Dockerfile] -indent_style = space +indent_style = space \ No newline at end of file diff --git a/.tgs.yml b/.tgs.yml index 66dc698137..3175197c31 100644 --- a/.tgs.yml +++ b/.tgs.yml @@ -3,7 +3,7 @@ version: 1 # The BYOND version to use (kept in sync with dependencies.sh by the "TGS Test Suite" CI job) # Must be interpreted as a string, keep quoted -byond: "514.1589" +byond: "515.1634" # Folders to create in "/Configuration/GameStaticFiles/" static_files: # Config directory should be static diff --git a/auxmos.dll b/auxmos.dll index c465a14e53..44e011ff8d 100644 Binary files a/auxmos.dll and b/auxmos.dll differ diff --git a/auxmos.pdb b/auxmos.pdb index c0e3bae993..7a7f2d12cb 100644 Binary files a/auxmos.pdb and b/auxmos.pdb differ diff --git a/code/__DEFINES/_auxtools.dm b/code/__DEFINES/_auxtools.dm deleted file mode 100644 index fc5dfd4378..0000000000 --- a/code/__DEFINES/_auxtools.dm +++ /dev/null @@ -1,12 +0,0 @@ -#define AUXMOS (world.system_type == MS_WINDOWS ? "auxmos.dll" : __detect_auxmos()) - -/proc/__detect_auxmos() - var/static/known_auxmos_var - if(!known_auxmos_var) - if (fexists("./libauxmos.so")) - known_auxmos_var = "./libauxmos.so" - else if (fexists("[world.GetConfig("env", "HOME")]/.byond/bin/libauxmos.so")) - known_auxmos_var = "[world.GetConfig("env", "HOME")]/.byond/bin/libauxmos.so" - else - CRASH("Could not find libauxmos.so") - return known_auxmos_var diff --git a/code/__DEFINES/bindings.dm b/code/__DEFINES/bindings.dm new file mode 100644 index 0000000000..f7d94e15b0 --- /dev/null +++ b/code/__DEFINES/bindings.dm @@ -0,0 +1,185 @@ +//THIS FILE IS AUTOMATICALLY GENERATED BY AUXMOS, PLEASE DO NOT TOUCH IT +//PROC DEFINITIONS MAY MOVE AROUND, THIS IS NORMAL + +/* This comment bypasses grep checks */ /var/__auxmos + +/proc/__detect_auxmos() + if (world.system_type == UNIX) + return __auxmos = "libauxmos" + else + return __auxmos = "auxmos" + +#define AUXMOS (__auxmos || __detect_auxmos()) + +/datum/controller/subsystem/air/proc/process_turf_equalize_auxtools(remaining) + return LIBCALL(AUXMOS, "byond:equalize_hook_ffi")(src, remaining) + +/datum/controller/subsystem/air/proc/process_excited_groups_auxtools(remaining) + return LIBCALL(AUXMOS, "byond:groups_hook_ffi")(src, remaining) + +/datum/controller/subsystem/air/proc/process_turfs_auxtools(remaining) + return LIBCALL(AUXMOS, "byond:process_turf_hook_ffi")(src, remaining) + +/datum/controller/subsystem/air/proc/finish_turf_processing_auxtools(time_remaining) + return LIBCALL(AUXMOS, "byond:finish_process_turfs_ffi")(time_remaining) + +/datum/controller/subsystem/air/proc/thread_running() + return LIBCALL(AUXMOS, "byond:thread_running_hook_ffi")() + +/turf/proc/__update_auxtools_turf_adjacency_info() + return LIBCALL(AUXMOS, "byond:hook_infos_ffi")(src) + +/turf/proc/update_air_ref(flag) + return LIBCALL(AUXMOS, "byond:hook_register_turf_ffi")(src, flag) + +/proc/finalize_gas_refs() + return LIBCALL(AUXMOS, "byond:finalize_gas_refs_ffi")() + +/datum/controller/subsystem/air/proc/auxtools_update_reactions() + return LIBCALL(AUXMOS, "byond:update_reactions_ffi")() + +/proc/auxtools_atmos_init(gas_data) + return LIBCALL(AUXMOS, "byond:hook_init_ffi")(gas_data) + +/proc/_auxtools_register_gas(gas) + return LIBCALL(AUXMOS, "byond:hook_register_gas_ffi")(gas) + +/datum/gas_mixture/proc/__auxtools_parse_gas_string(string) + return LIBCALL(AUXMOS, "byond:parse_gas_string_ffi")(src, string) + +/datum/controller/subsystem/air/proc/get_max_gas_mixes() + return LIBCALL(AUXMOS, "byond:hook_max_gas_mixes_ffi")() + +/datum/controller/subsystem/air/proc/get_amt_gas_mixes() + return LIBCALL(AUXMOS, "byond:hook_amt_gas_mixes_ffi")() + +/proc/equalize_all_gases_in_list(gas_list) + return LIBCALL(AUXMOS, "byond:equalize_all_hook_ffi")(gas_list) + +/datum/gas_mixture/proc/get_oxidation_power(temp) + return LIBCALL(AUXMOS, "byond:oxidation_power_hook_ffi")(src, temp) + +/datum/gas_mixture/proc/get_fuel_amount(temp) + return LIBCALL(AUXMOS, "byond:fuel_amount_hook_ffi")(src, temp) + +/datum/gas_mixture/proc/equalize_with(total) + return LIBCALL(AUXMOS, "byond:equalize_with_hook_ffi")(src, total) + +/datum/gas_mixture/proc/transfer_ratio_to(other, ratio) + return LIBCALL(AUXMOS, "byond:transfer_ratio_hook_ffi")(src, other, ratio) + +/datum/gas_mixture/proc/transfer_to(other, moles) + return LIBCALL(AUXMOS, "byond:transfer_hook_ffi")(src, other, moles) + +/datum/gas_mixture/proc/adjust_heat(temp) + return LIBCALL(AUXMOS, "byond:adjust_heat_hook_ffi")(src, temp) + +/datum/gas_mixture/proc/react(holder) + return LIBCALL(AUXMOS, "byond:react_hook_ffi")(src, holder) + +/datum/gas_mixture/proc/compare(other) + return LIBCALL(AUXMOS, "byond:compare_hook_ffi")(src, other) + +/datum/gas_mixture/proc/clear() + return LIBCALL(AUXMOS, "byond:clear_hook_ffi")(src) + +/datum/gas_mixture/proc/mark_immutable() + return LIBCALL(AUXMOS, "byond:mark_immutable_hook_ffi")(src) + +/datum/gas_mixture/proc/scrub_into(into, ratio_v, gas_list) + return LIBCALL(AUXMOS, "byond:scrub_into_hook_ffi")(src, into, ratio_v, gas_list) + +/datum/gas_mixture/proc/get_by_flag(flag_val) + return LIBCALL(AUXMOS, "byond:get_by_flag_hook_ffi")(src, flag_val) + +/datum/gas_mixture/proc/__remove_by_flag(into, flag_val, amount_val) + return LIBCALL(AUXMOS, "byond:remove_by_flag_hook_ffi")(src, into, flag_val, amount_val) + +/datum/gas_mixture/proc/divide(num_val) + return LIBCALL(AUXMOS, "byond:divide_hook_ffi")(src, num_val) + +/datum/gas_mixture/proc/multiply(num_val) + return LIBCALL(AUXMOS, "byond:multiply_hook_ffi")(src, num_val) + +/datum/gas_mixture/proc/subtract(num_val) + return LIBCALL(AUXMOS, "byond:subtract_hook_ffi")(src, num_val) + +/datum/gas_mixture/proc/add(num_val) + return LIBCALL(AUXMOS, "byond:add_hook_ffi")(src, num_val) + +/datum/gas_mixture/proc/adjust_multi(...) + var/list/args_copy = args.Copy() + args_copy.Insert(1, src) + return LIBCALL(AUXMOS, "byond:adjust_multi_hook_ffi")(arglist(args_copy)) + +/datum/gas_mixture/proc/adjust_moles_temp(id_val, num_val, temp_val) + return LIBCALL(AUXMOS, "byond:adjust_moles_temp_hook_ffi")(src, id_val, num_val, temp_val) + +/datum/gas_mixture/proc/adjust_moles(id_val, num_val) + return LIBCALL(AUXMOS, "byond:adjust_moles_hook_ffi")(src, id_val, num_val) + +/datum/gas_mixture/proc/set_moles(gas_id, amt_val) + return LIBCALL(AUXMOS, "byond:set_moles_hook_ffi")(src, gas_id, amt_val) + +/datum/gas_mixture/proc/get_moles(gas_id) + return LIBCALL(AUXMOS, "byond:get_moles_hook_ffi")(src, gas_id) + +/datum/gas_mixture/proc/set_volume(vol_arg) + return LIBCALL(AUXMOS, "byond:set_volume_hook_ffi")(src, vol_arg) + +/datum/gas_mixture/proc/partial_heat_capacity(gas_id) + return LIBCALL(AUXMOS, "byond:partial_heat_capacity_ffi")(src, gas_id) + +/datum/gas_mixture/proc/set_temperature(arg_temp) + return LIBCALL(AUXMOS, "byond:set_temperature_hook_ffi")(src, arg_temp) + +/datum/gas_mixture/proc/get_gases() + return LIBCALL(AUXMOS, "byond:get_gases_hook_ffi")(src) + +/datum/gas_mixture/proc/temperature_share(...) + var/list/args_copy = args.Copy() + args_copy.Insert(1, src) + return LIBCALL(AUXMOS, "byond:temperature_share_hook_ffi")(arglist(args_copy)) + +/datum/gas_mixture/proc/copy_from(giver) + return LIBCALL(AUXMOS, "byond:copy_from_hook_ffi")(src, giver) + +/datum/gas_mixture/proc/__remove(into, amount_arg) + return LIBCALL(AUXMOS, "byond:remove_hook_ffi")(src, into, amount_arg) + +/datum/gas_mixture/proc/__remove_ratio(into, ratio_arg) + return LIBCALL(AUXMOS, "byond:remove_ratio_hook_ffi")(src, into, ratio_arg) + +/datum/gas_mixture/proc/merge(giver) + return LIBCALL(AUXMOS, "byond:merge_hook_ffi")(src, giver) + +/datum/gas_mixture/proc/thermal_energy() + return LIBCALL(AUXMOS, "byond:thermal_energy_hook_ffi")(src) + +/datum/gas_mixture/proc/return_volume() + return LIBCALL(AUXMOS, "byond:return_volume_hook_ffi")(src) + +/datum/gas_mixture/proc/return_temperature() + return LIBCALL(AUXMOS, "byond:return_temperature_hook_ffi")(src) + +/datum/gas_mixture/proc/return_pressure() + return LIBCALL(AUXMOS, "byond:return_pressure_hook_ffi")(src) + +/datum/gas_mixture/proc/total_moles() + return LIBCALL(AUXMOS, "byond:total_moles_hook_ffi")(src) + +/datum/gas_mixture/proc/set_min_heat_capacity(arg_min) + return LIBCALL(AUXMOS, "byond:min_heat_cap_hook_ffi")(src, arg_min) + +/datum/gas_mixture/proc/heat_capacity() + return LIBCALL(AUXMOS, "byond:heat_cap_hook_ffi")(src) + +/datum/gas_mixture/proc/__gasmixture_unregister() + return LIBCALL(AUXMOS, "byond:unregister_gasmixture_hook_ffi")(src) + +/datum/gas_mixture/proc/__gasmixture_register() + return LIBCALL(AUXMOS, "byond:register_gasmixture_hook_ffi")(src) + +/proc/process_atmos_callbacks(remaining) + return LIBCALL(AUXMOS, "byond:atmos_callback_handle_ffi")(remaining) + diff --git a/code/__DEFINES/spaceman_dmm.dm b/code/__DEFINES/spaceman_dmm.dm index f15d6a175f..cabb02fd49 100644 --- a/code/__DEFINES/spaceman_dmm.dm +++ b/code/__DEFINES/spaceman_dmm.dm @@ -3,30 +3,72 @@ // The SPACEMAN_DMM define is set by the linter and other tooling when it runs. #ifdef SPACEMAN_DMM + /** + * Sets a return type expression for a proc. The return type can take the forms: + + * `/typepath` - a raw typepath. The return type of the proc is the type named. + + * `param` - a typepath given as a parameter, for procs which return an instance of the passed-in type. + + * `param.type` - the static type of a passed-in parameter, for procs which + * return their input or otherwise another value of the same type. + + * `param[_].type` - the static type of a passed-in parameter, with one level + * of `/list` stripped, for procs which select one item from a list. The `[_]` + * may be repeated to strip more levels of `/list`. + */ #define RETURN_TYPE(X) set SpacemanDMM_return_type = X + /** + * If set, will enable a diagnostic on children of the proc it is set on which do + * not contain any `..()` parent calls. This can help with finding situations + * where a signal or other important handling in the parent proc is being skipped. + * Child procs may set this setting to `0` instead to override the check. + */ #define SHOULD_CALL_PARENT(X) set SpacemanDMM_should_call_parent = X - #define UNLINT(X) SpacemanDMM_unlint(X) + /** + * If set, raise a warning for any child procs that override this one, + * regardless of if it calls parent or not. + * This functions in a similar way to the `final` keyword in some languages. + * This cannot be disabled by child overrides. + */ #define SHOULD_NOT_OVERRIDE(X) set SpacemanDMM_should_not_override = X + /** + * If set, raise a warning if the proc or one of the sub-procs it calls + * uses a blocking call, such as `sleep()` or `input()` without using `set waitfor = 0` + * This cannot be disabled by child overrides. + */ #define SHOULD_NOT_SLEEP(X) set SpacemanDMM_should_not_sleep = X + /** + * If set, ensure a proc is 'pure', such that it does not make any changes + * outside itself or output. This also checks to make sure anything using + * this proc doesn't invoke it without making use of the return value. + * This cannot be disabled by child overrides. + */ #define SHOULD_BE_PURE(X) set SpacemanDMM_should_be_pure = X + ///Private procs can only be called by things of exactly the same type. #define PRIVATE_PROC(X) set SpacemanDMM_private_proc = X + ///Protected procs can only be call by things of the same type *or subtypes*. #define PROTECTED_PROC(X) set SpacemanDMM_protected_proc = X + ///If set, will not lint. + #define UNLINT(X) SpacemanDMM_unlint(X) + + ///If set, overriding their value isn't permitted by types that inherit it. #define VAR_FINAL var/SpacemanDMM_final + ///Private vars can only be called by things of exactly the same type. #define VAR_PRIVATE var/SpacemanDMM_private + ///Protected vars can only be called by things of the same type *or subtypes*. #define VAR_PROTECTED var/SpacemanDMM_protected #else #define RETURN_TYPE(X) #define SHOULD_CALL_PARENT(X) - #define UNLINT(X) X #define SHOULD_NOT_OVERRIDE(X) #define SHOULD_NOT_SLEEP(X) #define SHOULD_BE_PURE(X) #define PRIVATE_PROC(X) #define PROTECTED_PROC(X) + #define UNLINT(X) X + #define VAR_FINAL var #define VAR_PRIVATE var #define VAR_PROTECTED var #endif - -/proc/enable_debugging() - CRASH("Auxtools not found") diff --git a/code/__HELPERS/_auxtools_api.dm b/code/__HELPERS/_auxtools_api.dm new file mode 100644 index 0000000000..8dbd58f2ee --- /dev/null +++ b/code/__HELPERS/_auxtools_api.dm @@ -0,0 +1,43 @@ +#define AUXTOOLS_FULL_INIT 2 +#define AUXTOOLS_PARTIAL_INIT 1 + +GLOBAL_LIST_EMPTY(auxtools_initialized) +GLOBAL_PROTECT(auxtools_initialized) + +#define AUXTOOLS_CHECK(LIB)\ + if (!CONFIG_GET(flag/auxtools_enabled)) {\ + CRASH("Auxtools is not enabled in config!");\ + }\ + if (GLOB.auxtools_initialized[LIB] != AUXTOOLS_FULL_INIT) {\ + if (fexists(LIB)) {\ + var/string = LIBCALL(LIB,"auxtools_init")();\ + if(findtext(string, "SUCCESS")) {\ + GLOB.auxtools_initialized[LIB] = AUXTOOLS_FULL_INIT;\ + } else {\ + CRASH(string);\ + }\ + } else {\ + CRASH("No file named [LIB] found!")\ + }\ + }\ + +#define AUXTOOLS_SHUTDOWN(LIB)\ + if (GLOB.auxtools_initialized[LIB] == AUXTOOLS_FULL_INIT && fexists(LIB)){\ + LIBCALL(LIB,"auxtools_shutdown")();\ + GLOB.auxtools_initialized[LIB] = AUXTOOLS_PARTIAL_INIT;\ + }\ + +#define AUXTOOLS_FULL_SHUTDOWN(LIB)\ + if (GLOB.auxtools_initialized[LIB] && fexists(LIB)){\ + LIBCALL(LIB,"auxtools_full_shutdown")();\ + GLOB.auxtools_initialized[LIB] = FALSE;\ + } + +/proc/auxtools_stack_trace(msg) + CRASH(msg) + +/proc/auxtools_expr_stub() + CRASH("auxtools not loaded") + +/proc/enable_debugging(mode, port) + CRASH("auxtools not loaded") diff --git a/code/__HELPERS/_extools_api.dm b/code/__HELPERS/_extools_api.dm deleted file mode 100644 index 18866d571a..0000000000 --- a/code/__HELPERS/_extools_api.dm +++ /dev/null @@ -1,31 +0,0 @@ -//#define EXTOOLS_LOGGING // rust_g is used as a fallback if this is undefined - -/proc/extools_log_write() - -/proc/extools_finalize_logging() - -/proc/auxtools_stack_trace(msg) - CRASH(msg) - -//glob doesn't exist yet at some gas new calls, imma use it anyways -GLOBAL_REAL_VAR(list/__auxtools_initialized) = list() - -#define AUXTOOLS_CHECK(LIB)\ - if (!__auxtools_initialized[LIB]) {\ - if (fexists(LIB)) {\ - var/string = LIBCALL(LIB,"auxtools_init")();\ - if(findtext(string, "SUCCESS")) {\ - __auxtools_initialized[LIB] = TRUE;\ - } else {\ - CRASH(string);\ - }\ - } else {\ - CRASH("No file named [LIB] found!")\ - }\ - }\ - -#define AUXTOOLS_SHUTDOWN(LIB)\ - if (__auxtools_initialized[LIB] && fexists(LIB)){\ - LIBCALL(LIB,"auxtools_shutdown")();\ - __auxtools_initialized[LIB] = FALSE;\ - }\ diff --git a/code/__byond_version_compat.dm b/code/__byond_version_compat.dm index ff1a1a1d97..43307b5ce1 100644 --- a/code/__byond_version_compat.dm +++ b/code/__byond_version_compat.dm @@ -1,12 +1,12 @@ // This file contains defines allowing targeting byond versions newer than the supported //Update this whenever you need to take advantage of more recent byond features -#define MIN_COMPILER_VERSION 514 -#define MIN_COMPILER_BUILD 1556 +#define MIN_COMPILER_VERSION 515 +#define MIN_COMPILER_BUILD 1634 #if (DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD) && !defined(SPACEMAN_DMM) //Don't forget to update this part #error Your version of BYOND is too out-of-date to compile this project. Go to https://secure.byond.com/download and update. -#error You need version 514.1556 or higher +#error You need version 515.1634 or higher #endif #if (DM_VERSION == 514 && DM_BUILD > 1575 && DM_BUILD <= 1577) diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 715d5eab28..de94b27e77 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -309,7 +309,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new //(higher subsystems will be sooner in the queue, adding them later in the loop means we don't have to loop thru them next queue add) sortTim(tickersubsystems, GLOBAL_PROC_REF(cmp_subsystem_priority)) for(var/I in runlevel_sorted_subsystems) - sortTim(runlevel_sorted_subsystems, GLOBAL_PROC_REF(cmp_subsystem_priority)) + sortTim(I, GLOBAL_PROC_REF(cmp_subsystem_priority)) I += tickersubsystems var/cached_runlevel = current_runlevel diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index 26a51ec2c1..035f5e7453 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -6,6 +6,8 @@ SUBSYSTEM_DEF(air) flags = SS_BACKGROUND runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME + var/cached_cost = 0 + var/cost_turfs = 0 var/cost_groups = 0 var/cost_highpressure = 0 @@ -26,6 +28,9 @@ SUBSYSTEM_DEF(air) var/num_group_turfs_processed = 0 var/num_equalize_processed = 0 + var/gas_mixes_count = 0 + var/gas_mixes_allocated = 0 + var/list/hotspots = list() var/list/networks = list() var/list/pipenets_needing_rebuilt = list() @@ -53,8 +58,6 @@ SUBSYSTEM_DEF(air) var/equalize_hard_turf_limit = 2000 // Whether equalization is enabled. Can be disabled for performance reasons. var/equalize_enabled = FALSE - // When above 0, won't equalize; performance handling - var/eq_cooldown = 0 // Whether turf-to-turf heat exchanging should be enabled. var/heat_enabled = FALSE // Max number of times process_turfs will share in a tick. @@ -65,8 +68,6 @@ SUBSYSTEM_DEF(air) var/excited_group_pressure_goal = 1 // Target for excited_group_pressure_goal; can go below this, if it determines the thread is taking too long. var/excited_group_pressure_goal_target = 1 - // If this is set to 0, monstermos won't process planet atmos - var/planet_equalize_enabled = 0 /datum/controller/subsystem/air/stat_entry(msg) msg += "C:{" @@ -91,8 +92,8 @@ SUBSYSTEM_DEF(air) msg += "LT:[low_pressure_turfs]|" msg += "ET:[num_equalize_processed]|" msg += "GT:[num_group_turfs_processed]|" - msg += "GA:[get_amt_gas_mixes()]|" - msg += "MG:[get_max_gas_mixes()]" + msg += "GA:[gas_mixes_count]|" + msg += "MG:[gas_mixes_allocated]" return ..() /datum/controller/subsystem/air/Initialize(timeofday) @@ -107,7 +108,6 @@ SUBSYSTEM_DEF(air) /datum/controller/subsystem/air/proc/extools_update_ssair() -/datum/controller/subsystem/air/proc/auxtools_update_reactions() /datum/controller/subsystem/air/proc/add_reaction(datum/gas_reaction/r) gas_reactions += r @@ -123,9 +123,6 @@ SUBSYSTEM_DEF(air) message_admins("Air reset done.") SSair.can_fire = 1 -/datum/controller/subsystem/air/proc/thread_running() - return FALSE - /proc/fix_corrupted_atmos() /datum/admins/proc/fixcorruption() @@ -137,6 +134,12 @@ SUBSYSTEM_DEF(air) /datum/controller/subsystem/air/fire(resumed = 0) var/timer = TICK_USAGE_REAL + thread_wait_ticks = MC_AVERAGE(thread_wait_ticks, cur_thread_wait_ticks) + cur_thread_wait_ticks = 0 + + gas_mixes_count = get_amt_gas_mixes() + gas_mixes_allocated = get_max_gas_mixes() + if(currentpart == SSAIR_REBUILD_PIPENETS) timer = TICK_USAGE_REAL var/list/pipenet_rebuilds = pipenets_needing_rebuilt @@ -150,6 +153,30 @@ SUBSYSTEM_DEF(air) if(state != SS_RUNNING) return resumed = FALSE + currentpart = SSAIR_PIPENETS + + if(currentpart == SSAIR_PIPENETS || !resumed) + timer = TICK_USAGE_REAL + if(!resumed) + cached_cost = 0 + process_pipenets(resumed) + cached_cost += TICK_USAGE_REAL - timer + if(state != SS_RUNNING) + return + cost_pipenets = MC_AVERAGE(cost_pipenets, TICK_DELTA_TO_MS(cached_cost)) + resumed = 0 + currentpart = SSAIR_ATMOSMACHINERY + + if(currentpart == SSAIR_ATMOSMACHINERY) + timer = TICK_USAGE_REAL + if(!resumed) + cached_cost = 0 + process_atmos_machinery(resumed) + cached_cost += TICK_USAGE_REAL - timer + if(state != SS_RUNNING) + return + resumed = 0 + cost_atmos_machinery = MC_AVERAGE(cost_atmos_machinery, TICK_DELTA_TO_MS(cached_cost)) currentpart = SSAIR_ACTIVETURFS if(currentpart == SSAIR_ACTIVETURFS) @@ -158,6 +185,13 @@ SUBSYSTEM_DEF(air) if(state != SS_RUNNING) return resumed = 0 + currentpart = equalize_enabled ? SSAIR_EQUALIZE : SSAIR_EXCITEDGROUPS + + if(currentpart == SSAIR_EQUALIZE) + process_turf_equalize(resumed) + if(state != SS_RUNNING) + return + resumed = 0 currentpart = SSAIR_EXCITEDGROUPS if(currentpart == SSAIR_EXCITEDGROUPS) @@ -165,34 +199,10 @@ SUBSYSTEM_DEF(air) if(state != SS_RUNNING) return resumed = 0 - currentpart = equalize_enabled ? SSAIR_EQUALIZE : SSAIR_FINALIZE_TURFS - - if(currentpart == SSAIR_EQUALIZE) - equalize_turfs(resumed) - if(state != SS_RUNNING) - return - resumed = 0 currentpart = SSAIR_FINALIZE_TURFS if(currentpart == SSAIR_FINALIZE_TURFS) finish_turf_processing(resumed) - if(state != SS_RUNNING) - return - resumed = FALSE - currentpart = SSAIR_PIPENETS - - if(currentpart == SSAIR_PIPENETS || !resumed) - timer = TICK_USAGE_REAL - process_pipenets(resumed) - cost_pipenets = MC_AVERAGE(cost_pipenets, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) - if(state != SS_RUNNING) - return - resumed = 0 - currentpart = SSAIR_ATMOSMACHINERY - if(currentpart == SSAIR_ATMOSMACHINERY) - timer = TICK_USAGE_REAL - process_atmos_machinery(resumed) - cost_atmos_machinery = MC_AVERAGE(cost_atmos_machinery, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) if(state != SS_RUNNING) return resumed = 0 @@ -200,21 +210,28 @@ SUBSYSTEM_DEF(air) if(currentpart == SSAIR_HIGHPRESSURE) timer = TICK_USAGE_REAL + if(!resumed) + cached_cost = 0 process_high_pressure_delta(resumed) - cost_highpressure = MC_AVERAGE(cost_highpressure, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) + cached_cost += TICK_USAGE_REAL - timer if(state != SS_RUNNING) return + cost_highpressure = MC_AVERAGE(cost_highpressure, TICK_DELTA_TO_MS(cached_cost)) resumed = 0 currentpart = SSAIR_HOTSPOTS if(currentpart == SSAIR_HOTSPOTS) timer = TICK_USAGE_REAL + if(!resumed) + cached_cost = 0 process_hotspots(resumed) - cost_hotspots = MC_AVERAGE(cost_hotspots, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) + cached_cost += TICK_USAGE_REAL - timer if(state != SS_RUNNING) return + cost_hotspots = MC_AVERAGE(cost_hotspots, TICK_DELTA_TO_MS(cached_cost)) resumed = 0 currentpart = heat_enabled ? SSAIR_TURF_CONDUCTION : SSAIR_REBUILD_PIPENETS + // Heat -- slow and of questionable usefulness. Off by default for this reason. Pretty cool, though. if(currentpart == SSAIR_TURF_CONDUCTION) timer = TICK_USAGE_REAL @@ -309,14 +326,8 @@ SUBSYSTEM_DEF(air) if(post_process_turfs_auxtools(TICK_REMAINING_MS)) pause() -/datum/controller/subsystem/air/proc/finish_turf_processing_auxtools() /datum/controller/subsystem/air/proc/equalize_turfs_auxtools() -/datum/controller/subsystem/air/proc/process_turfs_auxtools() /datum/controller/subsystem/air/proc/post_process_turfs_auxtools() -/datum/controller/subsystem/air/proc/process_turf_equalize_auxtools() -/datum/controller/subsystem/air/proc/process_excited_groups_auxtools() -/datum/controller/subsystem/air/proc/get_amt_gas_mixes() -/datum/controller/subsystem/air/proc/get_max_gas_mixes() /datum/controller/subsystem/air/proc/turf_process_time() /datum/controller/subsystem/air/proc/heat_process_time() /datum/controller/subsystem/air/proc/process_turf_heat() @@ -392,6 +403,19 @@ SUBSYSTEM_DEF(air) var/datum/atmosphere/mix = atmos_gen[gas_string] return mix.gas_string +/datum/controller/subsystem/air/proc/start_processing_machine(obj/machinery/machine) + if(machine.atmos_processing) + return + machine.atmos_processing = TRUE + atmos_machinery += machine + +/datum/controller/subsystem/air/proc/stop_processing_machine(obj/machinery/machine) + if(!machine.atmos_processing) + return + machine.atmos_processing = FALSE + atmos_machinery -= machine + currentrun -= machine + #undef SSAIR_PIPENETS #undef SSAIR_ATMOSMACHINERY #undef SSAIR_EXCITEDGROUPS diff --git a/code/controllers/subsystem/callback.dm b/code/controllers/subsystem/callback.dm index 21c43f3e6c..dc33f6f3c8 100644 --- a/code/controllers/subsystem/callback.dm +++ b/code/controllers/subsystem/callback.dm @@ -4,11 +4,6 @@ SUBSYSTEM_DEF(callbacks) wait = 1 priority = FIRE_PRIORITY_CALLBACKS -/proc/process_atmos_callbacks() - SScallbacks.can_fire = 0 - SScallbacks.flags |= SS_NO_FIRE - CRASH("Auxtools not found! Callback subsystem shutting itself off.") - /datum/controller/subsystem/callbacks/fire() if(process_atmos_callbacks(TICK_REMAINING_MS)) pause() diff --git a/code/datums/callback.dm b/code/datums/callback.dm index f1cf30855f..ad8a50b1c1 100644 --- a/code/datums/callback.dm +++ b/code/datums/callback.dm @@ -5,10 +5,10 @@ * ## USAGE * * ``` - * var/datum/callback/C = new(object|null, /proc/type/path|"procstring", arg1, arg2, ... argn) + * var/datum/callback/C = new(object|null, PROC_REF(procname), arg1, arg2, ... argn) * var/timerid = addtimer(C, time, timertype) * you can also use the compiler define shorthand - * var/timerid = addtimer(CALLBACK(object|null, PROC_REF(type/path|procstring), arg1, arg2, ... argn), time, timertype) + * var/timerid = addtimer(CALLBACK(object|null, PROC_REF(procname), arg1, arg2, ... argn), time, timertype) * ``` * * Note: proc strings can only be given for datum proc calls, global procs must be proc paths @@ -26,27 +26,19 @@ * ## PROC TYPEPATH SHORTCUTS * (these operate on paths, not types, so to these shortcuts, datum is NOT a parent of atom, etc...) * - * ### global proc while in another global proc: - * .procname - * - * `CALLBACK(GLOBAL_PROC, .some_proc_here)` - * - * ### proc defined on current(src) object (when in a /proc/ and not an override) OR overridden at src or any of it's parents: - * .procname - * - * `CALLBACK(src, .some_proc_here)` - * - * ### when the above doesn't apply: - *PROC_REF(procname) + * ### proc defined on current(src) object OR overridden at src or any of it's parents: + * PROC_REF(procname) * * `CALLBACK(src, PROC_REF(some_proc_here))` * + * ### global proc + * GLOBAL_PROC_REF(procname) * - * proc defined on a parent of a some type + * `CALLBACK(src, GLOBAL_PROC_REF(some_proc_here))` * - * `TYPE_PROC_REF(/some/type, some_proc_here)` * - * Otherwise you must always provide the full typepath of the proc (/type/of/thing/proc/procname) + * ### proc defined on some type + * TYPE_PROC_REF(/some/type, some_proc_here) */ /datum/callback diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index d01889f9fc..035f18f2d4 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -139,6 +139,9 @@ Class Procs: var/market_verb = "Customer" var/payment_department = ACCOUNT_ENG + ///Boolean on whether this machines interact with atmos + var/atmos_processing = FALSE + /obj/machinery/Initialize(mapload) if(!armor) armor = list(MELEE = 25, BULLET = 10, LASER = 10, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70) diff --git a/code/game/machinery/computer/atmos_control.dm b/code/game/machinery/computer/atmos_control.dm index c8add9e690..81c3ad8118 100644 --- a/code/game/machinery/computer/atmos_control.dm +++ b/code/game/machinery/computer/atmos_control.dm @@ -73,11 +73,11 @@ /obj/machinery/air_sensor/Initialize(mapload) . = ..() - SSair.atmos_machinery += src + SSair.start_processing_machine(src) set_frequency(frequency) /obj/machinery/air_sensor/Destroy() - SSair.atmos_machinery -= src + SSair.stop_processing_machine(src) SSradio.remove_object(src, frequency) return ..() diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 93b85bb45b..d90f4f8bc9 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -222,7 +222,7 @@ usr.visible_message("[usr] switches [on ? "on" : "off"] \the [src].", "You switch [on ? "on" : "off"] \the [src].") update_icon() if (on) - SSair.atmos_machinery += src + SSair.start_processing_machine(src) . = TRUE if("mode") setMode = params["mode"] diff --git a/code/game/turfs/change_turf.dm b/code/game/turfs/change_turf.dm index 7502d4b2f0..9814765ecf 100644 --- a/code/game/turfs/change_turf.dm +++ b/code/game/turfs/change_turf.dm @@ -142,6 +142,9 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( return W /turf/open/ChangeTurf(path, list/new_baseturfs, flags) + //don't + if(!SSair.initialized) + return ..() if ((flags & CHANGETURF_INHERIT_AIR) && ispath(path, /turf/open)) var/datum/gas_mixture/stashed_air = new() stashed_air.copy_from(air) diff --git a/code/game/world.dm b/code/game/world.dm index eeb8b33f01..c6a5a2ef95 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -9,14 +9,11 @@ GLOBAL_LIST(topic_status_cache) //So subsystems globals exist, but are not initialised /world/New() - var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL") - if (debug_server) - call(debug_server, "auxtools_init")() + var/dll = GetConfig("env", "AUXTOOLS_DEBUG_DLL") + if (dll) + LIBCALL(dll, "auxtools_init")() enable_debugging() - AUXTOOLS_CHECK(AUXMOS) -#ifdef EXTOOLS_REFERENCE_TRACKING - enable_reference_tracking() -#endif + world.Profile(PROFILE_START) log_world("World loaded at [TIME_STAMP("hh:mm:ss", FALSE)]!") @@ -270,19 +267,23 @@ GLOBAL_LIST(topic_status_cache) if(do_hard_reboot) log_world("World hard rebooted at [TIME_STAMP("hh:mm:ss", FALSE)]") shutdown_logging() // See comment below. + var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL") + if (debug_server) + LIBCALL(debug_server, "auxtools_shutdown")() TgsEndProcess() log_world("World rebooted at [TIME_STAMP("hh:mm:ss", FALSE)]") shutdown_logging() // Past this point, no logging procs can be used, at risk of data loss. - AUXTOOLS_SHUTDOWN(AUXMOS) + var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL") + if (debug_server) + LIBCALL(debug_server, "auxtools_shutdown")() ..() /world/Del() shutdown_logging() // makes sure the thread is closed before end, else we terminate - AUXTOOLS_SHUTDOWN(AUXMOS) var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL") if (debug_server) - call(debug_server, "auxtools_shutdown")() + LIBCALL(debug_server, "auxtools_shutdown")() ..() /world/proc/update_status() diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm index 83eb5d8ef3..aa3d49e3b7 100644 --- a/code/modules/atmospherics/environmental/LINDA_system.dm +++ b/code/modules/atmospherics/environmental/LINDA_system.dm @@ -71,8 +71,6 @@ /turf/proc/set_sleeping(should_sleep) -/turf/proc/__update_auxtools_turf_adjacency_info() - //returns a list of adjacent turfs that can share air with this one. //alldir includes adjacent diagonal tiles that can share // air with both of the related adjacent cardinal tiles diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm index 123f5936f4..c527d0d416 100644 --- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm +++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm @@ -45,9 +45,6 @@ QDEL_NULL(active_hotspot) return ..() -/// Function for Extools Atmos -/turf/proc/update_air_ref() - /////////////////GAS MIXTURE PROCS/////////////////// /turf/open/assume_air(datum/gas_mixture/giver) //use this for machines to adjust air diff --git a/code/modules/atmospherics/gasmixtures/auxgm.dm b/code/modules/atmospherics/gasmixtures/auxgm.dm index 0c36457ea2..0318e06abe 100644 --- a/code/modules/atmospherics/gasmixtures/auxgm.dm +++ b/code/modules/atmospherics/gasmixtures/auxgm.dm @@ -12,8 +12,6 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA // Also allows you to add new gases at runtime -/proc/_auxtools_register_gas(datum/gas/gas) // makes sure auxtools knows stuff about this gas - /datum/auxgm var/done_initializing = FALSE var/list/datums = list() @@ -148,8 +146,6 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA SSair.auxtools_update_reactions() SEND_GLOBAL_SIGNAL(COMSIG_GLOB_NEW_GAS, g) -/proc/finalize_gas_refs() - /datum/auxgm/New() src.supermatter[HEAT_PENALTY] = list() src.supermatter[TRANSMIT_MODIFIER] = list() diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm index 8b00fc49d0..34487da244 100644 --- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm +++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm @@ -16,13 +16,10 @@ What are the archived variables for? GLOBAL_LIST_INIT(auxtools_atmos_initialized,FALSE) -/proc/auxtools_atmos_init() - /datum/gas_mixture/New(volume) if (!isnull(volume)) initial_volume = volume - AUXTOOLS_CHECK(AUXMOS) - if(!GLOB.auxtools_atmos_initialized && auxtools_atmos_init()) + if(!GLOB.auxtools_atmos_initialized && auxtools_atmos_init(GLOB.gas_data)) GLOB.auxtools_atmos_initialized = TRUE __gasmixture_register() reaction_results = new @@ -111,9 +108,6 @@ we use a hook instead . = ..() */ -/datum/gas_mixture/proc/__gasmixture_unregister() -/datum/gas_mixture/proc/__gasmixture_register() - /proc/gas_types() var/list/L = subtypesof(/datum/gas) for(var/gt in L) @@ -121,22 +115,6 @@ we use a hook instead L[gt] = initial(G.specific_heat) return L -/datum/gas_mixture/proc/heat_capacity() //joules per kelvin - -/datum/gas_mixture/proc/partial_heat_capacity(gas_type) - -/datum/gas_mixture/proc/total_moles() - -/datum/gas_mixture/proc/return_pressure() //kilopascals - -/datum/gas_mixture/proc/return_temperature() //kelvins - -/datum/gas_mixture/proc/set_min_heat_capacity(n) -/datum/gas_mixture/proc/set_temperature(new_temp) -/datum/gas_mixture/proc/set_volume(new_volume) -/datum/gas_mixture/proc/get_moles(gas_type) -/datum/gas_mixture/proc/get_by_flag(flag) -/datum/gas_mixture/proc/set_moles(gas_type, moles) // VV WRAPPERS - EXTOOLS HOOKED PROCS DO NOT TAKE ARGUMENTS FROM CALL() FOR SOME REASON. /datum/gas_mixture/proc/vv_set_moles(gas_type, moles) @@ -150,34 +128,12 @@ we use a hook instead /datum/gas_mixture/proc/vv_react(datum/holder) return react(holder) -/datum/gas_mixture/proc/scrub_into(datum/gas_mixture/target, ratio, list/gases) -/datum/gas_mixture/proc/mark_immutable() -/datum/gas_mixture/proc/get_gases() -/datum/gas_mixture/proc/add(amt) -/datum/gas_mixture/proc/subtract(amt) -/datum/gas_mixture/proc/multiply(factor) -/datum/gas_mixture/proc/divide(factor) /datum/gas_mixture/proc/get_last_share() -/datum/gas_mixture/proc/clear() - -/datum/gas_mixture/proc/adjust_moles(gas_type, amt = 0) - set_moles(gas_type, clamp(get_moles(gas_type) + amt,0,INFINITY)) - -/datum/gas_mixture/proc/adjust_moles_temp(gas_type, amt, temperature) - -/datum/gas_mixture/proc/adjust_multi() - -/datum/gas_mixture/proc/return_volume() //liters - -/datum/gas_mixture/proc/thermal_energy() //joules /datum/gas_mixture/proc/archive() //Update archived versions of variables //Returns: 1 in all cases -/datum/gas_mixture/proc/merge(datum/gas_mixture/giver) - //Merges all air from giver into self. giver is untouched. - //Returns: 1 if we are mutable, 0 otherwise /datum/gas_mixture/proc/remove(amount) //Removes amount of gas from the gas_mixture @@ -187,12 +143,6 @@ we use a hook instead //Removes amount of gas from the gas mixture by flag //Returns: gas_mixture with gases that match the flag removed -/datum/gas_mixture/proc/transfer_to(datum/gas_mixture/target, amount) - //Transfers amount of gas to target. Equivalent to target.merge(remove(amount)) but faster. - -/datum/gas_mixture/proc/transfer_ratio_to(datum/gas_mixture/target, ratio) - //Transfers ratio of gas to target. Equivalent to target.merge(remove_ratio(amount)) but faster. - /datum/gas_mixture/proc/remove_ratio(ratio) //Proportionally removes amount of gas from the gas_mixture //Returns: gas_mixture with the gases removed @@ -201,10 +151,6 @@ we use a hook instead //Creates new, identical gas mixture //Returns: duplicate gas mixture -/datum/gas_mixture/proc/copy_from(datum/gas_mixture/sample) - //Copies variables from sample - //Returns: 1 if we are mutable, 0 otherwise - /datum/gas_mixture/proc/copy_from_turf(turf/model) //Copies all gas info from the turf into the gas list along with temperature //Returns: 1 if we are mutable, 0 otherwise @@ -217,52 +163,18 @@ we use a hook instead //Performs air sharing calculations between two gas_mixtures assuming only 1 boundary length //Returns: amount of gas exchanged (+ if sharer received) -/datum/gas_mixture/proc/temperature_share(datum/gas_mixture/sharer, conduction_coefficient,temperature=null,heat_capacity=null) - //Performs temperature sharing calculations (via conduction) between two gas_mixtures assuming only 1 boundary length - //Returns: new temperature of the sharer - -/datum/gas_mixture/proc/compare(datum/gas_mixture/sample) - //Compares sample to self to see if within acceptable ranges that group processing may be enabled - //Returns: a string indicating what check failed, or "" if check passes - -/datum/gas_mixture/proc/react(datum/holder) - //Performs various reactions such as combustion or fusion (LOL) - //Returns: 1 if any reaction took place; 0 otherwise - -/datum/gas_mixture/proc/adjust_heat(amt) - //Adjusts the thermal energy of the gas mixture, rather than having to do the full calculation. - //Returns: null - -/datum/gas_mixture/proc/equalize_with(datum/gas_mixture/giver) - //Makes this mix have the same temperature and gas ratios as the giver, but with the same pressure, accounting for volume. - //Returns: null - -/datum/gas_mixture/proc/get_oxidation_power(temp) - //Gets how much oxidation this gas can do, optionally at a given temperature. - -/datum/gas_mixture/proc/get_fuel_amount(temp) - //Gets how much fuel for fires (not counting trit/plasma!) this gas has, optionally at a given temperature. - -/proc/equalize_all_gases_in_list(list/L) - //Makes every gas in the given list have the same pressure, temperature and gas proportions. - //Returns: null - -/datum/gas_mixture/proc/__remove_by_flag() - /datum/gas_mixture/remove_by_flag(flag, amount) var/datum/gas_mixture/removed = new type __remove_by_flag(removed, flag, amount) return removed -/datum/gas_mixture/proc/__remove() /datum/gas_mixture/remove(amount) var/datum/gas_mixture/removed = new type __remove(removed, amount) return removed -/datum/gas_mixture/proc/__remove_ratio() /datum/gas_mixture/remove_ratio(ratio) var/datum/gas_mixture/removed = new type __remove_ratio(removed, ratio) @@ -280,8 +192,6 @@ we use a hook instead parse_gas_string(model.initial_gas_mix) return TRUE -/datum/gas_mixture/proc/__auxtools_parse_gas_string(gas_string) - /datum/gas_mixture/parse_gas_string(gas_string) gas_string = SSair.preprocess_gas_string(gas_string) return __auxtools_parse_gas_string(gas_string) diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index 40b2515353..171412f0d8 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -72,14 +72,15 @@ armor = list(MELEE = 25, BULLET = 10, LASER = 10, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 100, ACID = 70) ..() if(process) - SSair.atmos_machinery += src + SSair.start_processing_machine(src) SetInitDirections() /obj/machinery/atmospherics/Destroy() for(var/i in 1 to device_type) nullifyNode(i) - SSair.atmos_machinery -= src + + SSair.stop_processing_machine(src) SSair.pipenets_needing_rebuilt -= src dropContents() diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm index 48d69567af..26f16d329d 100644 --- a/code/modules/atmospherics/machinery/other/meter.dm +++ b/code/modules/atmospherics/machinery/other/meter.dm @@ -27,14 +27,14 @@ id_tag = ATMOS_GAS_MONITOR_LOOP_DISTRIBUTION /obj/machinery/meter/Destroy() - SSair.atmos_machinery -= src + SSair.stop_processing_machine(src) target = null return ..() /obj/machinery/meter/Initialize(mapload, new_piping_layer) if(!isnull(new_piping_layer)) target_layer = new_piping_layer - SSair.atmos_machinery += src + SSair.start_processing_machine(src) if(!target) reattach_to_layer() return ..() diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm index 3613a59e0a..56ad873f85 100644 --- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm +++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm @@ -16,7 +16,7 @@ /obj/machinery/portable_atmospherics/New() ..() - SSair.atmos_machinery += src + SSair.start_processing_machine(src) air_contents = new(volume) air_contents.set_temperature(T20C) @@ -24,8 +24,7 @@ return TRUE /obj/machinery/portable_atmospherics/Destroy() - SSair.atmos_machinery -= src - + SSair.stop_processing_machine(src) disconnect() qdel(air_contents) air_contents = null diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 0a235b5408..c626fb0829 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -47,7 +47,7 @@ AddComponent(/datum/component/combat_mode) AddElement(/datum/element/flavor_text/carbon, _name = "Flavor Text", _save_key = "flavor_text") AddElement(/datum/element/flavor_text/carbon/temporary, "", "Set Pose (Temporary Flavor Text)", "This should be used only for things pertaining to the current round!", _save_key = null) - AddElement(/datum/element/flavor_text, _name = "OOC Notes", _addendum = "Put information on ERP/vore/lewd-related preferences here. THIS SHOULD NOT CONTAIN REGULAR FLAVORTEXT!!", _save_key = "ooc_notes", _examine_no_preview = TRUE) + AddElement(/datum/element/flavor_text, _name = "OOC Notes", _addendum = "Put information on ERP/vore/lewd-related preferences here. THIS SHOULD NOT CONTAIN REGULAR FLAVORTEXT!!", _always_show = TRUE, _save_key = "ooc_notes", _examine_no_preview = TRUE) AddElement(/datum/element/strippable, GLOB.strippable_human_items, TYPE_PROC_REF(/mob/living/carbon/human, should_strip)) /mob/living/carbon/human/Destroy() diff --git a/code/modules/mob/living/carbon/monkey/combat.dm b/code/modules/mob/living/carbon/monkey/combat.dm index 213a49d9ef..8976a0cc6d 100644 --- a/code/modules/mob/living/carbon/monkey/combat.dm +++ b/code/modules/mob/living/carbon/monkey/combat.dm @@ -117,7 +117,7 @@ pickupTarget = null pickupTimer = 0 else - INVOKE_ASYNC(src, .proc/walk2derpless, pickupTarget.loc) + INVOKE_ASYNC(src, PROC_REF(walk2derpless), pickupTarget.loc) if(Adjacent(pickupTarget) || Adjacent(pickupTarget.loc)) // next to target drop_all_held_items() // who cares about these items, i want that one! if(isturf(pickupTarget.loc)) // on floor @@ -167,7 +167,7 @@ return TRUE if(target != null) - INVOKE_ASYNC(src, .proc/walk2derpless, target) + INVOKE_ASYNC(src, PROC_REF(walk2derpless), target) // pickup any nearby weapon if(!pickupTarget && prob(MONKEY_WEAPON_PROB)) @@ -252,7 +252,7 @@ if(target.pulledby != src && !istype(target.pulledby, /mob/living/carbon/monkey/)) - INVOKE_ASYNC(src, .proc/walk2derpless, target.loc) + INVOKE_ASYNC(src, PROC_REF(walk2derpless), target.loc) if(Adjacent(target) && isturf(target.loc)) a_intent = INTENT_GRAB @@ -265,7 +265,7 @@ frustration = 0 else if(!disposing_body) - INVOKE_ASYNC(src, .proc/walk2derpless, bodyDisposal.loc) + INVOKE_ASYNC(src, PROC_REF(walk2derpless), bodyDisposal.loc) if(Adjacent(bodyDisposal)) disposing_body = TRUE diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 01823bc0fc..bfad3339f1 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -24,7 +24,7 @@ break var/msg = "[key_name_admin(src)] [ADMIN_JMP(src)] was found to have no .loc with an attached client, if the cause is unknown it would be wise to ask how this was accomplished." message_admins(msg) - INVOKE_ASYNC(GLOBAL_PROC, .proc/send2tgs_adminless_only, "Mob", msg, R_ADMIN) + INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(send2tgs_adminless_only), "Mob", msg, R_ADMIN) log_game("[key_name(src)] was found to have no .loc with an attached client.") // This is a temporary error tracker to make sure we've caught everything diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index f1beecacb9..af427f1c40 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -19,7 +19,7 @@ . = ..() find_circs() connect_to_network() - SSair.atmos_machinery += src + SSair.start_processing_machine(src) update_icon() component_parts = list(new /obj/item/circuitboard/machine/generator) @@ -29,7 +29,7 @@ /obj/machinery/power/generator/Destroy() kill_circs() - SSair.atmos_machinery -= src + SSair.stop_processing_machine(src) return ..() /obj/machinery/power/generator/update_overlays() diff --git a/code/modules/power/reactor/rbmk.dm b/code/modules/power/reactor/rbmk.dm index 24b562a8cf..f49148faad 100644 --- a/code/modules/power/reactor/rbmk.dm +++ b/code/modules/power/reactor/rbmk.dm @@ -444,7 +444,7 @@ The reactor CHEWS through moderator. It does not do this slowly. Be very careful //Results: Engineering becomes unusable and your engine irreparable /obj/machinery/atmospherics/components/trinary/nuclear_reactor/proc/meltdown() set waitfor = FALSE - SSair.atmos_machinery -= src //Annd we're now just a useless brick. + SSair.stop_processing_machine(src) slagged = TRUE color = null update_icon() diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index c456887460..157ad6a627 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -195,7 +195,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) /obj/machinery/power/supermatter_crystal/Initialize(mapload) . = ..() uid = gl_uid++ - SSair.atmos_machinery += src + SSair.start_processing_machine(src) countdown = new(src) countdown.start() GLOB.poi_list |= src @@ -214,7 +214,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) /obj/machinery/power/supermatter_crystal/Destroy() investigate_log("has been destroyed.", INVESTIGATE_SUPERMATTER) - SSair.atmos_machinery -= src + SSair.stop_processing_machine(src) QDEL_NULL(radio) GLOB.poi_list -= src QDEL_NULL(countdown) diff --git a/code/modules/procedural_mapping/mapGenerator.dm b/code/modules/procedural_mapping/mapGenerator.dm index 532c7026cd..ae016cf2bb 100644 --- a/code/modules/procedural_mapping/mapGenerator.dm +++ b/code/modules/procedural_mapping/mapGenerator.dm @@ -153,10 +153,10 @@ return var/endInput = input(usr,"End turf of Map (X;Y;Z)", "Map Gen Settings", "[world.maxx];[world.maxy];[mob ? mob.z : 1]") as text|null - + if (isnull(endInput)) return - + //maxx maxy and current z so that if you fuck up, you only fuck up one entire z level instead of the entire universe if(!startInput || !endInput) to_chat(src, "Missing Input") diff --git a/code/modules/vehicles/speedbike.dm b/code/modules/vehicles/speedbike.dm index d0b9c1fe96..2988be55ce 100644 --- a/code/modules/vehicles/speedbike.dm +++ b/code/modules/vehicles/speedbike.dm @@ -44,7 +44,7 @@ icon = 'icons/obj/car.dmi' icon_state = "speedwagon" layer = LYING_MOB_LAYER - var/static/mutable_appearance/overlay = mutable_appearance(icon, "speedwagon_cover", ABOVE_MOB_LAYER) + var/static/mutable_appearance/overlay max_buckled_mobs = 4 var/crash_all = FALSE //CHAOS pixel_y = -48 @@ -52,6 +52,7 @@ /obj/vehicle/ridden/space/speedwagon/Initialize(mapload) . = ..() + overlay = mutable_appearance(icon, "speedwagon_cover", ABOVE_MOB_LAYER) add_overlay(overlay) var/datum/component/riding/D = LoadComponent(/datum/component/riding) D.vehicle_move_delay = 0 diff --git a/dependencies.sh b/dependencies.sh index 3e18634e0d..a9f562ade7 100644 --- a/dependencies.sh +++ b/dependencies.sh @@ -4,8 +4,8 @@ #Final authority on what's required to fully build the project # byond version -export BYOND_MAJOR=514 -export BYOND_MINOR=1589 +export BYOND_MAJOR=515 +export BYOND_MINOR=1634 #rust_g git tag export RUST_G_VERSION=0.4.10 @@ -15,13 +15,13 @@ export NODE_VERSION=16 export NODE_VERSION_PRECISE=16.13.1 # SpacemanDMM git tag -export SPACEMAN_DMM_VERSION=suite-1.7 +export SPACEMAN_DMM_VERSION=suite-1.8 # Python version for mapmerge and other tools export PYTHON_VERSION=3.7.9 # Auxmos git tag -export AUXMOS_VERSION=v2.4.1 +export AUXMOS_VERSION=v2.5.1 # Extools git tag export EXTOOLS_VERSION=v0.0.7 diff --git a/tgstation.dme b/tgstation.dme index 97c9575439..e20e9f4977 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -19,7 +19,6 @@ #include "code\__byond_version_compat.dm" #include "code\_compile_options.dm" #include "code\world.dm" -#include "code\__DEFINES\_auxtools.dm" #include "code\__DEFINES\_click.dm" #include "code\__DEFINES\_globals.dm" #include "code\__DEFINES\_protect.dm" @@ -30,6 +29,7 @@ #include "code\__DEFINES\admin.dm" #include "code\__DEFINES\antagonists.dm" #include "code\__DEFINES\atmospherics.dm" +#include "code\__DEFINES\bindings.dm" #include "code\__DEFINES\bitfields.dm" #include "code\__DEFINES\blackmarket.dm" #include "code\__DEFINES\botany.dm" @@ -188,8 +188,8 @@ #include "code\__DEFINES\skills\helpers.dm" #include "code\__DEFINES\storage\_storage.dm" #include "code\__DEFINES\storage\volumetrics.dm" +#include "code\__HELPERS\_auxtools_api.dm" #include "code\__HELPERS\_cit_helpers.dm" -#include "code\__HELPERS\_extools_api.dm" #include "code\__HELPERS\_lists.dm" #include "code\__HELPERS\_logging.dm" #include "code\__HELPERS\_string_lists.dm" diff --git a/tgui/.editorconfig b/tgui/.editorconfig index 33092d4928..c0f2cb2c8b 100644 --- a/tgui/.editorconfig +++ b/tgui/.editorconfig @@ -7,7 +7,4 @@ indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -max_line_length = 80 +insert_final_newline = true \ No newline at end of file diff --git a/tgui/.eslintrc.yml b/tgui/.eslintrc.yml index dd85d4ca15..a6adec4037 100644 --- a/tgui/.eslintrc.yml +++ b/tgui/.eslintrc.yml @@ -368,14 +368,15 @@ rules: ## Enforce a maximum depth that blocks can be nested # max-depth: error ## Enforce a maximum line length - max-len: [error, { - code: 80, - ## Ignore imports - ignorePattern: '^(import\s.+\sfrom\s|.*require\()', - ignoreUrls: true, - ignoreRegExpLiterals: true, - ignoreStrings: true, - }] + # max-len: [error, { + # code: 80, + # ## Ignore imports + # ignorePattern: '^(import\s.+\sfrom\s|.*require\()', + # ignoreUrls: true, + # ignoreRegExpLiterals: true, + # ignoreStrings: true, + # ignoreTemplateLiterals: true, + # }] ## Enforce a maximum number of lines per file # max-lines: error ## Enforce a maximum number of line of code in a function diff --git a/tgui/packages/tgui-dev-server/dreamseeker.js b/tgui/packages/tgui-dev-server/dreamseeker.js index 3d4149cf25..21ad32e064 100644 --- a/tgui/packages/tgui-dev-server/dreamseeker.js +++ b/tgui/packages/tgui-dev-server/dreamseeker.js @@ -28,6 +28,9 @@ export class DreamSeeker { .map(key => encodeURIComponent(key) + '=' + encodeURIComponent(params[key])) .join('&'); + logger.log( + `topic call at ${this.client.defaults.baseURL + '/dummy?' + query}` + ); return this.client.get('/dummy?' + query); } } diff --git a/tgui/packages/tgui-dev-server/reloader.js b/tgui/packages/tgui-dev-server/reloader.js index 5722cee644..c2bc552e00 100644 --- a/tgui/packages/tgui-dev-server/reloader.js +++ b/tgui/packages/tgui-dev-server/reloader.js @@ -67,8 +67,6 @@ export const findCacheRoot = async () => { const onCacheRootFound = cacheRoot => { logger.log(`found cache at '${cacheRoot}'`); - // Plant a dummy - fs.closeSync(fs.openSync(cacheRoot + '/dummy', 'w')); }; export const reloadByondCache = async bundleDir => { @@ -93,6 +91,9 @@ export const reloadByondCache = async bundleDir => { // Clear garbage const garbage = await resolveGlob(cacheDir, './*.+(bundle|chunk|hot-update).*'); try { + // Plant a dummy browser window file, we'll be using this to avoid world topic + fs.closeSync(fs.openSync(cacheDir + '/dummy', 'w')); + for (let file of garbage) { fs.unlinkSync(file); } diff --git a/tgui/public/tgui.html b/tgui/public/tgui.html index 5bda2a9b81..84b00709bb 100644 --- a/tgui/public/tgui.html +++ b/tgui/public/tgui.html @@ -48,8 +48,9 @@ if (window.__windowId__ === '[' + 'tgui:windowId' + ']') { // Basic checks to detect whether this page runs in BYOND var isByond = (tridentVersion !== null || window.cef_to_byond) && location.hostname === '127.0.0.1' - && location.pathname.indexOf('/tmp') === 0 && location.search !== '?external'; + //As of BYOND 515 the path doesn't seem to include tmp dir anymore if you're trying to open tgui in external browser and looking why it doesn't work + //&& location.pathname.indexOf('/tmp') === 0 // Version constants Byond.IS_BYOND = isByond; @@ -202,6 +203,8 @@ if (window.__windowId__ === '[' + 'tgui:windowId' + ']') { var len = styleSheets.length; for (var i = 0; i < len; i++) { var styleSheet = styleSheets[i]; + if(styleSheet.href === undefined) + continue; if (styleSheet.href.indexOf(url) !== -1) { return styleSheet.rules.length > 0; } diff --git a/tools/LinuxOneShot/docker-compose.yml b/tools/LinuxOneShot/docker-compose.yml index c7002f4565..c2780a6a95 100644 --- a/tools/LinuxOneShot/docker-compose.yml +++ b/tools/LinuxOneShot/docker-compose.yml @@ -38,7 +38,7 @@ services: driver: none setup: environment: - TGS_BYOND: 513.1514 + TGS_BYOND: 515.1634 TGS_REPO: https://github.com/tgstation/tgstation build: context: ./SetupProgram diff --git a/tools/build/.editorconfig b/tools/build/.editorconfig index 33092d4928..c0f2cb2c8b 100644 --- a/tools/build/.editorconfig +++ b/tools/build/.editorconfig @@ -7,7 +7,4 @@ indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -max_line_length = 80 +insert_final_newline = true \ No newline at end of file diff --git a/tools/ci/check_grep.sh b/tools/ci/check_grep.sh index eb83ab46f8..bdf81330ef 100755 --- a/tools/ci/check_grep.sh +++ b/tools/ci/check_grep.sh @@ -4,6 +4,12 @@ set -euo pipefail #nb: must be bash to support shopt globstar shopt -s globstar +#ANSI Escape Codes for colors to increase contrast of errors +RED="\033[0;31m" +GREEN="\033[0;32m" +BLUE="\033[0;34m" +NC="\033[0m" # No Color + st=0 if git grep -P "\r\n"; then @@ -117,4 +123,20 @@ do done < <(jq -r '[.map_file] | flatten | .[]' $json) done +# Check for non-515 compatable .proc/ syntax +if grep -P --exclude='__byond_version_compat.dm' '\.proc/' code/**/*.dm; then + echo + echo -e "${RED}ERROR: Outdated proc reference use detected in code, please use proc reference helpers.${NC}" + st=1 +fi; + +if [ $st = 0 ]; then + echo + echo -e "${GREEN}No errors found using grep!${NC}" +fi; +if [ $st = 1 ]; then + echo + echo -e "${RED}Errors found, please fix them and try again.${NC}" +fi; + exit $st