mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 11:07:12 +01:00
Pooling Update from TG
This commit is contained in:
@@ -19,6 +19,8 @@ and reset all of its vars to their default
|
||||
You can override your object's destroy to return QDEL_HINT_PUTINPOOL
|
||||
to ensure its always placed in this pool (this will only be acted on if qdel calls destroy, and destroy will not get called twice)
|
||||
|
||||
For almost all pooling purposes, it is better to use the QDEL hint than to pool it directly with PlaceInPool
|
||||
|
||||
*/
|
||||
|
||||
var/global/list/GlobalPool = list()
|
||||
@@ -94,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()
|
||||
..()
|
||||
@@ -111,4 +122,4 @@ var/global/list/GlobalPool = list()
|
||||
|
||||
/image/ResetVars()
|
||||
..()
|
||||
loc = null
|
||||
loc = null
|
||||
|
||||
Reference in New Issue
Block a user