diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index 8b3e74b96e..cb8a2ad2ca 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -6,6 +6,10 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768)) +// for /datum/var/datum_flags +#define DF_USE_TAG 1 +#define DF_VAR_EDITED 2 + //FLAGS BITMASK #define STOPSPRESSUREDMAGE_1 1 //This flag is used on the flags_1 variable for SUIT and HEAD items which stop pressure damage. Note that the flag 1 was previous used as ONBACK, so it is possible for some code to use (flags & 1) when checking if something can be put on your back. Replace this code with (inv_flags & SLOT_BACK) if you see it anywhere //To successfully stop you taking all pressure damage you must have both a suit and head item with this flag. diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 6256fedaea..ad52e5b340 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1489,14 +1489,14 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) // \ref behaviour got changed in 512 so this is necesary to replicate old behaviour. // If it ever becomes necesary to get a more performant REF(), this lies here in wait -// #define REF(thing) (thing && istype(thing, /datum) && thing:use_tag && thing:tag ? "[thing:tag]" : "\ref[thing]") +// #define REF(thing) (thing && istype(thing, /datum) && (thing:datum_flags & DF_USE_TAG) && thing:tag ? "[thing:tag]" : "\ref[thing]") /proc/REF(input) if(istype(input, /datum)) var/datum/thing = input - if(thing.use_tag) + if(thing.datum_flags & DF_USE_TAG) if(!thing.tag) - stack_trace("A ref was requested of an object with use_tag set but no tag: [thing]") - thing.use_tag = FALSE + stack_trace("A ref was requested of an object with DF_USE_TAG set but no tag: [thing]") + thing.datum_flags &= ~DF_USE_TAG else return "\[[url_encode(thing.tag)]\]" return "\ref[input]" diff --git a/code/controllers/configuration/config_entry.dm b/code/controllers/configuration/config_entry.dm index d1be661f6a..87112f0001 100644 --- a/code/controllers/configuration/config_entry.dm +++ b/code/controllers/configuration/config_entry.dm @@ -43,7 +43,7 @@ return FALSE . = ValidateAndSet("[var_value]") if(.) - var_edited = TRUE + datum_flags |= DF_VAR_EDITED return if(var_name in banned_edits) return FALSE @@ -114,7 +114,7 @@ var/temp = text2num(trim(str_val)) if(!isnull(temp)) value = CLAMP(integer ? round(temp) : temp, min_val, max_val) - if(value != temp && !var_edited) + if(value != temp && !(datum_flags & DF_VAR_EDITED)) log_config("Changing [name] from [temp] to [value]!") return TRUE return FALSE diff --git a/code/datums/callback.dm b/code/datums/callback.dm index 5566137189..6e92d41c6d 100644 --- a/code/datums/callback.dm +++ b/code/datums/callback.dm @@ -89,7 +89,7 @@ calling_arguments = calling_arguments + args //not += so that it creates a new list so the arguments list stays clean else calling_arguments = args - if(var_edited) + if(datum_flags & DF_VAR_EDITED) return WrapAdminProcCall(object, delegate, calling_arguments) if (object == GLOBAL_PROC) return call(delegate)(arglist(calling_arguments)) @@ -115,7 +115,7 @@ calling_arguments = calling_arguments + args //not += so that it creates a new list so the arguments list stays clean else calling_arguments = args - if(var_edited) + if(datum_flags & DF_VAR_EDITED) return WrapAdminProcCall(object, delegate, calling_arguments) if (object == GLOBAL_PROC) return call(delegate)(arglist(calling_arguments)) diff --git a/code/datums/components/forensics.dm b/code/datums/components/forensics.dm index 76baa057cc..417525ab08 100644 --- a/code/datums/components/forensics.dm +++ b/code/datums/components/forensics.dm @@ -139,7 +139,8 @@ if(laststamppos) LAZYSET(hiddenprints, M.key, copytext(hiddenprints[M.key], 1, laststamppos)) hiddenprints[M.key] += " Last: [M.real_name]\[[current_time]\][hasgloves]. Ckey: [M.ckey]" //made sure to be existing by if(!LAZYACCESS);else - parent.fingerprintslast = M.ckey + var/atom/A = parent + A.fingerprintslast = M.ckey return TRUE /datum/component/forensics/proc/add_blood_DNA(list/dna) //list(dna_enzymes = type) diff --git a/code/datums/datum.dm b/code/datums/datum.dm index 6a3ad57878..d07890275d 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -1,14 +1,13 @@ /datum - var/gc_destroyed //Time when this object was destroyed. - var/list/active_timers //for SStimer - var/list/datum_components //for /datum/components - var/ui_screen = "home" //for tgui - var/use_tag = FALSE - var/datum/weakref/weak_reference + var/gc_destroyed //Time when this object was destroyed. + var/list/active_timers //for SStimer + var/list/datum_components //for /datum/components + var/datum_flags = NONE + var/datum/weakref/weak_reference #ifdef TESTING - var/running_find_references - var/last_find_references = 0 + var/running_find_references + var/last_find_references = 0 #endif // Default implementation of clean-up code. @@ -38,10 +37,4 @@ qdel(C, FALSE, TRUE) dc.Cut() - var/list/focusers = src.focusers - if(focusers) - for(var/i in 1 to focusers.len) - var/mob/M = focusers[i] - M.set_focus(M) - return QDEL_HINT_QUEUE diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index 8f8fa8f1f0..672ec3a58b 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -1,18 +1,11 @@ -/datum - var/var_edited = FALSE //Warrenty void if seal is broken - var/fingerprintslast = null - /datum/proc/can_vv_get(var_name) return TRUE /datum/proc/vv_edit_var(var_name, var_value) //called whenever a var is edited - switch(var_name) - if ("vars") - return FALSE - if ("var_edited") - return FALSE - var_edited = TRUE + if(var_name == NAMEOF(src, vars)) + return FALSE vars[var_name] = var_value + datum_flags |= DF_VAR_EDITED /datum/proc/vv_get_var(var_name) switch(var_name) @@ -109,7 +102,7 @@ if(holder && holder.marked_datum && holder.marked_datum == D) marked = "
Marked Object" var/varedited_line = "" - if(!islist && D.var_edited) + if(!islist && (D.datum_flags & DF_VAR_EDITED)) varedited_line = "
Var Edited" var/list/dropdownoptions = list() diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 6645ffe37a..0643918b3d 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -26,13 +26,14 @@ var/datum/proximity_monitor/proximity_monitor var/buckle_message_cooldown = 0 + var/fingerprintslast /atom/New(loc, ...) //atom creation method that preloads variables at creation if(GLOB.use_preloader && (src.type == GLOB._preloader.target_path))//in case the instanciated atom is creating other atoms in New() GLOB._preloader.load(src) - if(use_tag) + if(datum_flags & DF_USE_TAG) GenerateTag() var/do_initialize = SSatoms.initialized diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm index aa7e7d0178..37b87ce6de 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -79,14 +79,14 @@ anchored = TRUE //stops it being moved /obj/machinery/nuclearbomb/syndicate - use_tag = TRUE + datum_flags = DF_USE_TAG //ui_style = "syndicate" // actually the nuke op bomb is a stole nt bomb /obj/machinery/nuclearbomb/syndicate/GenerateTag() var/obj/machinery/nuclearbomb/existing = locate("syndienuke") in GLOB.nuke_list if(existing) stack_trace("Attempted to spawn a syndicate nuke while one already exists at [COORD(existing.loc)]") - use_tag = FALSE + datum_flags &= ~DF_USE_TAG return tag = "syndienuke" diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index e4c86315b5..da448b8eca 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -1,4 +1,4 @@ -GLOBAL_LIST_INIT(VVlocked, list("vars", "var_edited", "client", "virus", "viruses", "cuffed", "last_eaten", "unlock_content", "force_ending")) +GLOBAL_LIST_INIT(VVlocked, list("vars", "datum_flags", "client", "virus", "viruses", "cuffed", "last_eaten", "unlock_content", "force_ending")) GLOBAL_PROTECT(VVlocked) GLOBAL_LIST_INIT(VVicon_edit_lock, list("icon", "icon_state", "overlays", "underlays", "resize")) GLOBAL_PROTECT(VVicon_edit_lock) @@ -214,7 +214,7 @@ GLOBAL_PROTECT(VVpixelmovement) return .["type"] = type var/atom/newguy = new type() - newguy.var_edited = TRUE + newguy.datum_flags |= DF_VAR_EDITED .["value"] = newguy if (VV_NEW_DATUM) @@ -224,7 +224,7 @@ GLOBAL_PROTECT(VVpixelmovement) return .["type"] = type var/datum/newguy = new type() - newguy.var_edited = TRUE + newguy.datum_flags |= DF_VAR_EDITED .["value"] = newguy if (VV_NEW_TYPE) @@ -243,7 +243,7 @@ GLOBAL_PROTECT(VVpixelmovement) .["type"] = type var/datum/newguy = new type() if(istype(newguy)) - newguy.var_edited = TRUE + newguy.datum_flags |= DF_VAR_EDITED .["value"] = newguy diff --git a/code/modules/jobs/job_exp.dm b/code/modules/jobs/job_exp.dm index 9bbb753de6..534e530e17 100644 --- a/code/modules/jobs/job_exp.dm +++ b/code/modules/jobs/job_exp.dm @@ -228,7 +228,7 @@ GLOBAL_PROTECT(exp_to_update) play_records[role] += minutes if(announce_changes) to_chat(mob,"You got: [minutes] [role] EXP!") - if(mob.mind.special_role && !mob.mind.var_edited) + if(mob.mind.special_role && !(mob.mind.datum_flags & DF_VAR_EDITED)) var/trackedrole = mob.mind.special_role play_records[trackedrole] += minutes if(announce_changes) diff --git a/code/modules/keybindings/focus.dm b/code/modules/keybindings/focus.dm index 9d3e44f059..205b293e9a 100644 --- a/code/modules/keybindings/focus.dm +++ b/code/modules/keybindings/focus.dm @@ -1,20 +1,8 @@ -/datum - var/list/focusers //Only initialized when needed. Contains a list of mobs focusing on this. - /mob var/datum/focus //What receives our keyboard inputs. src by default /mob/proc/set_focus(datum/new_focus) if(focus == new_focus) return - - if(new_focus) - if(!new_focus.focusers) //Set up the new focus - new_focus.focusers = list() - new_focus.focusers += src - - if(focus) - focus.focusers -= src //Tell the old focus we're done with it - focus = new_focus - reset_perspective(focus) //Maybe this should be done manually? You figure it out, reader \ No newline at end of file + reset_perspective(focus) //Maybe this should be done manually? You figure it out, reader diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 7387fe57a5..5bc054951b 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -174,8 +174,7 @@ return 0 /mob/proc/Life() - set waitfor = 0 - return + set waitfor = FALSE /mob/proc/get_item_by_slot(slot_id) return null diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index d7bba73ce7..536ee125e0 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -1,11 +1,11 @@ /mob + datum_flags = DF_USE_TAG density = TRUE layer = MOB_LAYER animate_movement = 2 flags_1 = HEAR_1 hud_possible = list(ANTAG_HUD) pressure_resistance = 8 - use_tag = TRUE var/lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE var/datum/mind/mind var/list/datum/action/actions = list() diff --git a/code/modules/tgui/tgui.dm b/code/modules/tgui/tgui.dm index b1275cf00f..bb545547f9 100644 --- a/code/modules/tgui/tgui.dm +++ b/code/modules/tgui/tgui.dm @@ -35,6 +35,7 @@ var/list/datum/tgui/children = list() // Children of this UI. var/titlebar = TRUE var/custom_browser_id = FALSE + var/ui_screen = "home" /** * public @@ -216,7 +217,7 @@ var/list/config_data = list( "title" = title, "status" = status, - "screen" = src_object.ui_screen, + "screen" = ui_screen, "style" = style, "interface" = interface, "fancy" = user.client.prefs.tgui_fancy, @@ -277,7 +278,7 @@ initialized = TRUE if("tgui:view") if(params["screen"]) - src_object.ui_screen = params["screen"] + ui_screen = params["screen"] SStgui.update_uis(src_object) if("tgui:link") user << link(params["url"])