mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-01 20:03:55 -04:00
Cache added and removed components
This commit is contained in:
parent
bb508ee947
commit
ecb3c2db7e
4 changed files with 67 additions and 18 deletions
13
main.lua
13
main.lua
|
@ -35,11 +35,12 @@ end)
|
|||
|
||||
local test_system = System("test_system", {Components.test_comp_1})
|
||||
|
||||
local function onEntityAdded(e) -- luacheck: ignore
|
||||
print("Added")
|
||||
local function onEntityAdded(pool, e) -- luacheck: ignore
|
||||
local test_comp = e:get(Components.test_comp_1)
|
||||
print(test_comp.x)
|
||||
end
|
||||
|
||||
local function onEntityRemoved(e) -- luacheck: ignore
|
||||
local function onEntityRemoved(pool, e) -- luacheck: ignore
|
||||
print("Removed")
|
||||
end
|
||||
|
||||
|
@ -64,7 +65,11 @@ end
|
|||
local world = World("testWorld")
|
||||
|
||||
local entity = Entity()
|
||||
entity:give(Components.test_comp_1, 100, 100)
|
||||
entity
|
||||
:give(Components.test_comp_1, 100, 100)
|
||||
:remove(Components.test_comp_1)
|
||||
:give(Components.test_comp_1, 200, 100)
|
||||
|
||||
|
||||
Worlds.testWorld:addEntity(entity)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue