mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2025-12-14 12:10:23 +07:00
construct call with fragment
This commit is contained in:
@@ -345,8 +345,8 @@ end
|
||||
|
||||
do
|
||||
local f1, f2, f3, f4, f5 = evo.id(5)
|
||||
evo.set(f1, evo.CONSTRUCT, function(_, a, b) return a - b end)
|
||||
evo.set(f2, evo.CONSTRUCT, function(_, c) return c end)
|
||||
evo.set(f1, evo.CONSTRUCT, function(_, _, a, b) return a - b end)
|
||||
evo.set(f2, evo.CONSTRUCT, function(_, _, c) return c end)
|
||||
evo.set(f3, evo.CONSTRUCT, function() return nil end)
|
||||
evo.set(f4, evo.CONSTRUCT, function() return false end)
|
||||
evo.set(f5, evo.CONSTRUCT, function(e) return e end)
|
||||
|
||||
@@ -166,7 +166,7 @@ evolved.EXCLUDE_LIST = __acquire_id()
|
||||
---@return evolved.component
|
||||
local function __construct(entity, fragment, component, ...)
|
||||
local default, construct = evolved.get(fragment, evolved.DEFAULT, evolved.CONSTRUCT)
|
||||
if construct ~= nil then component = construct(entity, component, ...) end
|
||||
if construct ~= nil then component = construct(entity, fragment, component, ...) end
|
||||
if component == nil then component = default end
|
||||
return component == nil and true or component
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user