From 07ad32560425e783cb209bd8c04af6843b59e6cd Mon Sep 17 00:00:00 2001 From: morrowwolf <8919187+morrowwolf@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:41:54 -0400 Subject: [PATCH 1/7] warning --- .../configuration/entries/general.dm | 24 +++++++++++ code/modules/client/client_procs.dm | 40 +++++++++++++------ config/example/config.txt | 2 + 3 files changed, 53 insertions(+), 13 deletions(-) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index bbbb0fc5f5..a499bc769c 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -620,3 +620,27 @@ This maintains a list of ip addresses that are able to bypass topic filtering. protection = CONFIG_ENTRY_HIDDEN|CONFIG_ENTRY_LOCKED /datum/config_entry/flag/auto_profile + +/datum/config_entry/number/client_warn_version + default = null + min_val = 500 + +/datum/config_entry/number/client_warn_build + default = null + min_val = 0 + +/datum/config_entry/string/client_warn_message + default = "Your version of BYOND may have issues or be blocked from accessing this server in the future." + +/datum/config_entry/flag/client_warn_popup + +/datum/config_entry/number/client_error_version + default = null + min_val = 500 + +/datum/config_entry/string/client_error_message + default = "Your version of BYOND is too old, may have issues, and is blocked from accessing this server." + +/datum/config_entry/number/client_error_build + default = null + min_val = 0 diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index c3a0c52d0c..5dc0600287 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -5,8 +5,6 @@ #define UPLOAD_LIMIT 10485760 //Restricts client uploads to the server to 10MB //Boosted this thing. What's the worst that can happen? #define MIN_CLIENT_VERSION 0 //Just an ambiguously low version for now, I don't want to suddenly stop people playing. //I would just like the code ready should it ever need to be used. -#define GOOD_BYOND_MAJOR 513 -#define GOOD_BYOND_MINOR 1500 GLOBAL_LIST_INIT(blacklisted_builds, list( "1407" = "bug preventing client display overrides from working leads to clients being able to see things/mobs they shouldn't be able to see", @@ -358,14 +356,34 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( INVOKE_ASYNC(src, /client/proc/set_macros) // Version check below if we ever need to start checking against BYOND versions again. - - /*if((byond_version < world.byond_version) || ((byond_version == world.byond_version) && (byond_build < world.byond_build))) - src << "Your version of Byond (v[byond_version].[byond_build]) differs from the server (v[world.byond_version].[world.byond_build]). You may experience graphical glitches, crashes, or other errors. You will be disconnected until your version matches or exceeds the server version.
\ - Direct Download (Windows Installer): http://www.byond.com/download/build/[world.byond_version]/[world.byond_version].[world.byond_build]_byond.exe
\ - Other versions (search for [world.byond_build] or higher): http://www.byond.com/download/build/[world.byond_version]
" + var/breaking_version = CONFIG_GET(number/client_error_version) + var/breaking_build = CONFIG_GET(number/client_error_build) + var/warn_version = CONFIG_GET(number/client_warn_version) + var/warn_build = CONFIG_GET(number/client_warn_build) + + if (byond_version < breaking_version || (byond_version == breaking_version && byond_build < breaking_build)) //Out of date client. + to_chat_immediate(src, SPAN_DANGER("Your version of BYOND is too old:")) + to_chat_immediate(src, CONFIG_GET(string/client_error_message)) + to_chat_immediate(src, "Your version: [byond_version].[byond_build]") + to_chat_immediate(src, "Required version: [breaking_version].[breaking_build] or later") + to_chat_immediate(src, "Visit BYOND's website to get the latest version of BYOND.") qdel(src) - return*/ - //hardcode for now + return + + if (byond_version < warn_version || (byond_version == warn_version && byond_build < warn_build)) //We have words for this client. + if(CONFIG_GET(flag/client_warn_popup)) + var/msg = "Your version of BYOND may be getting out of date:
" + msg += CONFIG_GET(string/client_warn_message) + "

" + msg += "Your version: [byond_version].[byond_build]
" + msg += "Required version to remove this message: [warn_version].[warn_build] or later
" + msg += "Visit BYOND's website to get the latest version of BYOND.
" + src << browse(msg, "window=warning_popup") + else + to_chat(src, SPAN_DANGER("Your version of BYOND may be getting out of date:")) + to_chat(src, CONFIG_GET(string/client_warn_message)) + to_chat(src, "Your version: [byond_version].[byond_build]") + to_chat(src, "Required version to remove this message: [warn_version].[warn_build] or later") + to_chat(src, "Visit BYOND's website to get the latest version of BYOND.") if (num2text(byond_build) in GLOB.blacklisted_builds) log_access("Failed login: [key] - blacklisted byond build ([byond_version].[byond_build])") @@ -376,10 +394,6 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( qdel(src) return - //do this check after the blacklist check to avoid confusion - if((byond_version < GOOD_BYOND_MAJOR) || ((byond_version == GOOD_BYOND_MAJOR) && (byond_build < GOOD_BYOND_MINOR))) - to_chat(src, FONT_SIZE_HUGE(SPAN_BOLDNOTICE("YOUR BYOND VERSION IS NOT WELL SUITED FOR THIS SERVER. Download latest BETA build or you may suffer random crashes or disconnects."))) - // Initialize tgui panel stat_panel.initialize( inline_html = file("html/statbrowser.html"), diff --git a/config/example/config.txt b/config/example/config.txt index 8a976e02a5..ee22fbaf90 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -243,3 +243,5 @@ GAMEMODE_DEFAULT Extended ## How long the mob will take to chestburst, in seconds #EMBRYO_BURST_TIMER 450 + +CLIENT_ERROR_VERSION 514 From 0a9717d8cbd551c3f3491822406d112a563384c8 Mon Sep 17 00:00:00 2001 From: morrowwolf <8919187+morrowwolf@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:42:01 -0400 Subject: [PATCH 2/7] 515 for real --- .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 | 59 ++-------------- code/_experiments.dm | 24 +------ code/controllers/subsystem/garbage.dm | 44 +++--------- code/datums/datum.dm | 7 -- code/game/machinery/autolathe.dm | 2 +- .../devices/personal_data_transmitter.dm | 1 + .../items/reagent_containers/food/snacks.dm | 4 ++ code/game/objects/structures/pipes/pipes.dm | 2 + code/game/world.dm | 4 +- .../view_variables/reference_tracking.dm | 2 - code/modules/projectiles/gun.dm | 6 +- .../guns/specialist/launcher/launcher.dm | 4 ++ .../chemistry_machinery/reagent_grinder.dm | 5 +- code/modules/vehicles/van/van.dm | 2 + dependencies.sh | 8 +-- tools/build/build.js | 31 ++++++++- tools/build/lib/byond.js | 68 ++++++++++++------- 22 files changed, 113 insertions(+), 179 deletions(-) diff --git a/.github/alternate_byond_versions.txt b/.github/alternate_byond_versions.txt index 005803964c..7b50af4688 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 ba3fc6b26c..ed84385e3c 100644 --- a/.tgs.yml +++ b/.tgs.yml @@ -1,5 +1,5 @@ version: 1 -byond: "514.1588" +byond: "515.1627" static_files: - name: config - name: data diff --git a/code/__DEFINES/__spacemandmm.dm b/code/__DEFINES/__spacemandmm.dm index b62bbee425..9a044949db 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 31f4b2aca0..07c3eb664e 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 7cd5777f46..5a2fd60e71 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 26968f0f83..c41fdc830e 100644 --- a/code/_byond_version_compat.dm +++ b/code/_byond_version_compat.dm @@ -1,56 +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 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://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.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() // 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. -#define VERB_REF(X) (.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) -/// 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) - -/// 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. @@ -64,16 +25,4 @@ /// 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) - if (istext(Src) && !fexists(Src)) - return 0 - return fcopy(Src, Dst) -#define fcopy(Src, Dst) world.__fcopy(Src, Dst) - -#endif diff --git a/code/_experiments.dm b/code/_experiments.dm index 6e5addb5f9..39c4c45e7e 100644 --- a/code/_experiments.dm +++ b/code/_experiments.dm @@ -3,29 +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 -// 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 +#if defined(UNIT_TESTS) #endif diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index e94d6b1aff..37c305d59c 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -139,13 +139,6 @@ 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) delslasttick = 0 @@ -162,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] @@ -173,21 +166,15 @@ 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++ -#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 + + // 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]++ @@ -221,11 +208,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 @@ -261,8 +244,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 @@ -271,20 +252,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 7d497785a7..3e317ffd60 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/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 6ccb0b5b18..76ff409669 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) diff --git a/code/game/objects/items/devices/personal_data_transmitter.dm b/code/game/objects/items/devices/personal_data_transmitter.dm index 6e8aa001ca..2e92b3f0b0 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 8aae33b5f2..d27d6adb09 100644 --- a/code/game/objects/items/reagent_containers/food/snacks.dm +++ b/code/game/objects/items/reagent_containers/food/snacks.dm @@ -2760,6 +2760,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/game/objects/structures/pipes/pipes.dm b/code/game/objects/structures/pipes/pipes.dm index 8459b9c100..35b3ba4711 100644 --- a/code/game/objects/structures/pipes/pipes.dm +++ b/code/game/objects/structures/pipes/pipes.dm @@ -53,6 +53,7 @@ for(var/obj/structure/pipes/P in connected_to) P.remove_connection(src) + connected_to.Cut() GLOB.mainship_pipes -= src @@ -97,6 +98,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 diff --git a/code/game/world.dm b/code/game/world.dm index e67fca2856..26b70a9489 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" @@ -381,7 +381,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 f6f2b86f31..35f464354c 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/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index a3e4900326..6ab143b8d8 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -502,13 +502,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 70f00aa83c..d0731b2d43 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" diff --git a/code/modules/reagents/chemistry_machinery/reagent_grinder.dm b/code/modules/reagents/chemistry_machinery/reagent_grinder.dm index 1de4a84451..3c596b6a79 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)) diff --git a/code/modules/vehicles/van/van.dm b/code/modules/vehicles/van/van.dm index 0b99d682c0..c2b1659d30 100644 --- a/code/modules/vehicles/van/van.dm +++ b/code/modules/vehicles/van/van.dm @@ -166,6 +166,8 @@ var/mob/M = I M.client.images -= normal_image + QDEL_NULL(lighting_holder) + return ..() diff --git a/dependencies.sh b/dependencies.sh index f88c2f9b0a..01d0ca5c97 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=1627 #rust_g git tag export RUST_G_VERSION=2.1.0 @@ -15,9 +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 - -export OPENDREAM_VERSION=0.2.0 diff --git a/tools/build/build.js b/tools/build/build.js index c145ed391e..65f88a9b60 100644 --- a/tools/build/build.js +++ b/tools/build/build.js @@ -170,6 +170,35 @@ export const YarnTarget = new Juke.Target({ executes: ({ get }) => yarn("install", get(CiParameter) && "--immutable"), }); +export const TgFontTarget = new Juke.Target({ + dependsOn: [YarnTarget], + inputs: [ + "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", + ], + 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" + ); + }, +}); + export const TguiTarget = new Juke.Target({ dependsOn: [YarnTarget], inputs: [ @@ -283,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 8b6f081c1c..2d186e2254 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, + ]); }; /** From ae141da299f199da67411639969351670bb98b6a Mon Sep 17 00:00:00 2001 From: Zonespace <41448081+Zonespace27@users.noreply.github.com> Date: Sun, 17 Mar 2024 20:00:06 -0700 Subject: [PATCH 3/7] Use OpenDream release for linter (#5906) Ports https://github.com/goonstation/goonstation/pull/18127 Should increase testing speed. Seems to reduce it from ~150s to ~20 --- .github/workflows/ci_suite.yml | 30 ++++++++---------------------- tools/ci/download_od.sh | 11 ----------- tools/ci/run_od.sh | 4 ---- tools/ci/setup_od.sh | 7 ------- 4 files changed, 8 insertions(+), 44 deletions(-) delete mode 100644 tools/ci/download_od.sh delete mode 100644 tools/ci/run_od.sh delete mode 100644 tools/ci/setup_od.sh diff --git a/.github/workflows/ci_suite.yml b/.github/workflows/ci_suite.yml index 978ede1e65..9636c6c48e 100644 --- a/.github/workflows/ci_suite.yml +++ b/.github/workflows/ci_suite.yml @@ -66,30 +66,16 @@ jobs: odlint: name: Lint with OpenDream - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - name: Get OpenDream Version - run: | - source dependencies.sh - echo "OPENDREAM_VERSION=$OPENDREAM_VERSION" >> $GITHUB_ENV - - name: Restore OpenDream cache - uses: actions/cache@v3 - id: cache-od + - uses: actions/checkout@v4 + - uses: robinraju/release-downloader@v1.9 with: - path: ~/OpenDream - key: ${{ runner.os }}-opendream-${{ env.OPENDREAM_VERSION }} - - name: Download OpenDream - if: steps.cache-od.outputs.cache-hit != 'true' - run: | - bash tools/ci/download_od.sh - - name: Setup OpenDream - if: steps.cache-od.outputs.cache-hit != 'true' - run: | - bash tools/ci/setup_od.sh - - name: Run OpenDream - run: | - bash tools/ci/run_od.sh + repository: "OpenDreamProject/OpenDream" + tag: "latest" + fileName: "DMCompiler_linux-x64.tar.gz" + extract: true + - run: ./DMCompiler_linux-x64/DMCompiler --suppress-unimplemented colonialmarines.dme compile_all_maps: if: "!contains(github.event.head_commit.message, '[ci skip]')" diff --git a/tools/ci/download_od.sh b/tools/ci/download_od.sh deleted file mode 100644 index 024f93f928..0000000000 --- a/tools/ci/download_od.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -eo pipefail - -if [ -z "${OPENDREAM_VERSION+x}" ]; then - source dependencies.sh -fi - -git clone https://github.com/OpenDreamProject/OpenDream.git ~/OpenDream -cd ~/OpenDream -git checkout tags/v${OPENDREAM_VERSION} -git submodule update --init --recursive diff --git a/tools/ci/run_od.sh b/tools/ci/run_od.sh deleted file mode 100644 index 3eeac59073..0000000000 --- a/tools/ci/run_od.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -eo pipefail - -dotnet ~/OpenDream/DMCompiler/bin/Release/net7.0/DMCompiler.dll --suppress-unimplemented colonialmarines.dme diff --git a/tools/ci/setup_od.sh b/tools/ci/setup_od.sh deleted file mode 100644 index 6d2ec17068..0000000000 --- a/tools/ci/setup_od.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -eo pipefail - -cd ~/OpenDream - -dotnet restore -dotnet build -c Release From 96c95f781e83862bc82ee967dd1ffed7c7d8e493 Mon Sep 17 00:00:00 2001 From: harryob <55142896+harryob@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:07:18 +0100 Subject: [PATCH 4/7] weird pvp thing i guess --- code/modules/vehicles/van/van.dm | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/modules/vehicles/van/van.dm b/code/modules/vehicles/van/van.dm index c2b1659d30..0b99d682c0 100644 --- a/code/modules/vehicles/van/van.dm +++ b/code/modules/vehicles/van/van.dm @@ -166,8 +166,6 @@ var/mob/M = I M.client.images -= normal_image - QDEL_NULL(lighting_holder) - return ..() From 2950dd893cb0b23b272014348e92ee1f3cda9a16 Mon Sep 17 00:00:00 2001 From: harryob <55142896+harryob@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:41:26 +0100 Subject: [PATCH 5/7] this shouldn't be required --- code/controllers/mc/globals.dm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/controllers/mc/globals.dm b/code/controllers/mc/globals.dm index 7b5cc94d36..288f9f5534 100644 --- a/code/controllers/mc/globals.dm +++ b/code/controllers/mc/globals.dm @@ -13,8 +13,10 @@ 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)) - QDEL_IN(exclude_these, 0) //signal logging isn't ready + // 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)) QDEL_IN(exclude_these, 0) //signal logging isn't ready log_world("[vars.len - gvars_datum_in_built_vars.len] global variables") From cdd2996e34379fdd5e92b3dd3393e8cdb4753bbe Mon Sep 17 00:00:00 2001 From: harryob <55142896+harryob@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:45:26 +0100 Subject: [PATCH 6/7] newline --- code/controllers/mc/globals.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/controllers/mc/globals.dm b/code/controllers/mc/globals.dm index 288f9f5534..b5547564b7 100644 --- a/code/controllers/mc/globals.dm +++ b/code/controllers/mc/globals.dm @@ -16,7 +16,8 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars) // 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)) QDEL_IN(exclude_these, 0) //signal logging isn't ready + 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)) + QDEL_IN(exclude_these, 0) //signal logging isn't ready log_world("[vars.len - gvars_datum_in_built_vars.len] global variables") From 4ceb3143f9729deb81a65226689f04299bd129a7 Mon Sep 17 00:00:00 2001 From: harryob Date: Mon, 26 Feb 2024 12:48:05 +0000 Subject: [PATCH 7/7] speeds up ci runs by 3 minutes (#5803) closes #5679 --- code/controllers/subsystem/ticker.dm | 8 ++++++++ code/game/world.dm | 1 + 2 files changed, 9 insertions(+) diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 7fe2b56eba..e06e1ac458 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -8,6 +8,10 @@ SUBSYSTEM_DEF(ticker) var/current_state = GAME_STATE_STARTUP //State of current round used by process() var/force_ending = FALSE //Round was ended by admin intervention + + /// If TRUE, there is no lobby phase, the game starts immediately. + var/start_immediately = FALSE + var/bypass_checks = FALSE //Bypass mode init checks var/setup_failed = FALSE //If the setup has failed at any point var/setup_started = FALSE @@ -79,6 +83,10 @@ SUBSYSTEM_DEF(ticker) var/mob/new_player/player = i if(player.ready) // TODO: port this == PLAYER_READY_TO_PLAY) ++totalPlayersReady + + if(start_immediately) + time_left = 0 + if(time_left < 0 || delay_start) return diff --git a/code/game/world.dm b/code/game/world.dm index 26b70a9489..77d48d3593 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -388,6 +388,7 @@ var/datum/BSQL_Connection/connection /world/proc/HandleTestRun() // Wait for the game ticker to initialize Master.sleep_offline_after_initializations = FALSE + SSticker.start_immediately = TRUE UNTIL(SSticker.initialized) //trigger things to run the whole process