mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-02 04:13:58 -04:00
Entity's Keys
You can now give the 'key' component to Entities. A key will be generated automatically and stored in Entity.key.value. You can then use this key to fetch the Entity from the World with World:getEntityByKey(key) The keys are generated with a generator function that can be overriden.
This commit is contained in:
parent
3d195c790f
commit
a55efd042a
6 changed files with 148 additions and 15 deletions
|
@ -74,6 +74,7 @@ function Component:deserialize(data)
|
|||
end
|
||||
|
||||
-- Internal: Creates a new Component.
|
||||
-- @param entity The Entity that will receive this Component.
|
||||
-- @return A new Component
|
||||
function Component:__new(entity)
|
||||
local component = setmetatable({
|
||||
|
@ -88,6 +89,7 @@ function Component:__new(entity)
|
|||
end
|
||||
|
||||
-- Internal: Creates and populates a new Component.
|
||||
-- @param entity The Entity that will receive this Component.
|
||||
-- @param ... Varargs passed to the populate function
|
||||
-- @return A new populated Component
|
||||
function Component:__initialize(entity, ...)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue