Refine family stencil

This commit is contained in:
Christian Treffs 2020-08-05 16:10:20 +02:00
parent dc6db4ed26
commit 0b273542fc
No known key found for this signature in database
GPG Key ID: 49A4B4B460BE3ED4
2 changed files with 6 additions and 4 deletions

View File

@ -62,4 +62,4 @@ setupEnvironment:
brew install sourcery
generateCode:
sourcery --verbose
sourcery --config ./.sourcery.yml --verbose

View File

@ -20,8 +20,10 @@
{% set CompsLowercased %}{{compsLowercased|join: ", "}}{% endset %}
{% map components into compsTuple using comp %}components.{{ maploop.counter }}{% endmap %}
{% set CompsTuple %}{{compsTuple|join: ", "}}{% endset %}
{% map components into compsParams using comp %}{% if not maploop.first %}_ {% endif %}{{ comp|lowercase }}: {{ comp }}.Type{% endmap %}
{% set CompsParams %}{{compsParams|join: ", "}}{% endset %}
{% map components into compsTypeParams using comp %}{% if not maploop.first %}_ {% endif %}{{ comp|lowercase }}: {{ comp }}.Type{% endmap %}
{% set CompsTypeParams %}{{compsTypeParams|join: ", "}}{% endset %}
{% map components into compsNamedParams using comp %}{% if not maploop.first %}_ {% endif %}{{ comp|lowercase }}: {{ comp }}{% endmap %}
{% set CompsNamedParams %}{{compsNamedParams|join: ", "}}{% endset %}
// MARK: - Family {{ idx }}
@ -123,7 +125,7 @@ extension Nexus {
/// - excludedComponents: All component types that must not be assigned to an entity in this family.
/// - Returns: The family of entities having {{ components.count }} required components each.
public func family<{{ CompParams }}>(
{% if components.count == 1 %}requires{% else %}requiresAll{%endif%} {{ CompsParams }},
{% if components.count == 1 %}requires{% else %}requiresAll{%endif%} {{ CompsTypeParams }},
excludesAll excludedComponents: Component.Type...
) -> Family{{ idx }}<{{ CompParams }}> where {{ CompsWhere }} {
Family{{ idx }}<{{ CompParams }}>(