Merge pull request #13279 from tkdrg/PUTTING_YOUR_VARS_IN_A_POOL

Ports the /vg/ pooling resetVars by Clusterfack
This commit is contained in:
Razharas
2015-11-29 23:36:07 +03:00
+15 -6
View File
@@ -96,15 +96,24 @@ var/global/list/GlobalPool = list()
diver.ResetVars()
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/key in vars)
if(key in exclude)
continue
pooledvariables[type][key] = initial(vars[key])
/datum/proc/ResetVars()
var/list/excluded = list("animate_movement", "contents", "loc", "locs", "parent_type", "vars", "verbs", "type")
if(!pooledvariables[type])
createVariables(args)
for(var/V in vars)
if(V in excluded)
continue
vars[V] = initial(vars[V])
for(var/key in pooledvariables[type])
vars[key] = pooledvariables[type][key]
/atom/movable/ResetVars()
..()