mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2026-03-22 12:55:31 +07:00
Compare commits
5 Commits
e364aaab37
...
v1.9.0
| Author | SHA1 | Date | |
|---|---|---|---|
| f6b8844a82 | |||
| e48bdf0511 | |||
| a945401e9b | |||
| a1423ea9ee | |||
| 12a720bd9e |
219
README.md
219
README.md
@@ -53,10 +53,8 @@
|
||||
- [Internal Fragments](#internal-fragments)
|
||||
- [Shared Components](#shared-components)
|
||||
- [Fragment Requirements](#fragment-requirements)
|
||||
- [Id Names](#id-names)
|
||||
- [Destruction Policies](#destruction-policies)
|
||||
- [Custom Component Storages](#custom-component-storages)
|
||||
- [Garbage Collection](#garbage-collection)
|
||||
- [Cheat Sheet](#cheat-sheet)
|
||||
- [Aliases](#aliases)
|
||||
- [Predefs](#predefs)
|
||||
@@ -65,7 +63,6 @@
|
||||
- [Chunk](#chunk)
|
||||
- [Builder](#builder)
|
||||
- [Changelog](#changelog)
|
||||
- [vX.Y.Z](#vxyz)
|
||||
- [v1.9.0](#v190)
|
||||
- [v1.8.0](#v180)
|
||||
- [v1.7.0](#v170)
|
||||
@@ -1163,41 +1160,6 @@ local enemy = evolved.builder()
|
||||
assert(evolved.has_all(enemy, position, velocity))
|
||||
```
|
||||
|
||||
#### Id Names
|
||||
|
||||
The library provides a way to assign names to any id using the [`evolved.NAME`](#evolvedname) fragment. This is useful for debugging and development purposes, as it allows you to identify entities or fragments by their names instead of their identifiers. The name of an entity can be retrieved using the [`evolved.name`](#evolvedname-1) function.
|
||||
|
||||
```lua
|
||||
local evolved = require 'evolved'
|
||||
|
||||
local player = evolved.builder()
|
||||
:name('Player')
|
||||
:build()
|
||||
|
||||
assert(evolved.name(player) == 'Player')
|
||||
```
|
||||
|
||||
Names are not unique, so multiple entities can have the same name. Also, the name of an entity can be changed at any time by setting a new name using the [`evolved.NAME`](#evolvedname) fragment as a usual component.
|
||||
|
||||
You can find entities by their names using the [`evolved.lookup`](#evolvedlookup) and [`evolved.multi_lookup`](#evolvedmulti_lookup) functions. The [`evolved.lookup`](#evolvedlookup) function returns the first entity with the specified name, while the [`evolved.multi_lookup`](#evolvedmulti_lookup) function returns a list of all entities with the specified name.
|
||||
|
||||
```lua
|
||||
local evolved = require 'evolved'
|
||||
|
||||
local player1 = evolved.builder()
|
||||
:name('Player')
|
||||
:build()
|
||||
|
||||
local player2 = evolved.builder()
|
||||
:name('Player')
|
||||
:build()
|
||||
|
||||
assert(evolved.lookup('Player') == player1)
|
||||
|
||||
local player_list, player_count = evolved.multi_lookup('Player')
|
||||
assert(player_count == 2 and player_list[1] == player1 and player_list[2] == player2)
|
||||
```
|
||||
|
||||
#### Destruction Policies
|
||||
|
||||
Typically, fragments remain alive for the entire lifetime of the program. However, in some cases, you might want to destroy fragments when they are no longer needed. For example, you can use some runtime entities as fragments for other entities. In this case, you might want to destroy such fragments even while they are still attached to other entities. Since entities cannot have destroyed fragments, a destruction policy must be applied to resolve this. By default, the library will remove the destroyed fragment from all entities that have it.
|
||||
@@ -1384,24 +1346,6 @@ evolved.builder()
|
||||
evolved.process_with(MOVEMENT_SYSTEM, 0.016)
|
||||
```
|
||||
|
||||
### Garbage Collection
|
||||
|
||||
While using the library, some internal data structures can become obsolete and should be cleaned up to free memory. For example, empty chunks that no longer contain entities can be removed. Component storages can also have unused capacity that can be shrunk to save memory. The library provides a function to control this garbage collection process.
|
||||
|
||||
```lua
|
||||
---@param no_shrink? boolean
|
||||
function evolved.collect_garbage(no_shrink) end
|
||||
```
|
||||
|
||||
By default, [`evolved.collect_garbage`](#evolvedcollect_garbage) cleans up obsolete data structures and shrinks component storages to fit their current size. If you pass `true`, it only cleans up obsolete data structures and skips shrinking. This avoids the overhead of resizing storages, which can be expensive.
|
||||
|
||||
Call this function periodically to keep memory usage under control. It is best to call it between levels or during loading screens when performance is not critical. Also, call Lua's built-in garbage collector afterward to ensure all unused memory is freed.
|
||||
|
||||
```lua
|
||||
evolved.collect_garbage()
|
||||
collectgarbage('collect')
|
||||
```
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
### Aliases
|
||||
@@ -1500,13 +1444,9 @@ cancel :: boolean
|
||||
|
||||
spawn :: component_table?, component_mapper? -> entity
|
||||
multi_spawn :: integer, component_table?, component_mapper? -> entity[], integer
|
||||
multi_spawn_nr :: integer, component_table?, component_mapper? -> ()
|
||||
multi_spawn_to :: entity[], integer, integer, component_table?, component_mapper? -> ()
|
||||
|
||||
clone :: entity, component_table?, component_mapper? -> entity
|
||||
multi_clone :: integer, entity, component_table?, component_mapper? -> entity[], integer
|
||||
multi_clone_nr :: integer, entity, component_table?, component_mapper? -> ()
|
||||
multi_clone_to :: entity[], integer, integer, entity, component_table?, component_mapper? -> ()
|
||||
|
||||
alive :: entity -> boolean
|
||||
alive_all :: entity... -> boolean
|
||||
@@ -1537,15 +1477,11 @@ execute :: query -> {execute_state? -> chunk?, entity[]?, integer?}, execute_sta
|
||||
|
||||
locate :: entity -> chunk?, integer
|
||||
|
||||
lookup :: string -> entity?
|
||||
multi_lookup :: string -> entity[], integer
|
||||
multi_lookup_to :: entity[], integer, string -> integer
|
||||
|
||||
process :: system... -> ()
|
||||
process_with :: system, ... -> ()
|
||||
|
||||
debug_mode :: boolean -> ()
|
||||
collect_garbage :: boolean? -> ()
|
||||
collect_garbage :: ()
|
||||
```
|
||||
|
||||
### Classes
|
||||
@@ -1574,18 +1510,12 @@ builder :: builder
|
||||
|
||||
builder_mt:build :: entity?, component_mapper? -> entity
|
||||
builder_mt:multi_build :: integer, entity?, component_mapper? -> entity[], integer
|
||||
builder_mt:multi_build_nr :: integer, entity?, component_mapper? -> ()
|
||||
builder_mt:multi_build_to :: entity[], integer, integer, entity?, component_mapper? -> ()
|
||||
|
||||
builder_mt:spawn :: component_mapper? -> entity
|
||||
builder_mt:multi_spawn :: integer, component_mapper? -> entity[], integer
|
||||
builder_mt:multi_spawn_nr :: integer, component_mapper? -> ()
|
||||
builder_mt:multi_spawn_to :: entity[], integer, integer, component_mapper? -> ()
|
||||
|
||||
builder_mt:clone :: entity, component_mapper? -> entity
|
||||
builder_mt:multi_clone :: integer, entity, component_mapper? -> entity[], integer
|
||||
builder_mt:multi_clone_nr :: integer, entity, component_mapper? -> ()
|
||||
builder_mt:multi_clone_to :: entity[], integer, integer, entity, component_mapper? -> ()
|
||||
|
||||
builder_mt:has :: fragment -> boolean
|
||||
builder_mt:has_all :: fragment... -> boolean
|
||||
@@ -1636,11 +1566,6 @@ builder_mt:destruction_policy :: id -> builder
|
||||
|
||||
## Changelog
|
||||
|
||||
### vX.Y.Z
|
||||
|
||||
- Added the new [`evolved.lookup`](#evolvedlookup) and [`evolved.multi_lookup`](#evolvedmulti_lookup) functions that allow finding ids by their names
|
||||
- Added a non-shrinking version of the [`evolved.collect_garbage`](#evolvedcollect_garbage) function that only collects garbage without shrinking storages
|
||||
|
||||
### v1.9.0
|
||||
|
||||
- Performance improvements of the [`evolved.destroy`](#evolveddestroy) and [`evolved.batch_destroy`](#evolvedbatch_destroy) functions
|
||||
@@ -1846,31 +1771,9 @@ function evolved.spawn(component_table, component_mapper) end
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
---@return evolved.entity[] entity_list
|
||||
---@return integer entity_count
|
||||
---@nodiscard
|
||||
function evolved.multi_spawn(entity_count, component_table, component_mapper) end
|
||||
```
|
||||
|
||||
### `evolved.multi_spawn_nr`
|
||||
|
||||
```lua
|
||||
---@param entity_count integer
|
||||
---@param component_table? evolved.component_table
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
function evolved.multi_spawn_nr(entity_count, component_table, component_mapper) end
|
||||
```
|
||||
|
||||
### `evolved.multi_spawn_to`
|
||||
|
||||
```lua
|
||||
---@param out_entity_list evolved.entity[]
|
||||
---@param out_entity_first integer
|
||||
---@param entity_count integer
|
||||
---@param component_table? evolved.component_table
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
function evolved.multi_spawn_to(out_entity_list, out_entity_first,
|
||||
entity_count, component_table, component_mapper) end
|
||||
```
|
||||
|
||||
### `evolved.clone`
|
||||
|
||||
```lua
|
||||
@@ -1890,33 +1793,9 @@ function evolved.clone(prefab, component_table, component_mapper) end
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
---@return evolved.entity[] entity_list
|
||||
---@return integer entity_count
|
||||
---@nodiscard
|
||||
function evolved.multi_clone(entity_count, prefab, component_table, component_mapper) end
|
||||
```
|
||||
|
||||
### `evolved.multi_clone_nr`
|
||||
|
||||
```lua
|
||||
---@param entity_count integer
|
||||
---@param prefab evolved.entity
|
||||
---@param component_table? evolved.component_table
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
function evolved.multi_clone_nr(entity_count, prefab, component_table, component_mapper) end
|
||||
```
|
||||
|
||||
### `evolved.multi_clone_to`
|
||||
|
||||
```lua
|
||||
---@param out_entity_list evolved.entity[]
|
||||
---@param out_entity_first integer
|
||||
---@param entity_count integer
|
||||
---@param prefab evolved.entity
|
||||
---@param component_table? evolved.component_table
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
function evolved.multi_clone_to(out_entity_list, out_entity_first,
|
||||
entity_count, prefab, component_table, component_mapper) end
|
||||
```
|
||||
|
||||
### `evolved.alive`
|
||||
|
||||
```lua
|
||||
@@ -2103,35 +1982,6 @@ function evolved.execute(query) end
|
||||
function evolved.locate(entity) end
|
||||
```
|
||||
|
||||
### `evolved.lookup`
|
||||
|
||||
```lua
|
||||
---@param name string
|
||||
---@return evolved.entity? entity
|
||||
---@nodiscard
|
||||
function evolved.lookup(name) end
|
||||
```
|
||||
|
||||
### `evolved.multi_lookup`
|
||||
|
||||
```lua
|
||||
---@param name string
|
||||
---@return evolved.entity[] entity_list
|
||||
---@return integer entity_count
|
||||
---@nodiscard
|
||||
function evolved.multi_lookup(name) end
|
||||
```
|
||||
|
||||
### `evolved.multi_lookup_to`
|
||||
|
||||
```lua
|
||||
---@param out_entity_list evolved.entity[]
|
||||
---@param out_entity_first integer
|
||||
---@param name string
|
||||
---@return integer entity_count
|
||||
function evolved.multi_lookup_to(out_entity_list, out_entity_first, name) end
|
||||
```
|
||||
|
||||
### `evolved.process`
|
||||
|
||||
```lua
|
||||
@@ -2157,8 +2007,7 @@ function evolved.debug_mode(yesno) end
|
||||
### `evolved.collect_garbage`
|
||||
|
||||
```lua
|
||||
---@param no_shrink? boolean
|
||||
function evolved.collect_garbage(no_shrink) end
|
||||
function evolved.collect_garbage() end
|
||||
```
|
||||
|
||||
## Classes
|
||||
@@ -2274,31 +2123,9 @@ function evolved.builder_mt:build(prefab, component_mapper) end
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
---@return evolved.entity[] entity_list
|
||||
---@return integer entity_count
|
||||
---@nodiscard
|
||||
function evolved.builder_mt:multi_build(entity_count, prefab, component_mapper) end
|
||||
```
|
||||
|
||||
### `evolved.builder_mt:multi_build_nr`
|
||||
|
||||
```lua
|
||||
---@param entity_count integer
|
||||
---@param prefab? evolved.entity
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
function evolved.builder_mt:multi_build_nr(entity_count, prefab, component_mapper) end
|
||||
```
|
||||
|
||||
### `evolved.builder_mt:multi_build_to`
|
||||
|
||||
```lua
|
||||
---@param out_entity_list evolved.entity[]
|
||||
---@param out_entity_first integer
|
||||
---@param entity_count integer
|
||||
---@param prefab? evolved.entity
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
function evolved.builder_mt:multi_build_to(out_entity_list, out_entity_first,
|
||||
entity_count, prefab, component_mapper) end
|
||||
```
|
||||
|
||||
#### `evolved.builder_mt:spawn`
|
||||
|
||||
```lua
|
||||
@@ -2314,29 +2141,9 @@ function evolved.builder_mt:spawn(component_mapper) end
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
---@return evolved.entity[] entity_list
|
||||
---@return integer entity_count
|
||||
---@nodiscard
|
||||
function evolved.builder_mt:multi_spawn(entity_count, component_mapper) end
|
||||
```
|
||||
|
||||
#### `evolved.builder_mt:multi_spawn_nr`
|
||||
|
||||
```lua
|
||||
---@param entity_count integer
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
function evolved.builder_mt:multi_spawn_nr(entity_count, component_mapper) end
|
||||
```
|
||||
|
||||
#### `evolved.builder_mt:multi_spawn_to`
|
||||
|
||||
```lua
|
||||
---@param out_entity_list evolved.entity[]
|
||||
---@param out_entity_first integer
|
||||
---@param entity_count integer
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
function evolved.builder_mt:multi_spawn_to(out_entity_list, out_entity_first,
|
||||
entity_count, component_mapper) end
|
||||
```
|
||||
|
||||
#### `evolved.builder_mt:clone`
|
||||
|
||||
```lua
|
||||
@@ -2354,31 +2161,9 @@ function evolved.builder_mt:clone(prefab, component_mapper) end
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
---@return evolved.entity[] entity_list
|
||||
---@return integer entity_count
|
||||
---@nodiscard
|
||||
function evolved.builder_mt:multi_clone(entity_count, prefab, component_mapper) end
|
||||
```
|
||||
|
||||
#### `evolved.builder_mt:multi_clone_nr`
|
||||
|
||||
```lua
|
||||
---@param entity_count integer
|
||||
---@param prefab evolved.entity
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
function evolved.builder_mt:multi_clone_nr(entity_count, prefab, component_mapper) end
|
||||
```
|
||||
|
||||
#### `evolved.builder_mt:multi_clone_to`
|
||||
|
||||
```lua
|
||||
---@param out_entity_list evolved.entity[]
|
||||
---@param out_entity_first integer
|
||||
---@param entity_count integer
|
||||
---@param prefab evolved.entity
|
||||
---@param component_mapper? evolved.component_mapper
|
||||
function evolved.builder_mt:multi_clone_to(out_entity_list, out_entity_first,
|
||||
entity_count, prefab, component_mapper) end
|
||||
```
|
||||
|
||||
#### `evolved.builder_mt:has`
|
||||
|
||||
```lua
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
## Thoughts
|
||||
|
||||
- We should have a way to not copy components on deferred spawn/clone
|
||||
- Having a light version of the gargabe collector can be useful for some use-cases
|
||||
- Basic default component value as true looks awful, should we use something else?
|
||||
|
||||
## Known Issues
|
||||
|
||||
@@ -4,7 +4,6 @@ require 'develop.testing.clone_tests'
|
||||
require 'develop.testing.depth_tests'
|
||||
require 'develop.testing.destroy_tests'
|
||||
require 'develop.testing.locate_tests'
|
||||
require 'develop.testing.lookup_tests'
|
||||
require 'develop.testing.main_tests'
|
||||
require 'develop.testing.mappers_tests'
|
||||
require 'develop.testing.multi_spawn_tests'
|
||||
|
||||
@@ -307,11 +307,11 @@ print '----------------------------------------'
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Clone | %d entities with 1 component', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [F1] = true }
|
||||
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
end)
|
||||
@@ -319,12 +319,12 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 1 component', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [F1] = true }
|
||||
|
||||
evo.defer()
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
evo.commit()
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
@@ -333,11 +333,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Clone With Defaults | %d entities with 1 component', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [D1] = true }
|
||||
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
|
||||
evo.batch_destroy(QD1)
|
||||
end)
|
||||
@@ -345,11 +345,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Clone | %d entities with 3 components', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [F1] = true, [F2] = true, [F3] = true }
|
||||
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
end)
|
||||
@@ -357,12 +357,12 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 3 components', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [F1] = true, [F2] = true, [F3] = true }
|
||||
|
||||
evo.defer()
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
evo.commit()
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
@@ -371,11 +371,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Clone With Defaults | %d entities with 3 components', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [D1] = true, [D2] = true, [D3] = true }
|
||||
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
|
||||
evo.batch_destroy(QD1)
|
||||
end)
|
||||
@@ -383,11 +383,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Clone | %d entities with 5 components', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [F1] = true, [F2] = true, [F3] = true, [F4] = true, [F5] = true }
|
||||
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
end)
|
||||
@@ -395,12 +395,12 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 5 components', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [F1] = true, [F2] = true, [F3] = true, [F4] = true, [F5] = true }
|
||||
|
||||
evo.defer()
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
evo.commit()
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
@@ -409,11 +409,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Clone With Defaults | %d entities with 5 components', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [D1] = true, [D2] = true, [D3] = true, [D4] = true, [D5] = true }
|
||||
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
|
||||
evo.batch_destroy(QD1)
|
||||
end)
|
||||
@@ -423,11 +423,11 @@ print '----------------------------------------'
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Clone | %d entities with 1 required component', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [RF1] = true }
|
||||
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
end)
|
||||
@@ -435,12 +435,12 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 1 required component', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [RF1] = true }
|
||||
|
||||
evo.defer()
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
evo.commit()
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
@@ -449,11 +449,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Clone With Defaults | %d entities with 1 required component', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [RD1] = true }
|
||||
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
|
||||
evo.batch_destroy(QD1)
|
||||
end)
|
||||
@@ -461,11 +461,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Clone | %d entities with 3 required components', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [RF123] = true }
|
||||
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
end)
|
||||
@@ -473,12 +473,12 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 3 required components', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [RF123] = true }
|
||||
|
||||
evo.defer()
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
evo.commit()
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
@@ -487,11 +487,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Clone With Defaults | %d entities with 3 required components', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [RD123] = true }
|
||||
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
|
||||
evo.batch_destroy(QD1)
|
||||
end)
|
||||
@@ -499,11 +499,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Clone | %d entities with 5 required components', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [RF12345] = true }
|
||||
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
end)
|
||||
@@ -511,12 +511,12 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 5 required components', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [RF12345] = true }
|
||||
|
||||
evo.defer()
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
evo.commit()
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
@@ -525,11 +525,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Clone Benchmarks: Multi Clone With Defaults | %d entities with 5 required components', N),
|
||||
function()
|
||||
local multi_clone_nr = evo.multi_clone_nr
|
||||
local multi_clone = evo.multi_clone
|
||||
|
||||
local prefab = evo.spawn { [RD12345] = true }
|
||||
|
||||
multi_clone_nr(N, prefab)
|
||||
multi_clone(N, prefab)
|
||||
|
||||
evo.batch_destroy(QD1)
|
||||
end)
|
||||
|
||||
@@ -54,7 +54,7 @@ basics.describe_bench(string.format('Common Benchmarks: Evolved Entity Cycle | %
|
||||
local prefab_a = evo.builder():prefab():set(world):set(a, 0):spawn()
|
||||
local prefab_b = evo.builder():prefab():set(world):set(b, 0):spawn()
|
||||
|
||||
evo.multi_clone_nr(N, prefab_a)
|
||||
evo.multi_clone(N, prefab_a)
|
||||
|
||||
evo.builder()
|
||||
:set(world):group(world):query(query_a)
|
||||
@@ -129,10 +129,10 @@ basics.describe_bench(string.format('Common Benchmarks: Evolved Simple Iteration
|
||||
local query_cd = evo.builder():set(world):include(c, d):spawn()
|
||||
local query_ce = evo.builder():set(world):include(c, e):spawn()
|
||||
|
||||
evo.multi_spawn_nr(N, { [world] = true, [a] = 0, [b] = 0 })
|
||||
evo.multi_spawn_nr(N, { [world] = true, [a] = 0, [b] = 0, [c] = 0 })
|
||||
evo.multi_spawn_nr(N, { [world] = true, [a] = 0, [b] = 0, [c] = 0, [d] = 0 })
|
||||
evo.multi_spawn_nr(N, { [world] = true, [a] = 0, [b] = 0, [c] = 0, [e] = 0 })
|
||||
evo.multi_spawn(N, { [world] = true, [a] = 0, [b] = 0 })
|
||||
evo.multi_spawn(N, { [world] = true, [a] = 0, [b] = 0, [c] = 0 })
|
||||
evo.multi_spawn(N, { [world] = true, [a] = 0, [b] = 0, [c] = 0, [d] = 0 })
|
||||
evo.multi_spawn(N, { [world] = true, [a] = 0, [b] = 0, [c] = 0, [e] = 0 })
|
||||
|
||||
evo.builder()
|
||||
:set(world):group(world):query(query_ab)
|
||||
@@ -223,7 +223,7 @@ basics.describe_bench(string.format('Common Benchmarks: Evolved Packed Iteration
|
||||
local query_d = evo.builder():set(world):include(d):spawn()
|
||||
local query_e = evo.builder():set(world):include(e):spawn()
|
||||
|
||||
evo.multi_spawn_nr(N, { [world] = true, [a] = 0, [b] = 0, [c] = 0, [d] = 0, [e] = 0 })
|
||||
evo.multi_spawn(N, { [world] = true, [a] = 0, [b] = 0, [c] = 0, [d] = 0, [e] = 0 })
|
||||
|
||||
evo.builder()
|
||||
:set(world):group(world):query(query_a)
|
||||
@@ -317,7 +317,7 @@ basics.describe_bench(string.format('Common Benchmarks: Evolved Fragmented Itera
|
||||
local query_z = evo.builder():set(world):include(chars[#chars]):spawn()
|
||||
|
||||
for i = 1, #chars do
|
||||
evo.multi_spawn_nr(N, { [world] = true, [chars[i]] = i, [data] = i })
|
||||
evo.multi_spawn(N, { [world] = true, [chars[i]] = i, [data] = i })
|
||||
end
|
||||
|
||||
evo.builder()
|
||||
|
||||
@@ -20,7 +20,7 @@ basics.describe_bench(string.format('Process Benchmarks: Evolved AoS Processing
|
||||
local pf = evo.builder():set(wf):spawn()
|
||||
local vf = evo.builder():set(wf):spawn()
|
||||
|
||||
evo.multi_spawn_nr(N, {
|
||||
evo.multi_spawn(N, {
|
||||
[wf] = true,
|
||||
[pf] = { x = 0, y = 0, z = 0, w = 0 },
|
||||
[vf] = { x = 0, y = 0, z = 0, w = 0 },
|
||||
@@ -67,7 +67,7 @@ basics.describe_bench(string.format('Process Benchmarks: Evolved SoA Processing
|
||||
local vzf = evo.builder():set(wf):spawn()
|
||||
local vwf = evo.builder():set(wf):spawn()
|
||||
|
||||
evo.multi_spawn_nr(N, {
|
||||
evo.multi_spawn(N, {
|
||||
[wf] = true,
|
||||
[pxf] = 0,
|
||||
[pyf] = 0,
|
||||
|
||||
@@ -536,11 +536,11 @@ print '----------------------------------------'
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Spawn | %d entities with 1 component', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [F1] = true }
|
||||
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
end)
|
||||
@@ -548,12 +548,12 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 1 component', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [F1] = true }
|
||||
|
||||
evo.defer()
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
evo.commit()
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
@@ -562,11 +562,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Spawn With Defaults | %d entities with 1 component', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [D1] = true }
|
||||
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
|
||||
evo.batch_destroy(QD1)
|
||||
end)
|
||||
@@ -574,11 +574,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Spawn | %d entities with 3 components', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [F1] = true, [F2] = true, [F3] = true }
|
||||
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
end)
|
||||
@@ -586,12 +586,12 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 3 components', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [F1] = true, [F2] = true, [F3] = true }
|
||||
|
||||
evo.defer()
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
evo.commit()
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
@@ -600,11 +600,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Spawn With Defaults | %d entities with 3 components', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [D1] = true, [D2] = true, [D3] = true }
|
||||
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
|
||||
evo.batch_destroy(QD1)
|
||||
end)
|
||||
@@ -612,11 +612,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Spawn | %d entities with 5 components', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [F1] = true, [F2] = true, [F3] = true, [F4] = true, [F5] = true }
|
||||
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
end)
|
||||
@@ -624,12 +624,12 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 5 components', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [F1] = true, [F2] = true, [F3] = true, [F4] = true, [F5] = true }
|
||||
|
||||
evo.defer()
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
evo.commit()
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
@@ -638,11 +638,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Spawn With Defaults | %d entities with 5 components', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [D1] = true, [D2] = true, [D3] = true, [D4] = true, [D5] = true }
|
||||
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
|
||||
evo.batch_destroy(QD1)
|
||||
end)
|
||||
@@ -652,11 +652,11 @@ print '----------------------------------------'
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Spawn | %d entities with 1 required component', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [F1] = true }
|
||||
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
end)
|
||||
@@ -664,12 +664,12 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 1 required component', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [F1] = true }
|
||||
|
||||
evo.defer()
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
evo.commit()
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
@@ -678,11 +678,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Spawn With Defaults | %d entities with 1 required component', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [D1] = true }
|
||||
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
|
||||
evo.batch_destroy(QD1)
|
||||
end)
|
||||
@@ -690,11 +690,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Spawn | %d entities with 3 required components', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [RF123] = true }
|
||||
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
end)
|
||||
@@ -702,12 +702,12 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 3 required components', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [RF123] = true }
|
||||
|
||||
evo.defer()
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
evo.commit()
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
@@ -716,11 +716,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Spawn With Defaults | %d entities with 3 required components', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [RD123] = true }
|
||||
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
|
||||
evo.batch_destroy(QD1)
|
||||
end)
|
||||
@@ -728,11 +728,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Spawn | %d entities with 5 required components', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [RF12345] = true }
|
||||
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
end)
|
||||
@@ -740,12 +740,12 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 5 required components', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [RF12345] = true }
|
||||
|
||||
evo.defer()
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
evo.commit()
|
||||
|
||||
evo.batch_destroy(QF1)
|
||||
@@ -754,11 +754,11 @@ basics.describe_bench(
|
||||
basics.describe_bench(
|
||||
string.format('Spawn Benchmarks: Multi Spawn With Defaults | %d entities with 5 required components', N),
|
||||
function()
|
||||
local multi_spawn_nr = evo.multi_spawn_nr
|
||||
local multi_spawn = evo.multi_spawn
|
||||
|
||||
local components = { [RD12345] = true }
|
||||
|
||||
multi_spawn_nr(N, components)
|
||||
multi_spawn(N, components)
|
||||
|
||||
evo.batch_destroy(QD1)
|
||||
end)
|
||||
|
||||
@@ -118,11 +118,11 @@ end
|
||||
---
|
||||
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
|
||||
evo.destroy(__table_unpack(all_entity_list))
|
||||
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
|
||||
@@ -124,11 +124,11 @@ end
|
||||
---
|
||||
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
|
||||
evo.destroy(__table_unpack(all_entity_list))
|
||||
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
|
||||
@@ -296,7 +296,7 @@ end
|
||||
---
|
||||
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
|
||||
evo.destroy(__table_unpack(all_query_list))
|
||||
@@ -304,5 +304,5 @@ evo.destroy(__table_unpack(all_entity_list))
|
||||
evo.destroy(__table_unpack(all_fragment_list))
|
||||
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
|
||||
@@ -78,11 +78,11 @@ end
|
||||
---
|
||||
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
|
||||
evo.destroy(__table_unpack(all_entity_list))
|
||||
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
|
||||
@@ -115,17 +115,17 @@ end
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.destroy(__table_unpack(all_entity_list))
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
evo.destroy(__table_unpack(all_fragment_list))
|
||||
else
|
||||
evo.destroy(__table_unpack(all_fragment_list))
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
evo.destroy(__table_unpack(all_entity_list))
|
||||
end
|
||||
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
|
||||
@@ -64,11 +64,11 @@ end
|
||||
---
|
||||
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
|
||||
evo.destroy(__table_unpack(all_entity_list))
|
||||
|
||||
if math.random(1, 2) == 1 then
|
||||
evo.collect_garbage(math.random(1, 2) == 1)
|
||||
evo.collect_garbage()
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
local f1, f2 = evo.id(2)
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
assert(evo.defer())
|
||||
assert(evo.cancel())
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
do
|
||||
local p = evo.spawn()
|
||||
@@ -397,165 +395,3 @@ do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local f1, f2 = evo.id(2)
|
||||
local p = evo.spawn { [f1] = 42, [f2] = 'hello' }
|
||||
|
||||
do
|
||||
local entity_list, entity_count = {}, 2
|
||||
evo.multi_clone_to(entity_list, 1, entity_count, p)
|
||||
assert(evo.has_all(entity_list[1], f1, f2))
|
||||
assert(evo.has_all(entity_list[2], f1, f2))
|
||||
assert(evo.get(entity_list[1], f1) == 42 and evo.get(entity_list[1], f2) == 'hello')
|
||||
assert(evo.get(entity_list[2], f1) == 42 and evo.get(entity_list[2], f2) == 'hello')
|
||||
end
|
||||
|
||||
do
|
||||
local entity_list, entity_count = {}, 2
|
||||
evo.multi_clone_to(entity_list, 2, entity_count, p)
|
||||
assert(evo.has_all(entity_list[2], f1, f2))
|
||||
assert(evo.has_all(entity_list[3], f1, f2))
|
||||
assert(evo.get(entity_list[2], f1) == 42 and evo.get(entity_list[2], f2) == 'hello')
|
||||
assert(evo.get(entity_list[3], f1) == 42 and evo.get(entity_list[3], f2) == 'hello')
|
||||
end
|
||||
|
||||
do
|
||||
local entity_list, entity_count = {}, 2
|
||||
evo.defer()
|
||||
evo.multi_clone_to(entity_list, 1, entity_count, p)
|
||||
assert(entity_list[1] and entity_list[2])
|
||||
assert(evo.empty_all(entity_list[1], entity_list[2]))
|
||||
evo.commit()
|
||||
assert(evo.has_all(entity_list[1], f1, f2))
|
||||
assert(evo.has_all(entity_list[2], f1, f2))
|
||||
assert(evo.get(entity_list[1], f1) == 42 and evo.get(entity_list[1], f2) == 'hello')
|
||||
assert(evo.get(entity_list[2], f1) == 42 and evo.get(entity_list[2], f2) == 'hello')
|
||||
end
|
||||
|
||||
do
|
||||
local entity_list, entity_count = {}, 2
|
||||
evo.defer()
|
||||
evo.multi_clone_to(entity_list, 2, entity_count, p)
|
||||
assert(entity_list[2] and entity_list[3])
|
||||
assert(evo.empty_all(entity_list[2], entity_list[3]))
|
||||
evo.commit()
|
||||
assert(evo.has_all(entity_list[2], f1, f2))
|
||||
assert(evo.has_all(entity_list[3], f1, f2))
|
||||
assert(evo.get(entity_list[2], f1) == 42 and evo.get(entity_list[2], f2) == 'hello')
|
||||
assert(evo.get(entity_list[3], f1) == 42 and evo.get(entity_list[3], f2) == 'hello')
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local f1, f2 = evo.id(2)
|
||||
local q12 = evo.builder():include(f1, f2):build()
|
||||
local p = evo.spawn { [f1] = 42, [f2] = 'hello' }
|
||||
|
||||
do
|
||||
assert(select('#', evo.multi_clone_nr(2, p)) == 0)
|
||||
|
||||
do
|
||||
local entity_count = 0
|
||||
|
||||
for chunk in evo.execute(q12) do
|
||||
local _, chunk_entity_count = chunk:entities()
|
||||
entity_count = entity_count + chunk_entity_count
|
||||
end
|
||||
|
||||
assert(entity_count == 3)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local b = evo.builder():set(f1, 42):set(f2, 'hello')
|
||||
|
||||
assert(select('#', b:multi_clone_nr(2, p)) == 0)
|
||||
|
||||
do
|
||||
local entity_count = 0
|
||||
|
||||
for chunk in evo.execute(q12) do
|
||||
local _, chunk_entity_count = chunk:entities()
|
||||
entity_count = entity_count + chunk_entity_count
|
||||
end
|
||||
|
||||
assert(entity_count == 5)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local b = evo.builder():set(f1, 42):set(f2, 'hello')
|
||||
|
||||
assert(select('#', b:multi_build_nr(2, p)) == 0)
|
||||
|
||||
do
|
||||
local entity_count = 0
|
||||
|
||||
for chunk in evo.execute(q12) do
|
||||
local _, chunk_entity_count = chunk:entities()
|
||||
entity_count = entity_count + chunk_entity_count
|
||||
end
|
||||
|
||||
assert(entity_count == 7)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local f1, f2 = evo.id(2)
|
||||
local q12 = evo.builder():include(f1, f2):build()
|
||||
local p = evo.spawn { [f1] = 42, [f2] = 'hello' }
|
||||
|
||||
do
|
||||
local entity_list = {}
|
||||
assert(select('#', evo.multi_clone_to(entity_list, 1, 2, p)) == 0)
|
||||
|
||||
do
|
||||
local entity_count = 0
|
||||
|
||||
for chunk in evo.execute(q12) do
|
||||
local _, chunk_entity_count = chunk:entities()
|
||||
entity_count = entity_count + chunk_entity_count
|
||||
end
|
||||
|
||||
assert(entity_count == 3)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local b = evo.builder():set(f1, 42):set(f2, 'hello')
|
||||
|
||||
local entity_list = {}
|
||||
assert(select('#', b:multi_clone_to(entity_list, 1, 2, p)) == 0)
|
||||
|
||||
do
|
||||
local entity_count = 0
|
||||
|
||||
for chunk in evo.execute(q12) do
|
||||
local _, chunk_entity_count = chunk:entities()
|
||||
entity_count = entity_count + chunk_entity_count
|
||||
end
|
||||
|
||||
assert(entity_count == 5)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local b = evo.builder():set(f1, 42):set(f2, 'hello')
|
||||
|
||||
local entity_list = {}
|
||||
assert(select('#', b:multi_build_to(entity_list, 1, 2, p)) == 0)
|
||||
|
||||
do
|
||||
local entity_count = 0
|
||||
|
||||
for chunk in evo.execute(q12) do
|
||||
local _, chunk_entity_count = chunk:entities()
|
||||
entity_count = entity_count + chunk_entity_count
|
||||
end
|
||||
|
||||
assert(entity_count == 7)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
assert(evo.depth() == 0)
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
local e = evo.id()
|
||||
assert(evo.alive(e))
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
local e1, e2, f1, f2 = evo.id(4)
|
||||
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
local e1, e2, e3 = evo.id(3)
|
||||
|
||||
do
|
||||
assert(evo.lookup('lookup_hello') == nil)
|
||||
assert(evo.lookup('lookup_world') == nil)
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_hello')
|
||||
assert(entity_list and #entity_list == 0 and entity_count == 0)
|
||||
end
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_world')
|
||||
assert(entity_list and #entity_list == 0 and entity_count == 0)
|
||||
end
|
||||
end
|
||||
|
||||
evo.set(e1, evo.NAME, 'lookup_hello')
|
||||
|
||||
do
|
||||
assert(evo.lookup('lookup_hello') == e1)
|
||||
assert(evo.lookup('lookup_world') == nil)
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_hello')
|
||||
assert(entity_list and #entity_list == 1 and entity_count == 1)
|
||||
assert(entity_list[1] == e1)
|
||||
end
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_world')
|
||||
assert(entity_list and #entity_list == 0 and entity_count == 0)
|
||||
end
|
||||
end
|
||||
|
||||
evo.set(e2, evo.NAME, 'lookup_hello')
|
||||
evo.set(e3, evo.NAME, 'lookup_hello')
|
||||
|
||||
do
|
||||
assert(evo.lookup('lookup_hello') == e1)
|
||||
assert(evo.lookup('lookup_world') == nil)
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_hello')
|
||||
assert(entity_list and #entity_list == 3 and entity_count == 3)
|
||||
assert(entity_list[1] == e1 and entity_list[2] == e2 and entity_list[3] == e3)
|
||||
end
|
||||
end
|
||||
|
||||
evo.set(e2, evo.NAME, 'lookup_world')
|
||||
|
||||
do
|
||||
assert(evo.lookup('lookup_hello') == e1)
|
||||
assert(evo.lookup('lookup_world') == e2)
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_hello')
|
||||
assert(entity_list and #entity_list == 2 and entity_count == 2)
|
||||
assert(entity_list[1] == e1 and entity_list[2] == e3)
|
||||
end
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_world')
|
||||
assert(entity_list and #entity_list == 1 and entity_count == 1)
|
||||
assert(entity_list[1] == e2)
|
||||
end
|
||||
end
|
||||
|
||||
evo.set(e3, evo.NAME, 'lookup_world')
|
||||
|
||||
do
|
||||
assert(evo.lookup('lookup_hello') == e1)
|
||||
assert(evo.lookup('lookup_world') == e2)
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_hello')
|
||||
assert(entity_list and #entity_list == 1 and entity_count == 1)
|
||||
assert(entity_list[1] == e1)
|
||||
end
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_world')
|
||||
assert(entity_list and #entity_list == 2 and entity_count == 2)
|
||||
assert(entity_list[1] == e2 or entity_list[1] == e3)
|
||||
end
|
||||
end
|
||||
|
||||
evo.remove(e1, evo.NAME)
|
||||
|
||||
do
|
||||
assert(evo.lookup('lookup_hello') == nil)
|
||||
assert(evo.lookup('lookup_world') == e2)
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_hello')
|
||||
assert(entity_list and #entity_list == 0 and entity_count == 0)
|
||||
end
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_world')
|
||||
assert(entity_list and #entity_list == 2 and entity_count == 2)
|
||||
assert(entity_list[1] == e2 or entity_list[1] == e3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local e1, e2, e3 = evo.id(3)
|
||||
|
||||
evo.set(e1, evo.NAME, 'lookup_e')
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_e')
|
||||
assert(entity_list and #entity_list == 1 and entity_count == 1)
|
||||
assert(entity_list[1] == e1)
|
||||
end
|
||||
|
||||
evo.set(e2, evo.NAME, 'lookup_e')
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_e')
|
||||
assert(entity_list and #entity_list == 2 and entity_count == 2)
|
||||
assert(entity_list[1] == e1 and entity_list[2] == e2)
|
||||
end
|
||||
|
||||
evo.set(e3, evo.NAME, 'lookup_e')
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_e')
|
||||
assert(entity_list and #entity_list == 3 and entity_count == 3)
|
||||
assert(entity_list[1] == e1 and entity_list[2] == e2 and entity_list[3] == e3)
|
||||
end
|
||||
|
||||
evo.clear(e1, e2, e3)
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_e')
|
||||
assert(entity_list and #entity_list == 0 and entity_count == 0)
|
||||
end
|
||||
|
||||
evo.set(e3, evo.NAME, 'lookup_e')
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_e')
|
||||
assert(entity_list and #entity_list == 1 and entity_count == 1)
|
||||
assert(entity_list[1] == e3)
|
||||
end
|
||||
|
||||
evo.set(e2, evo.NAME, 'lookup_e')
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_e')
|
||||
assert(entity_list and #entity_list == 2 and entity_count == 2)
|
||||
assert(entity_list[1] == e3 and entity_list[2] == e2)
|
||||
end
|
||||
|
||||
evo.set(e1, evo.NAME, 'lookup_e')
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_e')
|
||||
assert(entity_list and #entity_list == 3 and entity_count == 3)
|
||||
assert(entity_list[1] == e3 and entity_list[2] == e2 and entity_list[3] == e1)
|
||||
end
|
||||
|
||||
evo.destroy(e3, e2, e1)
|
||||
|
||||
do
|
||||
local entity_list, entity_count = evo.multi_lookup('lookup_e')
|
||||
assert(entity_list and #entity_list == 0 and entity_count == 0)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local e1, e2 = evo.id(2)
|
||||
|
||||
evo.set(e1, evo.NAME, 'lookup_e')
|
||||
evo.set(e2, evo.NAME, 'lookup_e')
|
||||
|
||||
do
|
||||
local entity_list = {}
|
||||
local entity_count = evo.multi_lookup_to(entity_list, 1, 'lookup_e')
|
||||
assert(entity_count == 2 and entity_list[1] == e1 and entity_list[2] == e2)
|
||||
end
|
||||
|
||||
do
|
||||
local entity_list = {}
|
||||
local entity_count = evo.multi_lookup_to(entity_list, 2, 'lookup_e')
|
||||
assert(entity_count == 2 and entity_list[2] == e1 and entity_list[3] == e2)
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
local f1, f2 = evo.id(2)
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
local entity_list
|
||||
|
||||
@@ -607,164 +605,3 @@ do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local f1, f2 = evo.id(2)
|
||||
|
||||
do
|
||||
local entity_list, entity_count = {}, 2
|
||||
evo.multi_spawn_to(entity_list, 1, entity_count, { [f1] = 42, [f2] = "hello" })
|
||||
assert(evo.has_all(entity_list[1], f1, f2))
|
||||
assert(evo.has_all(entity_list[2], f1, f2))
|
||||
assert(evo.get(entity_list[1], f1) == 42 and evo.get(entity_list[1], f2) == "hello")
|
||||
assert(evo.get(entity_list[2], f1) == 42 and evo.get(entity_list[2], f2) == "hello")
|
||||
end
|
||||
|
||||
do
|
||||
local entity_list, entity_count = {}, 2
|
||||
evo.multi_spawn_to(entity_list, 2, entity_count, { [f1] = 42, [f2] = "hello" })
|
||||
assert(evo.has_all(entity_list[2], f1, f2))
|
||||
assert(evo.has_all(entity_list[3], f1, f2))
|
||||
assert(evo.get(entity_list[2], f1) == 42 and evo.get(entity_list[2], f2) == "hello")
|
||||
assert(evo.get(entity_list[3], f1) == 42 and evo.get(entity_list[3], f2) == "hello")
|
||||
end
|
||||
|
||||
do
|
||||
local entity_list, entity_count = {}, 2
|
||||
evo.defer()
|
||||
evo.multi_spawn_to(entity_list, 1, entity_count, { [f1] = 42, [f2] = "hello" })
|
||||
assert(entity_list[1] and entity_list[2])
|
||||
assert(evo.empty_all(entity_list[1], entity_list[2]))
|
||||
evo.commit()
|
||||
assert(evo.has_all(entity_list[1], f1, f2))
|
||||
assert(evo.has_all(entity_list[2], f1, f2))
|
||||
assert(evo.get(entity_list[1], f1) == 42 and evo.get(entity_list[1], f2) == "hello")
|
||||
assert(evo.get(entity_list[2], f1) == 42 and evo.get(entity_list[2], f2) == "hello")
|
||||
end
|
||||
|
||||
do
|
||||
local entity_list, entity_count = {}, 2
|
||||
evo.defer()
|
||||
evo.multi_spawn_to(entity_list, 2, entity_count, { [f1] = 42, [f2] = "hello" })
|
||||
assert(entity_list[2] and entity_list[3])
|
||||
assert(evo.empty_all(entity_list[2], entity_list[3]))
|
||||
evo.commit()
|
||||
assert(evo.has_all(entity_list[2], f1, f2))
|
||||
assert(evo.has_all(entity_list[3], f1, f2))
|
||||
assert(evo.get(entity_list[2], f1) == 42 and evo.get(entity_list[2], f2) == "hello")
|
||||
assert(evo.get(entity_list[3], f1) == 42 and evo.get(entity_list[3], f2) == "hello")
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local f1, f2 = evo.id(2)
|
||||
local q12 = evo.builder():include(f1, f2):spawn()
|
||||
|
||||
do
|
||||
assert(select('#', evo.multi_spawn_nr(2, { [f1] = 42, [f2] = "hello" })) == 0)
|
||||
|
||||
do
|
||||
local entity_count = 0
|
||||
|
||||
for chunk in evo.execute(q12) do
|
||||
local _, chunk_entity_count = chunk:entities()
|
||||
entity_count = entity_count + chunk_entity_count
|
||||
end
|
||||
|
||||
assert(entity_count == 2)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local b = evo.builder():set(f1, 42):set(f2, "hello")
|
||||
|
||||
assert(select('#', b:multi_spawn_nr(2)) == 0)
|
||||
|
||||
do
|
||||
local entity_count = 0
|
||||
|
||||
for chunk in evo.execute(q12) do
|
||||
local _, chunk_entity_count = chunk:entities()
|
||||
entity_count = entity_count + chunk_entity_count
|
||||
end
|
||||
|
||||
assert(entity_count == 4)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local b = evo.builder():set(f1, 42):set(f2, "hello")
|
||||
|
||||
assert(select('#', b:multi_build_nr(2)) == 0)
|
||||
|
||||
do
|
||||
local entity_count = 0
|
||||
|
||||
for chunk in evo.execute(q12) do
|
||||
local _, chunk_entity_count = chunk:entities()
|
||||
entity_count = entity_count + chunk_entity_count
|
||||
end
|
||||
|
||||
assert(entity_count == 6)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local f1, f2 = evo.id(2)
|
||||
local q12 = evo.builder():include(f1, f2):spawn()
|
||||
|
||||
do
|
||||
local entity_list = {}
|
||||
assert(select('#', evo.multi_spawn_to(entity_list, 1, 2, { [f1] = 42, [f2] = "hello" })) == 0)
|
||||
|
||||
do
|
||||
local entity_count = 0
|
||||
|
||||
for chunk in evo.execute(q12) do
|
||||
local _, chunk_entity_count = chunk:entities()
|
||||
entity_count = entity_count + chunk_entity_count
|
||||
end
|
||||
|
||||
assert(entity_count == 2)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local b = evo.builder():set(f1, 42):set(f2, "hello")
|
||||
|
||||
|
||||
local entity_list = {}
|
||||
assert(select('#', b:multi_spawn_to(entity_list, 1, 2)) == 0)
|
||||
|
||||
do
|
||||
local entity_count = 0
|
||||
|
||||
for chunk in evo.execute(q12) do
|
||||
local _, chunk_entity_count = chunk:entities()
|
||||
entity_count = entity_count + chunk_entity_count
|
||||
end
|
||||
|
||||
assert(entity_count == 4)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local b = evo.builder():set(f1, 42):set(f2, "hello")
|
||||
|
||||
|
||||
local entity_list = {}
|
||||
assert(select('#', b:multi_build_to(entity_list, 1, 2)) == 0)
|
||||
|
||||
do
|
||||
local entity_count = 0
|
||||
|
||||
for chunk in evo.execute(q12) do
|
||||
local _, chunk_entity_count = chunk:entities()
|
||||
entity_count = entity_count + chunk_entity_count
|
||||
end
|
||||
|
||||
assert(entity_count == 6)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
local id = evo.id()
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
local f = evo.id()
|
||||
local e = evo.builder():set(f, 42):spawn()
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
---@type ffilib?
|
||||
local ffi = (function()
|
||||
if package and package.loaded then
|
||||
local loaded_ffi = package.loaded.ffi
|
||||
if loaded_ffi then return loaded_ffi end
|
||||
end
|
||||
|
||||
if package and package.preload then
|
||||
local ffi_loader = package.preload.ffi
|
||||
if ffi_loader then return ffi_loader() end
|
||||
end
|
||||
local ffi_loader = package and package.preload and package.preload['ffi']
|
||||
local ffi = ffi_loader and ffi_loader()
|
||||
return ffi
|
||||
end)()
|
||||
|
||||
if not ffi then
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
local f1, f2 = evo.id(2)
|
||||
evo.set(f1, evo.REQUIRES)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
do
|
||||
local e = evo.spawn()
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
do
|
||||
local f1, f2, f3 = evo.id(3)
|
||||
|
||||
|
||||
66
evolved.d.tl
66
evolved.d.tl
@@ -40,18 +40,6 @@
|
||||
prefab?: Entity,
|
||||
component_mapper?: function(Chunk, integer, integer)): { Entity }, integer
|
||||
|
||||
multi_build_nr: function(self: Builder,
|
||||
entity_count: integer,
|
||||
prefab?: Entity,
|
||||
component_mapper?: function(Chunk, integer, integer))
|
||||
|
||||
multi_build_to: function(self: Builder,
|
||||
out_entity_list: { Entity },
|
||||
out_entity_first: integer,
|
||||
entity_count: integer,
|
||||
prefab?: Entity,
|
||||
component_mapper?: function(Chunk, integer, integer))
|
||||
|
||||
spawn: function(self: Builder,
|
||||
component_mapper?: function(Chunk, integer)): Entity
|
||||
|
||||
@@ -59,16 +47,6 @@
|
||||
entity_count: integer,
|
||||
component_mapper?: function(Chunk, integer, integer)): { Entity }, integer
|
||||
|
||||
multi_spawn_nr: function(self: Builder,
|
||||
entity_count: integer,
|
||||
component_mapper?: function(Chunk, integer, integer))
|
||||
|
||||
multi_spawn_to: function(self: Builder,
|
||||
out_entity_list: { Entity },
|
||||
out_entity_first: integer,
|
||||
entity_count: integer,
|
||||
component_mapper?: function(Chunk, integer, integer))
|
||||
|
||||
clone: function(self: Builder,
|
||||
prefab: Entity,
|
||||
component_mapper?: function(Chunk, integer)): Entity
|
||||
@@ -78,18 +56,6 @@
|
||||
prefab: Entity,
|
||||
component_mapper?: function(Chunk, integer, integer)): { Entity }, integer
|
||||
|
||||
multi_clone_nr: function(self: Builder,
|
||||
entity_count: integer,
|
||||
prefab: Entity,
|
||||
component_mapper?: function(Chunk, integer, integer))
|
||||
|
||||
multi_clone_to: function(self: Builder,
|
||||
out_entity_list: { Entity },
|
||||
out_entity_first: integer,
|
||||
entity_count: integer,
|
||||
prefab: Entity,
|
||||
component_mapper?: function(Chunk, integer, integer))
|
||||
|
||||
has: function(self: Builder, fragment: Fragment): boolean
|
||||
has_all: function(self: Builder, ...: Fragment): boolean
|
||||
has_any: function(self: Builder, ...: Fragment): boolean
|
||||
@@ -198,18 +164,6 @@
|
||||
component_table?: { Fragment: any },
|
||||
component_mapper?: function(Chunk, integer, integer)): { Entity }, integer
|
||||
|
||||
multi_spawn_nr: function(
|
||||
entity_count: integer,
|
||||
component_table?: { Fragment: any },
|
||||
component_mapper?: function(Chunk, integer, integer))
|
||||
|
||||
multi_spawn_to: function(
|
||||
out_entity_list: { Entity },
|
||||
out_entity_first: integer,
|
||||
entity_count: integer,
|
||||
component_table?: { Fragment: any },
|
||||
component_mapper?: function(Chunk, integer, integer))
|
||||
|
||||
clone: function(
|
||||
prefab: Entity,
|
||||
component_table?: { Fragment: any },
|
||||
@@ -221,20 +175,6 @@
|
||||
component_table?: { Fragment: any },
|
||||
component_mapper?: function(Chunk, integer, integer)): { Entity }, integer
|
||||
|
||||
multi_clone_nr: function(
|
||||
entity_count: integer,
|
||||
prefab: Entity,
|
||||
component_table?: { Fragment: any },
|
||||
component_mapper?: function(Chunk, integer, integer))
|
||||
|
||||
multi_clone_to: function(
|
||||
out_entity_list: { Entity },
|
||||
out_entity_first: integer,
|
||||
entity_count: integer,
|
||||
prefab: Entity,
|
||||
component_table?: { Fragment: any },
|
||||
component_mapper?: function(Chunk, integer, integer))
|
||||
|
||||
alive: function(entity: Entity): boolean
|
||||
alive_all: function(...: Entity): boolean
|
||||
alive_any: function(...: Entity): boolean
|
||||
@@ -268,15 +208,11 @@
|
||||
|
||||
locate: function(entity: Entity): Chunk | nil, integer
|
||||
|
||||
lookup: function(name: string): Entity | nil
|
||||
multi_lookup: function(name: string): { Entity }, integer
|
||||
multi_lookup_to: function(out_entity_list: { Entity }, out_entity_first: integer, name: string): integer
|
||||
|
||||
process: function(...: System)
|
||||
process_with: function(system: System, ...: any)
|
||||
|
||||
debug_mode: function(yesno: boolean)
|
||||
collect_garbage: function(no_shrink?: boolean)
|
||||
collect_garbage: function()
|
||||
|
||||
chunk: function(fragment: Fragment, ...: Fragment): Chunk, { Entity }, integer
|
||||
builder: function(): Builder
|
||||
|
||||
799
evolved.lua
799
evolved.lua
File diff suppressed because it is too large
Load Diff
@@ -52,7 +52,7 @@ evolved.builder()
|
||||
:name('SYSTEMS.STARTUP')
|
||||
:group(STAGES.ON_SETUP)
|
||||
:prologue(function()
|
||||
evolved.multi_clone_nr(500, PREFABS.CIRCLE, nil, function(chunk, b_place, e_place)
|
||||
evolved.multi_clone(500, PREFABS.CIRCLE, nil, function(chunk, b_place, e_place)
|
||||
local screen_width, screen_height = love.graphics.getDimensions()
|
||||
|
||||
---@type number[], number[]
|
||||
|
||||
Reference in New Issue
Block a user