3 Commits

Author SHA1 Message Date
bakpakin
c1f1225248 Update to version 1.1-5. 2015-06-21 14:48:48 -04:00
bakpakin
45e8552054 Fix entity count in worlds. 2015-06-21 14:42:03 -04:00
bakpakin
f187dce4fd Update documentation. 2015-06-19 19:45:26 -04:00
2 changed files with 32 additions and 8 deletions
+24
View File
@@ -0,0 +1,24 @@
package = "tiny-ecs"
version = "1.1-5"
source = {
url = "git://github.com/bakpakin/tiny-ecs",
tag = "1.1-5"
}
description = {
summary = "Entity Component System for Lua.",
detailed = [[
Pure Lua implementation of an easy to use, compact, fast, and flexible
Entity Component System. Works well with Object Orientation.
]],
homepage = "https://github.com/bakpakin/tiny-ecs",
license = "MIT"
}
dependencies = {
"lua >= 5.1"
}
build = {
type = "builtin",
modules = {
tiny = "tiny.lua"
}
}
+8 -8
View File
@@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-- @author Calvin Rose -- @author Calvin Rose
-- @license MIT -- @license MIT
-- @copyright 2015 -- @copyright 2015
local tiny = { _VERSION = "1.1-4" } local tiny = { _VERSION = "1.1-5" }
-- Local versions of standard lua functions -- Local versions of standard lua functions
local tinsert = table.insert local tinsert = table.insert
@@ -286,11 +286,11 @@ end
-- Systems process each entity individual, and are usually what is needed. -- Systems process each entity individual, and are usually what is needed.
-- Processing Systems have three extra callbacks besides those inheritted from -- Processing Systems have three extra callbacks besides those inheritted from
-- vanilla Systems. -- vanilla Systems.
-- * `function system:preProcess(entities, dt)` - Called before iterating --
-- over each Entity. -- function system:preProcess(entities, dt) -- Called before iteration.
-- * `function system:process(entities, dt)` - Called for each Entity in -- function system:process(entities, dt) -- Process each entity.
-- the System. -- function system:postProcess(entity, dt) -- Called after iteration.
-- * `function system:postProcess(entity, dt)` - Called after iteration. --
-- Processing Systems have their own `update` method, so don't implement a -- Processing Systems have their own `update` method, so don't implement a
-- a custom `update` callback for Processing Systems. -- a custom `update` callback for Processing Systems.
-- @see system -- @see system
@@ -542,6 +542,7 @@ function tiny_manageEntities(world)
entity = e2r[i] entity = e2r[i]
if entities[entity] then if entities[entity] then
entities[entity] = nil entities[entity] = nil
entityCount = entityCount - 1
for j = 1, #systems do for j = 1, #systems do
system = systems[j] system = systems[j]
@@ -556,7 +557,6 @@ function tiny_manageEntities(world)
seis[tmpEntity] = index seis[tmpEntity] = index
seis[entity] = nil seis[entity] = nil
ses[#ses] = nil ses[#ses] = nil
entityCount = entityCount - 1
onRemove = system.onRemove onRemove = system.onRemove
if onRemove then if onRemove then
onRemove(system, entity) onRemove(system, entity)
@@ -574,6 +574,7 @@ function tiny_manageEntities(world)
entity = e2a[i] entity = e2a[i]
if not entities[entity] then if not entities[entity] then
entities[entity] = true entities[entity] = true
entityCount = entityCount + 1
for j = 1, #systems do for j = 1, #systems do
system = systems[j] system = systems[j]
@@ -585,7 +586,6 @@ function tiny_manageEntities(world)
index = #ses + 1 index = #ses + 1
ses[index] = entity ses[index] = entity
seis[entity] = index seis[entity] = index
entityCount = entityCount + 1
onAdd = system.onAdd onAdd = system.onAdd
if onAdd then if onAdd then
onAdd(system, entity) onAdd(system, entity)