Merge pull request #5014 from Citadel-Station-13/upstream-merge-34314
[MIRROR] Datum var cleanup
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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]"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
+7
-14
@@ -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
|
||||
|
||||
@@ -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 = "<br><font size='1' color='red'><b>Marked Object</b></font>"
|
||||
var/varedited_line = ""
|
||||
if(!islist && D.var_edited)
|
||||
if(!islist && (D.datum_flags & DF_VAR_EDITED))
|
||||
varedited_line = "<br><font size='1' color='red'><b>Var Edited</b></font>"
|
||||
|
||||
var/list/dropdownoptions = list()
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ GLOBAL_PROTECT(exp_to_update)
|
||||
play_records[role] += minutes
|
||||
if(announce_changes)
|
||||
to_chat(mob,"<span class='notice'>You got: [minutes] [role] EXP!</span>")
|
||||
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)
|
||||
|
||||
@@ -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
|
||||
reset_perspective(focus) //Maybe this should be done manually? You figure it out, reader
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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"])
|
||||
|
||||
Reference in New Issue
Block a user