ID:49658
 
A small proc I've made that I find very helpful in my games, I thought I would share it.

This deletion method wont return your code like the built-in del does.


proc
game_del(atom/a)

var/list/built_in = list("type","parent_type","gender","verbs","vars","group")
for(var/v in a.vars)
if(!(v in built_in))
a.vars[v] = null


Well, you could do it manually, but that system works in fine. Could be used for starting new games or something, but either way I'd say that's an efficient way of exterminating all non-built in variables.
Or, instead of setting it to null, you could set it to its initial value with the initial() proc :P
Jeff8500 wrote:
Or, instead of setting it to null, you could set it to its initial value with the initial() proc :P

I want to delete it, when all its variables are null like this, it sets its loc to zero, and deletes any references to the object leaving it to the garbage collector.
Smokey Joe wrote:
Jeff8500 wrote:
Or, instead of setting it to null, you could set it to its initial value with the initial() proc :P

I want to delete it, when all its variables are null like this, it sets its loc to zero, and deletes any references to the object leaving it to the garbage collector.

Oh, I thought you were going for more of a game reset type thing :P

If you're wondering, garbage collection isn't my strong point...