mirror of
https://github.com/bakpakin/tiny-ecs.git
synced 2026-07-22 07:56:52 -06:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1f1225248 | ||
|
|
45e8552054 | ||
|
|
f187dce4fd |
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user