mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-04 14:33:10 +00:00
Pooling Update from TG
Ports https://github.com/tgstation/-tg-station/pull/13279.
This commit is contained in:
@@ -94,17 +94,32 @@ var/global/list/GlobalPool = list()
|
||||
loc = args
|
||||
..()
|
||||
|
||||
/datum/proc/ResetVars(var/list/exclude = list())
|
||||
var/list/excluded = list("animate_movement", "loc", "locs", "parent_type", "vars", "verbs", "type") + exclude
|
||||
var/list/exclude = list("animate_movement", "contents", "loc", "locs", "parent_type", "vars", "verbs", "type")
|
||||
var/list/pooledvariables = list()
|
||||
//thanks to clusterfack @ /vg/station for these two procs
|
||||
/datum/proc/createVariables()
|
||||
pooledvariables[type] = new/list()
|
||||
var/list/exclude = global.exclude + args
|
||||
|
||||
for(var/V in vars)
|
||||
if(V in excluded)
|
||||
for(var/key in vars)
|
||||
if(key in exclude)
|
||||
continue
|
||||
pooledvariables[type][key] = initial(vars[key])
|
||||
|
||||
vars[V] = initial(vars[V])
|
||||
/datum/proc/ResetVars()
|
||||
if(!pooledvariables[type])
|
||||
createVariables(args)
|
||||
|
||||
for(var/key in pooledvariables[type])
|
||||
vars[key] = pooledvariables[type][key]
|
||||
|
||||
/atom/movable/ResetVars()
|
||||
..()
|
||||
vars["loc"] = null
|
||||
loc = null
|
||||
contents = initial(contents) //something is really wrong if this object still has stuff in it by this point
|
||||
|
||||
/image/ResetVars()
|
||||
..()
|
||||
loc = null
|
||||
|
||||
#undef ATOM_POOL_COUNT
|
||||
|
||||
Reference in New Issue
Block a user