mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2025-12-13 19:48:00 +07:00
mark all internal fragments
This commit is contained in:
11
README.md
11
README.md
@@ -1069,6 +1069,7 @@ NAME :: fragment
|
||||
|
||||
UNIQUE :: fragment
|
||||
EXPLICIT :: fragment
|
||||
INTERNAL :: fragment
|
||||
|
||||
DEFAULT :: fragment
|
||||
DUPLICATE :: fragment
|
||||
@@ -1204,6 +1205,7 @@ builder_mt:name :: string -> builder
|
||||
|
||||
builder_mt:unique :: builder
|
||||
builder_mt:explicit :: builder
|
||||
builder_mt:internal :: builder
|
||||
|
||||
builder_mt:default :: component -> builder
|
||||
builder_mt:duplicate :: {component -> component} -> builder
|
||||
@@ -1260,6 +1262,8 @@ builder_mt:destruction_policy :: id -> builder
|
||||
|
||||
### `evolved.EXPLICIT`
|
||||
|
||||
### `evolved.INTERNAL`
|
||||
|
||||
### `evolved.DEFAULT`
|
||||
|
||||
### `evolved.DUPLICATE`
|
||||
@@ -1855,6 +1859,13 @@ function evolved.builder_mt:unique() end
|
||||
function evolved.builder_mt:explicit() end
|
||||
```
|
||||
|
||||
#### `evolved.builder_mt:internal`
|
||||
|
||||
```lua
|
||||
---@return evolved.builder builder
|
||||
function evolved.builder_mt:internal() end
|
||||
```
|
||||
|
||||
#### `evolved.builder_mt:default`
|
||||
|
||||
```lua
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
- Add multi-spawn to the builder to spawn multiple entities at once.
|
||||
- Add a function to shrink storages to free unused memory.
|
||||
- Should we cache the result of without_unique_fragments to clone faster?
|
||||
- Mark all internal fragments with a some special tag
|
||||
- observers and events
|
||||
- add INDEX fragment trait
|
||||
- use compact prefix-tree for chunks
|
||||
|
||||
@@ -6,20 +6,20 @@ require 'develop.testing.pairs_tests'
|
||||
require 'develop.testing.requires_fragment_tests'
|
||||
require 'develop.testing.system_as_query_tests'
|
||||
|
||||
require 'develop.unbench'
|
||||
require 'develop.usbench'
|
||||
-- require 'develop.unbench'
|
||||
-- require 'develop.usbench'
|
||||
|
||||
local basics = require 'develop.basics'
|
||||
-- local basics = require 'develop.basics'
|
||||
|
||||
print '----------------------------------------'
|
||||
basics.describe_fuzz 'develop.fuzzing.destroy_fuzz'
|
||||
print '----------------------------------------'
|
||||
basics.describe_fuzz 'develop.fuzzing.batch_destroy_fuzz'
|
||||
print '----------------------------------------'
|
||||
basics.describe_fuzz 'develop.fuzzing.explicit_fuzz'
|
||||
print '----------------------------------------'
|
||||
basics.describe_fuzz 'develop.fuzzing.pack_unpack_fuzz'
|
||||
print '----------------------------------------'
|
||||
basics.describe_fuzz 'develop.fuzzing.requires_fuzz'
|
||||
print '----------------------------------------'
|
||||
basics.describe_fuzz 'develop.fuzzing.unique_fuzz'
|
||||
-- print '----------------------------------------'
|
||||
-- basics.describe_fuzz 'develop.fuzzing.destroy_fuzz'
|
||||
-- print '----------------------------------------'
|
||||
-- basics.describe_fuzz 'develop.fuzzing.batch_destroy_fuzz'
|
||||
-- print '----------------------------------------'
|
||||
-- basics.describe_fuzz 'develop.fuzzing.explicit_fuzz'
|
||||
-- print '----------------------------------------'
|
||||
-- basics.describe_fuzz 'develop.fuzzing.pack_unpack_fuzz'
|
||||
-- print '----------------------------------------'
|
||||
-- basics.describe_fuzz 'develop.fuzzing.requires_fuzz'
|
||||
-- print '----------------------------------------'
|
||||
-- basics.describe_fuzz 'develop.fuzzing.unique_fuzz'
|
||||
|
||||
69
evolved.lua
69
evolved.lua
@@ -207,6 +207,9 @@ local __group_subsystems = {} ---@type table<evolved.system, evolved.assoc_list>
|
||||
---@field package __has_explicit_major boolean
|
||||
---@field package __has_explicit_minors boolean
|
||||
---@field package __has_explicit_fragments boolean
|
||||
---@field package __has_internal_major boolean
|
||||
---@field package __has_internal_minors boolean
|
||||
---@field package __has_internal_fragments boolean
|
||||
---@field package __has_required_fragments boolean
|
||||
local __chunk_mt = {}
|
||||
__chunk_mt.__index = __chunk_mt
|
||||
@@ -778,6 +781,7 @@ local __NAME = __acquire_id()
|
||||
|
||||
local __UNIQUE = __acquire_id()
|
||||
local __EXPLICIT = __acquire_id()
|
||||
local __INTERNAL = __acquire_id()
|
||||
|
||||
local __DEFAULT = __acquire_id()
|
||||
local __DUPLICATE = __acquire_id()
|
||||
@@ -1337,6 +1341,9 @@ function __new_chunk(chunk_parent, chunk_fragment)
|
||||
__has_explicit_major = false,
|
||||
__has_explicit_minors = false,
|
||||
__has_explicit_fragments = false,
|
||||
__has_internal_major = false,
|
||||
__has_internal_minors = false,
|
||||
__has_internal_fragments = false,
|
||||
__has_required_fragments = false,
|
||||
}, __chunk_mt)
|
||||
|
||||
@@ -1500,6 +1507,10 @@ function __update_chunk_flags(chunk)
|
||||
local has_explicit_minors = chunk_parent ~= nil and chunk_parent.__has_explicit_fragments
|
||||
local has_explicit_fragments = has_explicit_major or has_explicit_minors
|
||||
|
||||
local has_internal_major = __evolved_has(chunk_fragment, __INTERNAL)
|
||||
local has_internal_minors = chunk_parent ~= nil and chunk_parent.__has_internal_fragments
|
||||
local has_internal_fragments = has_internal_major or has_internal_minors
|
||||
|
||||
local has_required_fragments = (chunk_parent ~= nil and chunk_parent.__has_required_fragments)
|
||||
or __evolved_has(chunk_fragment, __REQUIRES)
|
||||
|
||||
@@ -1520,6 +1531,10 @@ function __update_chunk_flags(chunk)
|
||||
chunk.__has_explicit_minors = has_explicit_minors
|
||||
chunk.__has_explicit_fragments = has_explicit_fragments
|
||||
|
||||
chunk.__has_internal_major = has_internal_major
|
||||
chunk.__has_internal_minors = has_internal_minors
|
||||
chunk.__has_internal_fragments = has_internal_fragments
|
||||
|
||||
chunk.__has_required_fragments = has_required_fragments
|
||||
end
|
||||
|
||||
@@ -6594,6 +6609,11 @@ function __builder_mt:explicit()
|
||||
return self:set(__EXPLICIT)
|
||||
end
|
||||
|
||||
---@return evolved.builder builder
|
||||
function __builder_mt:internal()
|
||||
return self:set(__INTERNAL)
|
||||
end
|
||||
|
||||
---@param default evolved.component
|
||||
---@return evolved.builder builder
|
||||
function __builder_mt:default(default)
|
||||
@@ -6782,6 +6802,9 @@ __evolved_set(__UNIQUE, __ON_REMOVE, __update_major_chunks_hook)
|
||||
__evolved_set(__EXPLICIT, __ON_INSERT, __update_major_chunks_hook)
|
||||
__evolved_set(__EXPLICIT, __ON_REMOVE, __update_major_chunks_hook)
|
||||
|
||||
__evolved_set(__INTERNAL, __ON_INSERT, __update_major_chunks_hook)
|
||||
__evolved_set(__INTERNAL, __ON_REMOVE, __update_major_chunks_hook)
|
||||
|
||||
__evolved_set(__DEFAULT, __ON_INSERT, __update_major_chunks_hook)
|
||||
__evolved_set(__DEFAULT, __ON_REMOVE, __update_major_chunks_hook)
|
||||
|
||||
@@ -6804,6 +6827,7 @@ __evolved_set(__NAME, __NAME, 'NAME')
|
||||
|
||||
__evolved_set(__UNIQUE, __NAME, 'UNIQUE')
|
||||
__evolved_set(__EXPLICIT, __NAME, 'EXPLICIT')
|
||||
__evolved_set(__INTERNAL, __NAME, 'INTERNAL')
|
||||
|
||||
__evolved_set(__DEFAULT, __NAME, 'DEFAULT')
|
||||
__evolved_set(__DUPLICATE, __NAME, 'DUPLICATE')
|
||||
@@ -6838,6 +6862,48 @@ __evolved_set(__DESTRUCTION_POLICY_REMOVE_FRAGMENT, __NAME, 'DESTRUCTION_POLICY_
|
||||
---
|
||||
---
|
||||
|
||||
__evolved_set(__ANY, __INTERNAL)
|
||||
|
||||
__evolved_set(__TAG, __INTERNAL)
|
||||
__evolved_set(__NAME, __INTERNAL)
|
||||
|
||||
__evolved_set(__UNIQUE, __INTERNAL)
|
||||
__evolved_set(__EXPLICIT, __INTERNAL)
|
||||
__evolved_set(__INTERNAL, __INTERNAL)
|
||||
|
||||
__evolved_set(__DEFAULT, __INTERNAL)
|
||||
__evolved_set(__DUPLICATE, __INTERNAL)
|
||||
|
||||
__evolved_set(__PREFAB, __INTERNAL)
|
||||
__evolved_set(__DISABLED, __INTERNAL)
|
||||
|
||||
__evolved_set(__INCLUDES, __INTERNAL)
|
||||
__evolved_set(__EXCLUDES, __INTERNAL)
|
||||
__evolved_set(__REQUIRES, __INTERNAL)
|
||||
|
||||
__evolved_set(__ON_SET, __INTERNAL)
|
||||
__evolved_set(__ON_ASSIGN, __INTERNAL)
|
||||
__evolved_set(__ON_INSERT, __INTERNAL)
|
||||
__evolved_set(__ON_REMOVE, __INTERNAL)
|
||||
|
||||
__evolved_set(__GROUP, __INTERNAL)
|
||||
|
||||
__evolved_set(__QUERY, __INTERNAL)
|
||||
__evolved_set(__EXECUTE, __INTERNAL)
|
||||
|
||||
__evolved_set(__PROLOGUE, __INTERNAL)
|
||||
__evolved_set(__EPILOGUE, __INTERNAL)
|
||||
|
||||
__evolved_set(__DESTRUCTION_POLICY, __INTERNAL)
|
||||
__evolved_set(__DESTRUCTION_POLICY_DESTROY_ENTITY, __INTERNAL)
|
||||
__evolved_set(__DESTRUCTION_POLICY_REMOVE_FRAGMENT, __INTERNAL)
|
||||
|
||||
---
|
||||
---
|
||||
---
|
||||
---
|
||||
---
|
||||
|
||||
__evolved_set(__ANY, __TAG)
|
||||
|
||||
__evolved_set(__TAG, __TAG)
|
||||
@@ -6846,6 +6912,8 @@ __evolved_set(__UNIQUE, __TAG)
|
||||
|
||||
__evolved_set(__EXPLICIT, __TAG)
|
||||
|
||||
__evolved_set(__INTERNAL, __TAG)
|
||||
|
||||
__evolved_set(__PREFAB, __TAG)
|
||||
__evolved_set(__PREFAB, __UNIQUE)
|
||||
__evolved_set(__PREFAB, __EXPLICIT)
|
||||
@@ -7007,6 +7075,7 @@ evolved.NAME = __NAME
|
||||
|
||||
evolved.UNIQUE = __UNIQUE
|
||||
evolved.EXPLICIT = __EXPLICIT
|
||||
evolved.INTERNAL = __INTERNAL
|
||||
|
||||
evolved.DEFAULT = __DEFAULT
|
||||
evolved.DUPLICATE = __DUPLICATE
|
||||
|
||||
Reference in New Issue
Block a user