mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2025-12-14 20:11:27 +07:00
set/remove/clear/destroy for pairs
This commit is contained in:
18
evolved.lua
18
evolved.lua
@@ -4389,6 +4389,11 @@ function __evolved_set(entity, fragment, component)
|
|||||||
__debug_fns.validate_fragment(fragment)
|
__debug_fns.validate_fragment(fragment)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if entity < 0 then
|
||||||
|
__error_fmt('the pair (%s) cannot have any fragments',
|
||||||
|
__id_name(entity))
|
||||||
|
end
|
||||||
|
|
||||||
if __defer_depth > 0 then
|
if __defer_depth > 0 then
|
||||||
__defer_set(entity, fragment, component)
|
__defer_set(entity, fragment, component)
|
||||||
return
|
return
|
||||||
@@ -4625,6 +4630,11 @@ function __evolved_remove(entity, ...)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if entity < 0 then
|
||||||
|
-- pairs cannot have fragments, nothing to remove
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local entity_index = entity % 0x100000
|
local entity_index = entity % 0x100000
|
||||||
|
|
||||||
if __freelist_ids[entity_index] ~= entity then
|
if __freelist_ids[entity_index] ~= entity then
|
||||||
@@ -4743,7 +4753,9 @@ function __evolved_clear(...)
|
|||||||
local entity = __lua_select(argument_index, ...)
|
local entity = __lua_select(argument_index, ...)
|
||||||
local entity_index = entity % 0x100000
|
local entity_index = entity % 0x100000
|
||||||
|
|
||||||
if __freelist_ids[entity_index] ~= entity then
|
if entity < 0 then
|
||||||
|
-- pairs cannot have fragments, nothing to clear
|
||||||
|
elseif __freelist_ids[entity_index] ~= entity then
|
||||||
-- this entity is not alive, nothing to clear
|
-- this entity is not alive, nothing to clear
|
||||||
else
|
else
|
||||||
local chunk = entity_chunks[entity_index]
|
local chunk = entity_chunks[entity_index]
|
||||||
@@ -4817,7 +4829,9 @@ function __evolved_destroy(...)
|
|||||||
local entity = __lua_select(argument_index, ...)
|
local entity = __lua_select(argument_index, ...)
|
||||||
local entity_index = entity % 0x100000
|
local entity_index = entity % 0x100000
|
||||||
|
|
||||||
if __freelist_ids[entity_index] ~= entity then
|
if entity < 0 then
|
||||||
|
-- pairs cannot be destroyed, nothing to do
|
||||||
|
elseif __freelist_ids[entity_index] ~= entity then
|
||||||
-- this entity is not alive, nothing to destroy
|
-- this entity is not alive, nothing to destroy
|
||||||
else
|
else
|
||||||
if not __minor_chunks[entity] then
|
if not __minor_chunks[entity] then
|
||||||
|
|||||||
Reference in New Issue
Block a user