From d64a6ffc647c5bd91d252a46968bfac8324a3977 Mon Sep 17 00:00:00 2001 From: harryob <55142896+harryob@users.noreply.github.com> Date: Sat, 21 Oct 2023 06:43:00 +0100 Subject: [PATCH 01/11] 515d --- .github/alternate_byond_versions.txt | 2 - .tgs.yml | 2 +- code/__DEFINES/__spacemandmm.dm | 2 +- code/__DEFINES/_macros.dm | 9 ---- code/__HELPERS/nameof.dm | 4 -- code/_byond_version_compat.dm | 51 ++----------------- code/controllers/subsystem/garbage.dm | 30 ++--------- code/datums/datum.dm | 7 --- code/game/world.dm | 4 +- .../view_variables/reference_tracking.dm | 2 - dependencies.sh | 4 +- 11 files changed, 13 insertions(+), 104 deletions(-) diff --git a/.github/alternate_byond_versions.txt b/.github/alternate_byond_versions.txt index 005803964cca..7b50af46885e 100644 --- a/.github/alternate_byond_versions.txt +++ b/.github/alternate_byond_versions.txt @@ -5,5 +5,3 @@ # Format is version: map # Example: # 500.1337: runtimestation - -515.1610: lv624 diff --git a/.tgs.yml b/.tgs.yml index ba3fc6b26c66..6684cfd084ef 100644 --- a/.tgs.yml +++ b/.tgs.yml @@ -1,5 +1,5 @@ version: 1 -byond: "514.1588" +byond: "515.1609" static_files: - name: config - name: data diff --git a/code/__DEFINES/__spacemandmm.dm b/code/__DEFINES/__spacemandmm.dm index b62bbee4259a..9a044949db3e 100644 --- a/code/__DEFINES/__spacemandmm.dm +++ b/code/__DEFINES/__spacemandmm.dm @@ -40,5 +40,5 @@ /world/Del() var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL") if (debug_server) - LIBCALL(debug_server, "auxtools_shutdown")() + call_ext(debug_server, "auxtools_shutdown")() . = ..() diff --git a/code/__DEFINES/_macros.dm b/code/__DEFINES/_macros.dm index 31f4b2aca084..07c3eb664e61 100644 --- a/code/__DEFINES/_macros.dm +++ b/code/__DEFINES/_macros.dm @@ -8,17 +8,8 @@ #define subtypesof(A) (typesof(A) - A) -#ifdef EXPERIMENT_515_DONT_CACHE_REF /// Takes a datum as input, returns its ref string #define text_ref(datum) ref(datum) -#else -/// Takes a datum as input, returns its ref string, or a cached version of it -/// This allows us to cache \ref creation, which ensures it'll only ever happen once per datum, saving string tree time -/// It is slightly less optimal then a []'d datum, but the cost is massively outweighed by the potential savings -/// It will only work for datums mind, for datum reasons -/// : because of the embedded typecheck -#define text_ref(datum) (isdatum(datum) ? (datum:cached_ref ||= "\ref[datum]") : ("\ref[datum]")) -#endif #define addToListNoDupe(L, index) if(L) L[index] = null; else L = list(index) diff --git a/code/__HELPERS/nameof.dm b/code/__HELPERS/nameof.dm index 7cd5777f4652..5a2fd60e7100 100644 --- a/code/__HELPERS/nameof.dm +++ b/code/__HELPERS/nameof.dm @@ -8,8 +8,4 @@ /** * NAMEOF that actually works in static definitions because src::type requires src to be defined */ -#if DM_VERSION >= 515 #define NAMEOF_STATIC(datum, X) (nameof(type::##X)) -#else -#define NAMEOF_STATIC(datum, X) (#X || ##datum.##X) -#endif diff --git a/code/_byond_version_compat.dm b/code/_byond_version_compat.dm index 719d85654b5f..fb71f15d7f9f 100644 --- a/code/_byond_version_compat.dm +++ b/code/_byond_version_compat.dm @@ -1,41 +1,17 @@ // 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 1588 +#define MIN_COMPILER_VERSION 515 +#define MIN_COMPILER_BUILD 1609 #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.1588 or higher -#endif - -/* -#if (DM_VERSION == 514 && DM_BUILD > 1575 && DM_BUILD <= 1577) -#error Your version of BYOND currently has a crashing issue that will prevent you from running Dream Daemon test servers. -#error We require developers to test their content, so an inability to test means we cannot allow the compile. -#error Please consider downgrading to 514.1575 or lower. -#endif -*/ - -/* -// Keep savefile compatibilty at minimum supported level -#if DM_VERSION >= 515 -/savefile/byond_version = MIN_COMPILER_VERSION -#endif -*/ - -// 515 split call for external libraries into call_ext -#if DM_VERSION < 515 -#define LIBCALL call -#else -#define LIBCALL call_ext +#error Your version of BYOND is too out-of-date to compile this project. Go to https://www.byond.com/download and update. +#error You need version 515.1609 or higher #endif // So we want to have compile time guarantees these methods exist on local type, unfortunately 515 killed the .proc/procname and .verb/verbname syntax so we have to use nameof() // For the record: GLOBAL_VERB_REF would be useless as verbs can't be global. -#if DM_VERSION < 515 - /// Call by name proc references, checks if the proc exists on either this type or as a global proc. #define PROC_REF(X) (.proc/##X) /// Call by name verb references, checks if the verb exists on either this type or as a global verb. @@ -49,24 +25,6 @@ /// Call by name proc reference, checks if the proc is an existing global proc #define GLOBAL_PROC_REF(X) (/proc/##X) -#else - -/// Call by name proc references, checks if the proc exists on either this type or as a global proc. -#define PROC_REF(X) (nameof(.proc/##X)) -/// Call by name verb references, checks if the verb exists on either this type or as a global verb. -#define VERB_REF(X) (nameof(.verb/##X)) - -/// Call by name proc reference, checks if the proc exists on either the given type or as a global proc -#define TYPE_PROC_REF(TYPE, X) (nameof(##TYPE.proc/##X)) -/// Call by name verb reference, checks if the verb exists on either the given type or as a global verb -#define TYPE_VERB_REF(TYPE, X) (nameof(##TYPE.verb/##X)) - -/// Call by name proc reference, checks if the proc is an existing global proc -#define GLOBAL_PROC_REF(X) (/proc/##X) - -#endif - -#if (DM_VERSION == 515) /// fcopy will crash on 515 linux if given a non-existant file, instead of returning 0 like on 514 linux or 515 windows /// var case matches documentation for fcopy. /world/proc/__fcopy(Src, Dst) @@ -76,4 +34,3 @@ #define fcopy(Src, Dst) world.__fcopy(Src, Dst) -#endif diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index e94d6b1aff1d..6a6f803b6c56 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -139,12 +139,8 @@ SUBSYSTEM_DEF(garbage) pass_counts[i] = 0 fail_counts[i] = 0 -#ifdef EXPERIMENT_515_QDEL_HARD_REFERENCE // 1 from the hard reference in the queue, and 1 from the variable used before this #define IS_DELETED(datum, _) (refcount(##datum) == 2) -#else -#define IS_DELETED(datum, gcd_at_time) (isnull(##datum) || ##datum.gc_destroyed != gcd_at_time) -#endif /datum/controller/subsystem/garbage/proc/HandleQueue(level = GC_QUEUE_FILTER) if (level == GC_QUEUE_FILTER) @@ -178,14 +174,7 @@ SUBSYSTEM_DEF(garbage) break // Everything else is newer, skip them count++ -#ifdef EXPERIMENT_515_QDEL_HARD_REFERENCE var/datum/D = L[GC_QUEUE_ITEM_REF] -#else - var/GCd_at_time = L[GC_QUEUE_ITEM_GCD_DESTROYED] - var/refID = L[GC_QUEUE_ITEM_REF] - var/datum/D - D = locate(refID) -#endif if (IS_DELETED(D, GCd_at_time)) // So if something else coincidently gets the same ref, it's not deleted by mistake ++gcedlasttick @@ -221,11 +210,7 @@ SUBSYSTEM_DEF(garbage) var/type = D.type var/datum/qdel_item/I = items[type] - var/message = "## TESTING: GC: -- [text_ref(D)] | [type] was unable to be GC'd --" -#if DM_VERSION >= 515 - message = "[message] (ref count of [refcount(D)])" -#endif - log_world(message) + log_world("## TESTING: GC: -- [text_ref(D)] | [type] was unable to be GC'd -- (ref count of [refcount(D)])") #ifdef TESTING for(var/c in GLOB.admins) //Using testing() here would fill the logs with ADMIN_VV garbage @@ -271,20 +256,11 @@ SUBSYSTEM_DEF(garbage) return var/queue_time = world.time -#ifdef EXPERIMENT_515_QDEL_HARD_REFERENCE - var/refid = D -#else - var/refid = text_ref(D) -#endif - - var/static/uid = 0 - uid = WRAP(uid+1, 1, SHORT_REAL_LIMIT - 1) if (D.gc_destroyed <= 0) - D.gc_destroyed = uid + D.gc_destroyed = queue_time var/list/queue = queues[level] - - queue[++queue.len] = list(queue_time, refid, D.gc_destroyed) // not += for byond reasons + queue[++queue.len] = list(queue_time, D, D.gc_destroyed) // not += for byond reasons //this is mainly to separate things profile wise. /datum/controller/subsystem/garbage/proc/HardDelete(datum/D, force) diff --git a/code/datums/datum.dm b/code/datums/datum.dm index b26c6afe4d91..ba816d7c5d5d 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -54,13 +54,6 @@ */ var/list/cooldowns -#ifndef EXPERIMENT_515_DONT_CACHE_REF - /// A cached version of our \ref - /// The brunt of \ref costs are in creating entries in the string tree (a tree of immutable strings) - /// This avoids doing that more then once per datum by ensuring ref strings always have a reference to them after they're first pulled - var/cached_ref -#endif - /// A weak reference to another datum var/datum/weakref/weak_reference diff --git a/code/game/world.dm b/code/game/world.dm index fce40ca468ae..1eac8858186b 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -16,7 +16,7 @@ var/list/reboot_sfx = file2list("config/reboot_sfx.txt") /world/New() var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL") if (debug_server) - LIBCALL(debug_server, "auxtools_init")() + call_ext(debug_server, "auxtools_init")() enable_debugging() internal_tick_usage = 0.2 * world.tick_lag hub_password = "kMZy3U5jJHSiBQjr" @@ -391,7 +391,7 @@ var/datum/BSQL_Connection/connection else CRASH("unsupported platform") - var/init = LIBCALL(lib, "init")() + var/init = call_ext(lib, "init")() if("0" != init) CRASH("[lib] init error: [init]") diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index f6f2b86f31d7..35f464354c72 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -28,9 +28,7 @@ var/starting_time = world.time -#if DM_VERSION >= 515 log_reftracker("Refcount for [type]: [refcount(src)]") -#endif //Time to search the whole game for our ref DoSearchVar(GLOB, "GLOB", search_time = starting_time) //globals diff --git a/dependencies.sh b/dependencies.sh index 2889751d36e6..86c4f676c39a 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=1588 +export BYOND_MAJOR=515 +export BYOND_MINOR=1609 #rust_g git tag export RUST_G_VERSION=2.1.0 From f00237f624a22e7dc77eb6b166f044f285aefcb6 Mon Sep 17 00:00:00 2001 From: harryob <55142896+harryob@users.noreply.github.com> Date: Mon, 30 Oct 2023 08:16:47 +0000 Subject: [PATCH 02/11] bump sdmm version --- dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.sh b/dependencies.sh index 86c4f676c39a..c099cb413c97 100644 --- a/dependencies.sh +++ b/dependencies.sh @@ -15,7 +15,7 @@ export NODE_VERSION=14 export NODE_VERSION_PRECISE=14.16.1 # SpacemanDMM git tag -export SPACEMAN_DMM_VERSION=suite-1.7.2 +export SPACEMAN_DMM_VERSION=suite-1.8 # Python version for mapmerge and other tools export PYTHON_VERSION=3.7.9 From f530572434ea3e9416f4594ee5d64851ebd6f647 Mon Sep 17 00:00:00 2001 From: harryob <55142896+harryob@users.noreply.github.com> Date: Sun, 26 Nov 2023 05:45:40 +0000 Subject: [PATCH 03/11] lets dooo this --- code/_experiments.dm | 20 -------------------- code/controllers/mc/globals.dm | 9 ++++++++- code/controllers/subsystem/garbage.dm | 9 +++------ 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/code/_experiments.dm b/code/_experiments.dm index 6e5addb5f992..ff5c2e9ec565 100644 --- a/code/_experiments.dm +++ b/code/_experiments.dm @@ -3,30 +3,10 @@ // Any flag you see here can be flipped with the `-D` CLI argument. // For example, if you want to enable EXPERIMENT_MY_COOL_FEATURE, compile with -DEXPERIMENT_MY_COOL_FEATURE -// EXPERIMENT_515_QDEL_HARD_REFERENCE -// - Hold a hard reference for qdeleted items, and check ref_count, rather than using refs. Requires 515+. - -// EXPERIMENT_515_DONT_CACHE_REF -// - Avoids `text_ref` caching, aided by improvements to ref() speed in 515. - #if DM_VERSION < 515 -// You can't X-macro custom names :( -#ifdef EXPERIMENT_515_QDEL_HARD_REFERENCE -#warn EXPERIMENT_515_QDEL_HARD_REFERENCE is only available on 515+ -#undef EXPERIMENT_515_QDEL_HARD_REFERENCE -#endif - -#ifdef EXPERIMENT_515_DONT_CACHE_REF -#warn EXPERIMENT_515_DONT_CACHE_REF is only available on 515+ -#undef EXPERIMENT_515_DONT_CACHE_REF -#endif - #elif defined(UNIT_TESTS) -//#define EXPERIMENT_515_QDEL_HARD_REFERENCE -#define EXPERIMENT_515_DONT_CACHE_REF - #endif #if DM_VERSION >= 516 diff --git a/code/controllers/mc/globals.dm b/code/controllers/mc/globals.dm index 7b5cc94d3620..60561ed97298 100644 --- a/code/controllers/mc/globals.dm +++ b/code/controllers/mc/globals.dm @@ -13,7 +13,14 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars) GLOB = src var/datum/controller/exclude_these = new - gvars_datum_in_built_vars = exclude_these.vars + list(NAMEOF(src, gvars_datum_protected_varlist), NAMEOF(src, gvars_datum_in_built_vars), NAMEOF(src, gvars_datum_init_order)) + // I know this is dumb but the nested vars list hangs a ref to the datum. This fixes that + var/list/controller_vars = exclude_these.vars.Copy() + controller_vars["vars"] = null + gvars_datum_in_built_vars = controller_vars + list(NAMEOF(src, gvars_datum_protected_varlist), NAMEOF(src, gvars_datum_in_built_vars), NAMEOF(src, gvars_datum_init_order)) + +#if DM_VERSION >= 515 && DM_BUILD > 1620 + #warn datum.vars hanging a ref should now be fixed, there should be no reason to remove the vars list from our controller's vars list anymore +#endif QDEL_IN(exclude_these, 0) //signal logging isn't ready log_world("[vars.len - gvars_datum_in_built_vars.len] global variables") diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index 6a6f803b6c56..ecd03c82c3a0 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -139,9 +139,6 @@ SUBSYSTEM_DEF(garbage) pass_counts[i] = 0 fail_counts[i] = 0 -// 1 from the hard reference in the queue, and 1 from the variable used before this -#define IS_DELETED(datum, _) (refcount(##datum) == 2) - /datum/controller/subsystem/garbage/proc/HandleQueue(level = GC_QUEUE_FILTER) if (level == GC_QUEUE_FILTER) delslasttick = 0 @@ -176,7 +173,9 @@ SUBSYSTEM_DEF(garbage) var/datum/D = L[GC_QUEUE_ITEM_REF] - if (IS_DELETED(D, GCd_at_time)) // So if something else coincidently gets the same ref, it's not deleted by mistake + // 1 from the hard reference in the queue, and 1 from the variable used before this + // If that's all we've got, send er off + if (refcount(D) == 2) ++gcedlasttick ++totalgcs pass_counts[level]++ @@ -246,8 +245,6 @@ SUBSYSTEM_DEF(garbage) queue.Cut(1,count+1) count = 0 -#undef IS_DELETED - /datum/controller/subsystem/garbage/proc/Queue(datum/D, level = GC_QUEUE_FILTER) if (isnull(D)) return From 8dfd3351e86db2b962d5d1ab45315e8e438b63de Mon Sep 17 00:00:00 2001 From: Fira Date: Tue, 12 Dec 2023 13:06:56 +0000 Subject: [PATCH 04/11] fix pipes C&D --- code/game/objects/structures/pipes/pipes.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/game/objects/structures/pipes/pipes.dm b/code/game/objects/structures/pipes/pipes.dm index 9f2b70c70661..fb51a605ee93 100644 --- a/code/game/objects/structures/pipes/pipes.dm +++ b/code/game/objects/structures/pipes/pipes.dm @@ -52,6 +52,7 @@ for(var/obj/structure/pipes/P in connected_to) P.remove_connection(src) + connected_to.Cut() GLOB.mainship_pipes -= src @@ -96,6 +97,7 @@ /obj/structure/pipes/proc/remove_connection(obj/structure/pipes/P) connected_to -= P + P.connected_to -= src /obj/structure/pipes/proc/get_connection(direction) var/obj/structure/pipes/best_connected_pipe = null From eb7c02a92f11a9ae97f278d521f328793b5800e5 Mon Sep 17 00:00:00 2001 From: Fira Date: Wed, 13 Dec 2023 02:38:19 +0000 Subject: [PATCH 05/11] PROC_REF in a nutshell + lathe fix --- code/_byond_version_compat.dm | 16 ++++------------ code/_experiments.dm | 4 +--- code/controllers/subsystem/garbage.dm | 3 +-- code/game/machinery/autolathe.dm | 2 +- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/code/_byond_version_compat.dm b/code/_byond_version_compat.dm index 7c146fd9b896..24a57ce2f1ca 100644 --- a/code/_byond_version_compat.dm +++ b/code/_byond_version_compat.dm @@ -13,24 +13,16 @@ // For the record: GLOBAL_VERB_REF would be useless as verbs can't be global. /// Call by name proc references, checks if the proc exists on either this type or as a global proc. -#define PROC_REF(X) (.proc/##X) +#define PROC_REF(X) (nameof(.proc/##X)) /// Call by name verb references, checks if the verb exists on either this type or as a global verb. -#define VERB_REF(X) (.verb/##X) +#define VERB_REF(X) (nameof(.verb/##X)) /// Call by name proc reference, checks if the proc exists on either the given type or as a global proc -#define TYPE_PROC_REF(TYPE, X) (##TYPE.proc/##X) +#define TYPE_PROC_REF(TYPE, X) (nameof(##TYPE.proc/##X)) /// Call by name verb reference, checks if the verb exists on either the given type or as a global verb -#define TYPE_VERB_REF(TYPE, X) (##TYPE.verb/##X) +#define TYPE_VERB_REF(TYPE, X) (nameof(##TYPE.verb/##X)) /// Call by name proc reference, checks if the proc is an existing global proc #define GLOBAL_PROC_REF(X) (/proc/##X) -/// fcopy will crash on 515 linux if given a non-existant file, instead of returning 0 like on 514 linux or 515 windows -/// var case matches documentation for fcopy. -/world/proc/__fcopy(Src, Dst) - if (istext(Src) && !fexists(Src)) - return 0 - return fcopy(Src, Dst) - -#define fcopy(Src, Dst) world.__fcopy(Src, Dst) diff --git a/code/_experiments.dm b/code/_experiments.dm index ff5c2e9ec565..39c4c45e7eda 100644 --- a/code/_experiments.dm +++ b/code/_experiments.dm @@ -3,9 +3,7 @@ // Any flag you see here can be flipped with the `-D` CLI argument. // For example, if you want to enable EXPERIMENT_MY_COOL_FEATURE, compile with -DEXPERIMENT_MY_COOL_FEATURE -#if DM_VERSION < 515 - -#elif defined(UNIT_TESTS) +#if defined(UNIT_TESTS) #endif diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index ecd03c82c3a0..37c305d59cde 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -155,7 +155,7 @@ SUBSYSTEM_DEF(garbage) lastlevel = level - //We do this rather then for(var/refID in queue) because that sort of for loop copies the whole list. + //We do this rather then for(var/list/ref_info in queue) because that sort of for loop copies the whole list. //Normally this isn't expensive, but the gc queue can grow to 40k items, and that gets costly/causes overrun. for (var/i in 1 to length(queue)) var/list/L = queue[i] @@ -166,7 +166,6 @@ SUBSYSTEM_DEF(garbage) continue var/queued_at_time = L[GC_QUEUE_ITEM_QUEUE_TIME] - if(queued_at_time > cut_off_time) break // Everything else is newer, skip them count++ diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 6ccb0b5b18f7..76ff409669f4 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -79,7 +79,7 @@ recipe.resources[material] = I.matter[material] //Doesn't take more if it's just a sheet or something. Get what you put in. else recipe.resources[material] = round(I.matter[material]*1.25) // More expensive to produce than they are to recycle. - qdel(I) + QDEL_NULL(I) //Create parts for lathe. for(var/component in components) From 8da19e260aff3a3bc1e362da07a2e49cf0df2236 Mon Sep 17 00:00:00 2001 From: Fira Date: Wed, 13 Dec 2023 15:46:36 +0000 Subject: [PATCH 06/11] delete fixes --- .../game/objects/items/devices/personal_data_transmitter.dm | 1 + code/game/objects/items/reagent_containers/food/snacks.dm | 4 ++++ code/modules/cm_phone/phone.dm | 2 +- code/modules/projectiles/gun.dm | 6 +++--- .../projectiles/guns/specialist/launcher/launcher.dm | 4 ++++ 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/code/game/objects/items/devices/personal_data_transmitter.dm b/code/game/objects/items/devices/personal_data_transmitter.dm index 98f8c60452ea..b967aa9273ca 100644 --- a/code/game/objects/items/devices/personal_data_transmitter.dm +++ b/code/game/objects/items/devices/personal_data_transmitter.dm @@ -139,6 +139,7 @@ /obj/item/device/pdt_locator_tube/Destroy() linked_bracelet = null + QDEL_NULL(battery) return ..() /obj/item/clothing/accessory/pdt_bracelet diff --git a/code/game/objects/items/reagent_containers/food/snacks.dm b/code/game/objects/items/reagent_containers/food/snacks.dm index eb33ca6b1d0f..e2e003f60341 100644 --- a/code/game/objects/items/reagent_containers/food/snacks.dm +++ b/code/game/objects/items/reagent_containers/food/snacks.dm @@ -2745,6 +2745,10 @@ var/list/boxes = list() // If the boxes are stacked, they come here var/boxtag = "" +/obj/item/pizzabox/Destroy(force) + QDEL_NULL(pizza) + return ..() + /obj/item/pizzabox/update_icon() overlays = list() diff --git a/code/modules/cm_phone/phone.dm b/code/modules/cm_phone/phone.dm index b4f13044bc20..231bf54475d3 100644 --- a/code/modules/cm_phone/phone.dm +++ b/code/modules/cm_phone/phone.dm @@ -362,7 +362,7 @@ GLOBAL_LIST_EMPTY_TYPED(transmitters, /obj/structure/transmitter) qdel(attached_to) else attached_to.attached_to = null - attached_to = null + attached_to = null GLOB.transmitters -= src SStgui.close_uis(src) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 8d7ab1532ade..d70950c19993 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -503,13 +503,13 @@ As sniper rifles have both and weapon mods can change them as well. ..() deals w if(slot in list(WEAR_L_HAND, WEAR_R_HAND)) set_gun_user(user) - if(HAS_TRAIT_FROM_ONLY(src, TRAIT_GUN_LIGHT_DEACTIVATED, user)) + if(HAS_TRAIT_FROM_ONLY(src, TRAIT_GUN_LIGHT_DEACTIVATED, WEAKREF(user))) force_light(on = TRUE) - REMOVE_TRAIT(src, TRAIT_GUN_LIGHT_DEACTIVATED, user) + REMOVE_TRAIT(src, TRAIT_GUN_LIGHT_DEACTIVATED, WEAKREF(user)) else set_gun_user(null) force_light(on = FALSE) - ADD_TRAIT(src, TRAIT_GUN_LIGHT_DEACTIVATED, user) + ADD_TRAIT(src, TRAIT_GUN_LIGHT_DEACTIVATED, WEAKREF(user)) return ..() diff --git a/code/modules/projectiles/guns/specialist/launcher/launcher.dm b/code/modules/projectiles/guns/specialist/launcher/launcher.dm index 70f00aa83c35..d0731b2d43bc 100644 --- a/code/modules/projectiles/guns/specialist/launcher/launcher.dm +++ b/code/modules/projectiles/guns/specialist/launcher/launcher.dm @@ -38,6 +38,10 @@ new preload(cylinder) update_icon() +/obj/item/weapon/gun/launcher/Destroy(force) + QDEL_NULL(cylinder) + return ..() + /obj/item/weapon/gun/launcher/verb/toggle_draw_mode() set name = "Switch Storage Drawing Method" set category = "Object" From e60c0ebb14961718f07a8f79fe9c383de6f7c235 Mon Sep 17 00:00:00 2001 From: harryob Date: Sat, 6 Apr 2024 11:33:09 +0100 Subject: [PATCH 07/11] bump to 515.1627 --- .tgs.yml | 2 +- code/_byond_version_compat.dm | 4 ++-- dependencies.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.tgs.yml b/.tgs.yml index 6684cfd084ef..ed84385e3c36 100644 --- a/.tgs.yml +++ b/.tgs.yml @@ -1,5 +1,5 @@ version: 1 -byond: "515.1609" +byond: "515.1627" static_files: - name: config - name: data diff --git a/code/_byond_version_compat.dm b/code/_byond_version_compat.dm index 24a57ce2f1ca..c41fdc830e6e 100644 --- a/code/_byond_version_compat.dm +++ b/code/_byond_version_compat.dm @@ -2,11 +2,11 @@ //Update this whenever you need to take advantage of more recent byond features #define MIN_COMPILER_VERSION 515 -#define MIN_COMPILER_BUILD 1609 +#define MIN_COMPILER_BUILD 1627 #if (DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD) && !defined(SPACEMAN_DMM) && !defined(OPENDREAM) //Don't forget to update this part #error Your version of BYOND is too out-of-date to compile this project. Go to https://www.byond.com/download and update. -#error You need version 515.1609 or higher +#error You need version 515.1627 or higher #endif // So we want to have compile time guarantees these methods exist on local type, unfortunately 515 killed the .proc/procname and .verb/verbname syntax so we have to use nameof() diff --git a/dependencies.sh b/dependencies.sh index 7e2ff8b666d9..55d895a2175b 100644 --- a/dependencies.sh +++ b/dependencies.sh @@ -5,7 +5,7 @@ # byond version export BYOND_MAJOR=515 -export BYOND_MINOR=1609 +export BYOND_MINOR=1627 #rust_g git tag export RUST_G_VERSION=2.1.0 From 7ef5317cadb3ceacb97938a0bb6264b6371e5cb3 Mon Sep 17 00:00:00 2001 From: harryob Date: Sat, 6 Apr 2024 11:40:43 +0100 Subject: [PATCH 08/11] redundant od version --- dependencies.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/dependencies.sh b/dependencies.sh index 55d895a2175b..01d0ca5c976c 100644 --- a/dependencies.sh +++ b/dependencies.sh @@ -19,5 +19,3 @@ export SPACEMAN_DMM_VERSION=suite-1.8 # Python version for mapmerge and other tools export PYTHON_VERSION=3.7.9 - -export OPENDREAM_VERSION=tgs-min-compat From 8ee0d4ec9f42550c53a504526bb2d7d0e88b33dd Mon Sep 17 00:00:00 2001 From: harryob Date: Sat, 6 Apr 2024 11:58:26 +0100 Subject: [PATCH 09/11] beaker hard deletes --- code/modules/reagents/chemistry_machinery/reagent_grinder.dm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/modules/reagents/chemistry_machinery/reagent_grinder.dm b/code/modules/reagents/chemistry_machinery/reagent_grinder.dm index 1de4a84451e1..3c596b6a79a2 100644 --- a/code/modules/reagents/chemistry_machinery/reagent_grinder.dm +++ b/code/modules/reagents/chemistry_machinery/reagent_grinder.dm @@ -68,7 +68,10 @@ /obj/structure/machinery/reagentgrinder/Destroy() cleanup() - . = ..() + + QDEL_NULL(beaker) + + return ..() /obj/structure/machinery/reagentgrinder/update_icon() icon_state = "juicer"+num2text(!isnull(beaker)) From fb6bf1f70913c7ea4db9ece9eeb9a0e0ea13b05f Mon Sep 17 00:00:00 2001 From: harryob Date: Sat, 6 Apr 2024 12:36:59 +0100 Subject: [PATCH 10/11] van hard delete --- code/modules/vehicles/van/van.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/modules/vehicles/van/van.dm b/code/modules/vehicles/van/van.dm index 8bf114d6b4a8..a2e7d68bf9de 100644 --- a/code/modules/vehicles/van/van.dm +++ b/code/modules/vehicles/van/van.dm @@ -167,6 +167,8 @@ var/mob/M = I M.client.images -= normal_image + QDEL_NULL(lighting_holder) + return ..() From 2dbc78794014b369cb9d2d273bc7fd6a0bc6e686 Mon Sep 17 00:00:00 2001 From: harryob <55142896+harryob@users.noreply.github.com> Date: Mon, 8 Apr 2024 08:14:40 +0100 Subject: [PATCH 11/11] updates cbt --- tools/build/build.js | 33 +++++++++++-------- tools/build/lib/byond.js | 68 +++++++++++++++++++++++++--------------- 2 files changed, 63 insertions(+), 38 deletions(-) diff --git a/tools/build/build.js b/tools/build/build.js index 2126cfd77d4c..9efee60ebd31 100644 --- a/tools/build/build.js +++ b/tools/build/build.js @@ -173,21 +173,30 @@ export const YarnTarget = new Juke.Target({ export const TgFontTarget = new Juke.Target({ dependsOn: [YarnTarget], inputs: [ - 'tgui/.yarn/install-target', - 'tgui/packages/tgfont/**/*.+(js|cjs|svg)', - 'tgui/packages/tgfont/package.json', + "tgui/.yarn/install-target", + "tgui/packages/tgfont/**/*.+(js|cjs|svg)", + "tgui/packages/tgfont/package.json", ], outputs: [ - 'tgui/packages/tgfont/dist/tgfont.css', - 'tgui/packages/tgfont/dist/tgfont.eot', - 'tgui/packages/tgfont/dist/tgfont.woff2', + "tgui/packages/tgfont/dist/tgfont.css", + "tgui/packages/tgfont/dist/tgfont.eot", + "tgui/packages/tgfont/dist/tgfont.woff2", ], executes: async () => { - await yarn('tgfont:build'); - fs.copyFileSync('tgui/packages/tgfont/dist/tgfont.css', 'tgui/packages/tgfont/static/tgfont.css'); - fs.copyFileSync('tgui/packages/tgfont/dist/tgfont.eot', 'tgui/packages/tgfont/static/tgfont.eot'); - fs.copyFileSync('tgui/packages/tgfont/dist/tgfont.woff2', 'tgui/packages/tgfont/static/tgfont.woff2'); - } + await yarn("tgfont:build"); + fs.copyFileSync( + "tgui/packages/tgfont/dist/tgfont.css", + "tgui/packages/tgfont/static/tgfont.css" + ); + fs.copyFileSync( + "tgui/packages/tgfont/dist/tgfont.eot", + "tgui/packages/tgfont/static/tgfont.eot" + ); + fs.copyFileSync( + "tgui/packages/tgfont/dist/tgfont.woff2", + "tgui/packages/tgfont/static/tgfont.woff2" + ); + }, }); export const TguiTarget = new Juke.Target({ @@ -303,8 +312,6 @@ export const CleanTarget = new Juke.Target({ dependsOn: [TguiCleanTarget], executes: async () => { Juke.rm("*.{dmb,rsc}"); - Juke.rm("*.mdme*"); - Juke.rm("*.m.*"); Juke.rm("maps/templates.dm"); }, }); diff --git a/tools/build/lib/byond.js b/tools/build/lib/byond.js index 8b6f081c1c01..2d186e2254c6 100644 --- a/tools/build/lib/byond.js +++ b/tools/build/lib/byond.js @@ -139,14 +139,47 @@ export const DreamMaker = async (dmeFile, options = {}) => { throw err; } }; - testOutputFile(`${dmeBaseName}.dmb`); - testOutputFile(`${dmeBaseName}.rsc`); - const runWithWarningChecks = async (dmeFile, args) => { - const execReturn = await Juke.exec(dmeFile, args); + + const testDmVersion = async (dmPath) => { + const execReturn = await Juke.exec(dmPath, [], { + silent: true, + throw: false, + }); + const version = execReturn.combined.match( + `DM compiler version (\\d+)\\.(\\d+)` + ); + if (version == null) { + Juke.logger.error( + `Unexpected DreamMaker return, ensure "${dmPath}" is correct DM path.` + ); + throw new Juke.ExitCode(1); + } + const requiredMajorVersion = 515; + const requiredMinorVersion = 1597; // First with -D switch functionality + const major = Number(version[1]); + const minor = Number(version[2]); if ( - options.warningsAsErrors && - execReturn.combined.match(/\d+:warning: /) + major < requiredMajorVersion || + (major == requiredMajorVersion && minor < requiredMinorVersion) ) { + Juke.logger.error( + `${requiredMajorVersion}.${requiredMinorVersion} DM version required` + ); + throw new Juke.ExitCode(1); + } + }; + + await testDmVersion(dmPath); + testOutputFile(`${dmeBaseName}.dmb`); + testOutputFile(`${dmeBaseName}.rsc`); + const runWithWarningChecks = async (dmPath, args) => { + const execReturn = await Juke.exec(dmPath, args); + const ignoredWarningCodes = options.ignoreWarningCodes ?? []; + const reg = + ignoredWarningCodes.length > 0 + ? new RegExp(`\d+:warning: (?!(${ignoredWarningCodes.join("|")}))`) + : /\d+:warning: /; + if (options.warningsAsErrors && execReturn.combined.match(reg)) { Juke.logger.error(`Compile warnings treated as errors`); throw new Juke.ExitCode(2); } @@ -156,26 +189,11 @@ export const DreamMaker = async (dmeFile, options = {}) => { const { defines } = options; if (defines && defines.length > 0) { Juke.logger.info("Using defines:", defines.join(", ")); - try { - const injectedContent = defines.map((x) => `#define ${x}\n`).join(""); - fs.writeFileSync(`${dmeBaseName}.m.dme`, injectedContent); - const dmeContent = fs.readFileSync(`${dmeBaseName}.dme`); - fs.appendFileSync(`${dmeBaseName}.m.dme`, dmeContent); - await runWithWarningChecks(dmPath, [`${dmeBaseName}.m.dme`]); - fs.writeFileSync( - `${dmeBaseName}.dmb`, - fs.readFileSync(`${dmeBaseName}.m.dmb`) - ); - fs.writeFileSync( - `${dmeBaseName}.rsc`, - fs.readFileSync(`${dmeBaseName}.m.rsc`) - ); - } finally { - Juke.rm(`${dmeBaseName}.m.*`); - } - } else { - await runWithWarningChecks(dmPath, [dmeFile]); } + await runWithWarningChecks(dmPath, [ + ...defines.map((def) => `-D${def}`), + dmeFile, + ]); }; /**