Commit graph

47 commits

Author SHA1 Message Date
Pablo Mayobre
7d8e46ea1f
Normalize slashes to dots when requiring in Utils.loadNamespace 2023-02-14 22:18:59 -03:00
Brandon Blanker Lim-it
75c35d986a
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 18:18:43 -03:00
Jesse Viikari
bbcb49b6f9
Add resources to world
- setResource(name, resource) to set a resource
- getResource(name) to retrieve it
2023-02-14 18:18:43 -03:00
Pablo Mayobre
cb34513d21
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 18:18:43 -03:00
Pablo Mayobre
88b342f0ab
Add ability to clone components
Fixes #51
2023-02-14 18:18:42 -03:00
flamendless
b47fe315c7
Fixed bug with serialization/deserialization 2023-02-14 18:18:42 -03:00
flamendless
e8ccf0f295
Added optional table for output for entity:getComponents 2023-02-14 18:18:42 -03:00
Pablo Ariel Mayobre
7b1df11cfb
Ignore non-lua files in Utils.loadNamespace
Fixes #48
2023-02-14 18:18:41 -03:00
Pablo Ariel Mayobre
95c6a5e085
Fix require indentation 2023-02-14 18:14:25 -03:00
flamendless
748b207252
Fixed errors on World:deserialize 2023-02-14 18:14:25 -03:00
Pablo Ariel Mayobre
f795fee2c5
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 18:14:25 -03:00
Pablo Ariel Mayobre
772dd03b78
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 18:14:24 -03:00
Pablo Ariel Mayobre
238aaeca12
World:newEntity
A shortcut for Concord.entity(World)
2023-02-14 18:14:24 -03:00
Pablo Ariel Mayobre
afc5643755
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 18:14:24 -03:00
Pablo Ariel Mayobre
c5c056f566
Error handling overhaul 2023-02-14 18:14:24 -03:00
Pablo Ariel Mayobre
d854e93e70
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 18:14:23 -03:00
Pablo Ariel Mayobre
eec6f4f29e
Fix utils.loadNamespace when passed a table 2023-02-14 18:14:23 -03:00
Pablo Ariel Mayobre
0dfc922e9a
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 18:14:23 -03:00
Pablo Ariel Mayobre
651472413b
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 18:14:23 -03:00
Pablo Ariel Mayobre
ea59529ddc
Add Component Negation
Fixes #32
2023-02-14 18:14:22 -03:00
Pablo Ariel Mayobre
1c99d534c2
List.sort
Fixes #33
2023-02-14 18:14:08 -03: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
Pablo Ariel Mayobre
eb82c3c580
Update version
This will be version 3.0 of Concord
2021-01-09 19:20:03 -03:00
Tjakka5
c95a1f2768 Update license 2020-05-02 20:44:58 +02:00
Pablo Ariel Mayobre
f640258852
Fix component:serialize can return nil 2020-03-15 01:04:44 -03:00
Pablo Ariel Mayobre
78dc7ee937
Fixed some error messages 2020-03-15 00:20:06 -03:00
Pablo Ariel Mayobre
d8621e4070
Fix serialization function to guard internal values 2020-03-14 19:09:23 -03:00
Pablo Ariel Mayobre
079c1d0e18
Utils.shallowCopy as a default serializer/deserializer for Components 2020-03-14 18:45:15 -03:00
Pablo Ariel Mayobre
9ae805aa43
Fixed: Pool:evaluate should bypass Pool:add filter check 2020-03-14 14:56:33 -03:00
Pablo Ariel Mayobre
16e111176e
Added Utils.loadNamespace
Deleted the previous Concord.loadComponents/Systems/Worlds
2020-03-14 14:55:11 -03:00
Pablo Ariel Mayobre
c640641b09
CONCORD IS DEAD
Long live Concord!!
2020-03-14 07:45:25 -03:00
Tjakka5
5dffe04b72 Fix flushing failing 2020-01-18 19:44:09 +01:00
Tjakka5
275d54726d Allow emits within emits 2020-01-18 19:26:38 +01:00
Andrew Minnich
a65f88dd5e make the docs a little nicer
main changes:
- add parameter and return types where applicable
- use @module and @classmod tags at the top of files
- remove some redundant descriptions of return values, especially for functions that return a boolean

recommended next steps:
- more consistent grammar
- add links to classes and functions in descriptions where appropriate
- be consistent about naming Systems vs. SystemClasses and Components vs. ComponentClasses
2020-01-04 10:31:05 -05:00
Tjakka5
55ae5fd987 Add helper functions to container. Allow name to be gotten 2020-01-04 13:40:18 +01:00
Tjakka5
6cd66e6737 Add serialization and deserialization functions to component, entity, world 2020-01-04 13:26:26 +01:00
Tjakka5
cf51bccb81 Fix naming of system:clear, system:setEnable 2020-01-04 11:10:29 +01:00
Tjakka5
f502f1b9f6 rename folder src to concord 2020-01-04 10:50:13 +01:00
Justin van der Leij
6c98c259e4 Moved some files 2018-04-07 18:24:52 +02:00
Justin van der Leij
281bb53a5b Added type checking 2018-04-07 01:42:00 +02:00
Justin van der Leij
fda6cd7237 Removed the inherit option for components. They are functional by default now
Turns out doing a 'setmetatable' only makes the code 0.00038% slower. Effectively making the previous code slower because of the branches.

Who would've tought
2018-04-07 00:00:54 +02:00
Justin van der Leij
42213fcdf9 Fixed the love.run loop and moved it into its own file. Fixed examples 2018-04-06 23:53:37 +02:00
Justin van der Leij
afe6573b18 Made the library loading passtrough work properly 2018-04-06 23:46:37 +02:00
Justin van der Leij
7a5050b016 Fixed the love.run loop and moved it into its own file 2018-04-06 23:43:56 +02:00
Justin van der Leij
e1b64e2376 Made the event loop 11.0 friendly 2018-04-06 12:33:16 +02:00
Justin van der Leij
03648fab63 Renamed some more 2018-04-06 12:32:26 +02:00
Justin van der Leij
5afe539d86
Redoing folder layouts 2018-04-06 12:28:42 +02:00