pooled()
format: pooled(poolname)
args:
- poolname: the name of the pool that this object was added to.
default action:
set src.loc to null
usage:
override this to perform cleanup actions on movables that are moving back into the pool, so they can be easily reused later.
unpooled()
format: unpooled(poolname)
args:
- poolname: the name of the pool that this object was retrieved from.
default action:
nothing
usage:
override this to perform initialization actions on movables that are moving out of the pool, so they can be easily reused later.
global procs:
createPool()
format: createPool(poolname,type)
args:
- poolname: the name of the pool that will be created.
- type: the type of object that will inhabit this pool.
default action:
create the pool by name if it does not already exist, and ensure that the type of the pool will be the type supplied.
returns:
a new list with the first element being the type supplied.
pool()
format: pool(poolname,atom/movable)
args:
- poolname: the name of the pool that will be used.
- atom/movable: the object we are adding to the pool.
default action:
if the pool doesn't exist, create one with the base type being the object's type, then add the object to the named pool. After object is added, pooled() is called on the object added to the pool.
returns:
nothing
unpool()
format: unpool(poolname,type=null)
args:
- poolname: the name of the pool that will be used.
- type: an optional type, that if the named pool doesn't exist, a new pool will be created using this type.
default action:
if the pool doesn't exist, create one with the base type being the supplied type. If no type is supplied, return null. If the pool exists, or was created, check the pool. If the pool does not have any ready-made objects, create a new one, and return that instead. If the pool does have objects, grab the first one, remove it from the pool, then return it, after calling upooled() on the returned object.
returns:
one of: null, a new object of the type referenced by pool, or an object residing in the named pool.
Pretty nice, and timely with the particle effect kind of stuff people have been working on. Thanks.