Files
prosperon/world.cm
2026-01-16 20:56:16 -06:00

20 lines
366 B
Plaintext

var world = {}
var entities = {}
world.add_entity = function(entity_proto, data) {
var entity = meme(entity_proto, data)
if (is_function(entity.init))
entity.init()
entities[entity] = true
return entity
}
world.destroy_entity = function(entity) {
if (is_function(entity.on_destroy))
entity.on_destroy()
delete entities[entity]
}
return world