Commit graph

206 commits

Author SHA1 Message Date
SelfDevTv
70d756caca changed pairs loop to ipairs 2024-05-28 07:10:17 +02:00
SelfDevTv
ff754ded59 formatting 2024-05-27 22:10:03 +02:00
SelfDevTv
afd2dbb406 added link to worlds between code blocks 2024-05-27 22:05:31 +02:00
SelfDevTv
f6704d8451 create world example first 2024-05-27 22:04:38 +02:00
SelfDevTv
3f79d72560 cleared empty line 2024-05-27 21:59:51 +02:00
SelfDevTv
1978fc4921 Added example how to register the loaded systems via loadNamespace 2024-05-27 21:55:13 +02:00
Justin van der Leij
1aaf501401
Update README.md to hint that components should be loaded for systems 2024-05-27 13:53:55 +02:00
Justin van der Leij
7b8f7b2f0a
Merge pull request #70 from DanielPower/patch-1
Fix link to documentation
2023-02-26 16:28:39 +01:00
Daniel Power
5f4b3b97da
Fix link to documentation 2023-02-18 16:43:56 -03:30
Pablo Mayobre
2386547caa
Normalize slashes to dots when calling require in Utils.loadNamespace
Co-authored-by: Ulhar <ulhar@protonmail.ch>
2023-02-14 22:28:26 -03:00
Brandon Blanker Lim-it
1e4132be21 Added beforeEmit and afterEmit World callbacks (#54)
* Added beforeEmit and afterEmit World callbacks

* Fixed beforeEmit/afterEmit to handle recursive/nested emits;

* Added preventDefaults in beforeEmit
2023-02-14 22:20:34 -03:00
Jesse Viikari
429a448ab6 Add resources to world
- setResource(name, resource) to set a resource
- getResource(name) to retrieve it
2023-02-14 22:20:34 -03:00
Pablo Mayobre
9bccd05019 Usability improvements
- Now entity.key() is the same as entity.key.value
- Entity:serialize only serializes component given correctly
- Any other value inside the Entity is ignored
- Disable some diagnostics used in Lua language server by sumneko
2023-02-14 22:20:34 -03:00
Pablo Mayobre
cf05cfc972 Add ability to clone components
Fixes #51
2023-02-14 22:20:34 -03:00
flamendless
16c77c6a66 Fixed bug with serialization/deserialization 2023-02-14 22:20:34 -03:00
flamendless
61720312cb Added optional table for output for entity:getComponents 2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
8e1b14d53b Ignore non-lua files in Utils.loadNamespace
Fixes #48
2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
bdfe2523b0 Fix require indentation 2023-02-14 22:20:34 -03:00
flamendless
41fcfac6af Fixed errors on World:deserialize 2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
a55efd042a 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.
2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
3d195c790f Add World:query
This method allows you to query the World in order to find a set of Entities that matches a specific Filter.
2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
a4ae392341 World:newEntity
A shortcut for Concord.entity(World)
2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
cc0fd1614c Serializable component
You can remove the component to tell Concord an Entity shouldn't be serialized.

It's given automatically on Entity creation, but this can be disabled by changing Entity.SERIALIZE_BY_DEFAULT to false.
2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
892f4d4700 Error handling overhaul 2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
743d662ef9 Replaced Pools with Filters
Filters allow for a Pool constructor (defaults to Lists) that can be used to define Custom Pools.

The constructor is a function that takes the Filter Definition and returns a Custom Pool with these functions:

:add(e) - Add the Entity to the pool
:remove(e) - Remove the Entity from the pool
:has(e) boolean - Checks if the Entity exists in the pool
:clear() - Clears the Pool from Entities

Fixes #40
2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
07bd5d0f28 Fix utils.loadNamespace when passed a table 2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
c4594da19d Add Component:removed() callback
Fixes #37

I also added a reference to the Entity inside the Component which will help with #38
2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
50249d5ad3 Removed deprecated functionality
Removed hasName/getName on Systems and Worlds.

Removed Entity.__components since it had a duplicate version of the components stored in the Entity itself.
2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
695cc2dfe3 Add Component Negation
Fixes #32
2023-02-14 22:20:34 -03:00
Pablo Ariel Mayobre
89eab3fb72 List.sort
Fixes #33
2023-02-14 22:20:34 -03:00
Justin van der Leij
a45d89457b
Merge pull request #66 from wolfboyft/master
Fix bug where loading namespaces using folder/init.lua entries would only work if "folder" was 3 characters
2022-10-17 21:53:30 +02:00
Tachytaenius
940870318d
Fix bug where loading namespaces using folder/init.lua entries would only work if "folder" was 3 characters 2022-10-17 20:17:54 +01:00
Justin van der Leij
821b36c903
Merge pull request #46 from john-cheesman/correct-readme-code
Correct syntax in Systems example code
2022-10-17 15:12:18 +02:00
Justin van der Leij
7a4bfaf33c
Merge pull request #59 from josh-perry/fix-readme-docs-link
Fixed docs link in README
2022-06-01 17:51:12 +02:00
Josh Perry
2acb1458f2 Fixed docs link in README 2022-05-31 20:20:54 +01:00
Justin van der Leij
edc1d2fdbc Fix documentation page building workflow 13 2021-11-02 20:10:14 +01:00
Justin van der Leij
4313dc7856 Fix documentation page building workflow 12 2021-11-02 17:27:18 +01:00
Justin van der Leij
9c22986501 Fix documentation page building workflow 11 2021-11-02 17:23:53 +01:00
Justin van der Leij
73177f4048 Fix documentation page building workflow 10 2021-11-02 17:21:51 +01:00
Justin van der Leij
6ce714ce14 Fix documentation page building workflow 9 2021-11-02 17:21:22 +01:00
Justin van der Leij
e141a6183b Fix documentation page building workflow 8 2021-11-02 17:18:57 +01:00
Justin van der Leij
6329e09138 Fix documentation page building workflow 7 2021-11-02 17:16:51 +01:00
Justin van der Leij
cdf425d301 Fix documentation page building workflow 6 2021-11-02 17:08:25 +01:00
Justin van der Leij
c7625ad376 Fix documentation page building workflow 5 2021-11-02 17:02:38 +01:00
Justin van der Leij
65aae3c2ba Fix documentation page building workflow 4 2021-11-02 16:57:08 +01:00
Justin van der Leij
297b30aa50 Fix documentation page building workflow 3 2021-11-02 16:55:04 +01:00
Justin van der Leij
9aaff0fbcc Fix documentation page building workflow 2 2021-11-02 16:37:30 +01:00
Justin van der Leij
b701493a27 Fix documentation page building workflow 2021-11-02 16:32:24 +01:00
Justin van der Leij
b53f950e3e Add documentation page building workflow 2021-11-02 16:30:23 +01:00
John Cheesman
fd558dd3fe
Correct syntax in Systems example code 2021-05-05 18:32:04 +01:00