Remove relatives descending
This commit is contained in:
parent
621d8b4275
commit
d210fe378b
|
|
@ -32,12 +32,6 @@ public struct Requires1<Comp1>: FamilyRequirementsManaging where Comp1: Componen
|
|||
public static func createMember(nexus: Nexus, components: (Comp1)) -> Entity {
|
||||
nexus.createEntity(with: components)
|
||||
}
|
||||
|
||||
public static func relativesDescending(nexus: Nexus, parentId: EntityIdentifier, childId: EntityIdentifier) -> (parent: (Comp1), child: (Comp1)) {
|
||||
let parentcomp1: Comp1 = nexus.get(unsafeComponentFor: parentId)
|
||||
let childcomp1: Comp1 = nexus.get(unsafeComponentFor: childId)
|
||||
return (parent: (parentcomp1), child: (childcomp1))
|
||||
}
|
||||
}
|
||||
|
||||
extension Requires1: FamilyEncoding where Comp1: Encodable {
|
||||
|
|
@ -120,14 +114,6 @@ public struct Requires2<Comp1, Comp2>: FamilyRequirementsManaging where Comp1: C
|
|||
public static func createMember(nexus: Nexus, components: (Comp1, Comp2)) -> Entity {
|
||||
nexus.createEntity(with: components.0, components.1)
|
||||
}
|
||||
|
||||
public static func relativesDescending(nexus: Nexus, parentId: EntityIdentifier, childId: EntityIdentifier) -> (parent: (Comp1, Comp2), child: (Comp1, Comp2)) {
|
||||
let parentcomp1: Comp1 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp2: Comp2 = nexus.get(unsafeComponentFor: parentId)
|
||||
let childcomp1: Comp1 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp2: Comp2 = nexus.get(unsafeComponentFor: childId)
|
||||
return (parent: (parentcomp1, parentcomp2), child: (childcomp1, childcomp2))
|
||||
}
|
||||
}
|
||||
|
||||
extension Requires2: FamilyEncoding where Comp1: Encodable, Comp2: Encodable {
|
||||
|
|
@ -215,16 +201,6 @@ public struct Requires3<Comp1, Comp2, Comp3>: FamilyRequirementsManaging where C
|
|||
public static func createMember(nexus: Nexus, components: (Comp1, Comp2, Comp3)) -> Entity {
|
||||
nexus.createEntity(with: components.0, components.1, components.2)
|
||||
}
|
||||
|
||||
public static func relativesDescending(nexus: Nexus, parentId: EntityIdentifier, childId: EntityIdentifier) -> (parent: (Comp1, Comp2, Comp3), child: (Comp1, Comp2, Comp3)) {
|
||||
let parentcomp1: Comp1 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp2: Comp2 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp3: Comp3 = nexus.get(unsafeComponentFor: parentId)
|
||||
let childcomp1: Comp1 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp2: Comp2 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp3: Comp3 = nexus.get(unsafeComponentFor: childId)
|
||||
return (parent: (parentcomp1, parentcomp2, parentcomp3), child: (childcomp1, childcomp2, childcomp3))
|
||||
}
|
||||
}
|
||||
|
||||
extension Requires3: FamilyEncoding where Comp1: Encodable, Comp2: Encodable, Comp3: Encodable {
|
||||
|
|
@ -317,18 +293,6 @@ public struct Requires4<Comp1, Comp2, Comp3, Comp4>: FamilyRequirementsManaging
|
|||
public static func createMember(nexus: Nexus, components: (Comp1, Comp2, Comp3, Comp4)) -> Entity {
|
||||
nexus.createEntity(with: components.0, components.1, components.2, components.3)
|
||||
}
|
||||
|
||||
public static func relativesDescending(nexus: Nexus, parentId: EntityIdentifier, childId: EntityIdentifier) -> (parent: (Comp1, Comp2, Comp3, Comp4), child: (Comp1, Comp2, Comp3, Comp4)) {
|
||||
let parentcomp1: Comp1 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp2: Comp2 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp3: Comp3 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp4: Comp4 = nexus.get(unsafeComponentFor: parentId)
|
||||
let childcomp1: Comp1 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp2: Comp2 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp3: Comp3 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp4: Comp4 = nexus.get(unsafeComponentFor: childId)
|
||||
return (parent: (parentcomp1, parentcomp2, parentcomp3, parentcomp4), child: (childcomp1, childcomp2, childcomp3, childcomp4))
|
||||
}
|
||||
}
|
||||
|
||||
extension Requires4: FamilyEncoding where Comp1: Encodable, Comp2: Encodable, Comp3: Encodable, Comp4: Encodable {
|
||||
|
|
@ -426,20 +390,6 @@ public struct Requires5<Comp1, Comp2, Comp3, Comp4, Comp5>: FamilyRequirementsMa
|
|||
public static func createMember(nexus: Nexus, components: (Comp1, Comp2, Comp3, Comp4, Comp5)) -> Entity {
|
||||
nexus.createEntity(with: components.0, components.1, components.2, components.3, components.4)
|
||||
}
|
||||
|
||||
public static func relativesDescending(nexus: Nexus, parentId: EntityIdentifier, childId: EntityIdentifier) -> (parent: (Comp1, Comp2, Comp3, Comp4, Comp5), child: (Comp1, Comp2, Comp3, Comp4, Comp5)) {
|
||||
let parentcomp1: Comp1 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp2: Comp2 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp3: Comp3 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp4: Comp4 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp5: Comp5 = nexus.get(unsafeComponentFor: parentId)
|
||||
let childcomp1: Comp1 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp2: Comp2 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp3: Comp3 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp4: Comp4 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp5: Comp5 = nexus.get(unsafeComponentFor: childId)
|
||||
return (parent: (parentcomp1, parentcomp2, parentcomp3, parentcomp4, parentcomp5), child: (childcomp1, childcomp2, childcomp3, childcomp4, childcomp5))
|
||||
}
|
||||
}
|
||||
|
||||
extension Requires5: FamilyEncoding where Comp1: Encodable, Comp2: Encodable, Comp3: Encodable, Comp4: Encodable, Comp5: Encodable {
|
||||
|
|
@ -542,22 +492,6 @@ public struct Requires6<Comp1, Comp2, Comp3, Comp4, Comp5, Comp6>: FamilyRequire
|
|||
public static func createMember(nexus: Nexus, components: (Comp1, Comp2, Comp3, Comp4, Comp5, Comp6)) -> Entity {
|
||||
nexus.createEntity(with: components.0, components.1, components.2, components.3, components.4, components.5)
|
||||
}
|
||||
|
||||
public static func relativesDescending(nexus: Nexus, parentId: EntityIdentifier, childId: EntityIdentifier) -> (parent: (Comp1, Comp2, Comp3, Comp4, Comp5, Comp6), child: (Comp1, Comp2, Comp3, Comp4, Comp5, Comp6)) {
|
||||
let parentcomp1: Comp1 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp2: Comp2 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp3: Comp3 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp4: Comp4 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp5: Comp5 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp6: Comp6 = nexus.get(unsafeComponentFor: parentId)
|
||||
let childcomp1: Comp1 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp2: Comp2 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp3: Comp3 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp4: Comp4 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp5: Comp5 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp6: Comp6 = nexus.get(unsafeComponentFor: childId)
|
||||
return (parent: (parentcomp1, parentcomp2, parentcomp3, parentcomp4, parentcomp5, parentcomp6), child: (childcomp1, childcomp2, childcomp3, childcomp4, childcomp5, childcomp6))
|
||||
}
|
||||
}
|
||||
|
||||
extension Requires6: FamilyEncoding where Comp1: Encodable, Comp2: Encodable, Comp3: Encodable, Comp4: Encodable, Comp5: Encodable, Comp6: Encodable {
|
||||
|
|
@ -665,24 +599,6 @@ public struct Requires7<Comp1, Comp2, Comp3, Comp4, Comp5, Comp6, Comp7>: Family
|
|||
public static func createMember(nexus: Nexus, components: (Comp1, Comp2, Comp3, Comp4, Comp5, Comp6, Comp7)) -> Entity {
|
||||
nexus.createEntity(with: components.0, components.1, components.2, components.3, components.4, components.5, components.6)
|
||||
}
|
||||
|
||||
public static func relativesDescending(nexus: Nexus, parentId: EntityIdentifier, childId: EntityIdentifier) -> (parent: (Comp1, Comp2, Comp3, Comp4, Comp5, Comp6, Comp7), child: (Comp1, Comp2, Comp3, Comp4, Comp5, Comp6, Comp7)) {
|
||||
let parentcomp1: Comp1 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp2: Comp2 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp3: Comp3 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp4: Comp4 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp5: Comp5 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp6: Comp6 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp7: Comp7 = nexus.get(unsafeComponentFor: parentId)
|
||||
let childcomp1: Comp1 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp2: Comp2 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp3: Comp3 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp4: Comp4 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp5: Comp5 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp6: Comp6 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp7: Comp7 = nexus.get(unsafeComponentFor: childId)
|
||||
return (parent: (parentcomp1, parentcomp2, parentcomp3, parentcomp4, parentcomp5, parentcomp6, parentcomp7), child: (childcomp1, childcomp2, childcomp3, childcomp4, childcomp5, childcomp6, childcomp7))
|
||||
}
|
||||
}
|
||||
|
||||
extension Requires7: FamilyEncoding where Comp1: Encodable, Comp2: Encodable, Comp3: Encodable, Comp4: Encodable, Comp5: Encodable, Comp6: Encodable, Comp7: Encodable {
|
||||
|
|
@ -795,26 +711,6 @@ public struct Requires8<Comp1, Comp2, Comp3, Comp4, Comp5, Comp6, Comp7, Comp8>:
|
|||
public static func createMember(nexus: Nexus, components: (Comp1, Comp2, Comp3, Comp4, Comp5, Comp6, Comp7, Comp8)) -> Entity {
|
||||
nexus.createEntity(with: components.0, components.1, components.2, components.3, components.4, components.5, components.6, components.7)
|
||||
}
|
||||
|
||||
public static func relativesDescending(nexus: Nexus, parentId: EntityIdentifier, childId: EntityIdentifier) -> (parent: (Comp1, Comp2, Comp3, Comp4, Comp5, Comp6, Comp7, Comp8), child: (Comp1, Comp2, Comp3, Comp4, Comp5, Comp6, Comp7, Comp8)) {
|
||||
let parentcomp1: Comp1 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp2: Comp2 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp3: Comp3 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp4: Comp4 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp5: Comp5 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp6: Comp6 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp7: Comp7 = nexus.get(unsafeComponentFor: parentId)
|
||||
let parentcomp8: Comp8 = nexus.get(unsafeComponentFor: parentId)
|
||||
let childcomp1: Comp1 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp2: Comp2 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp3: Comp3 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp4: Comp4 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp5: Comp5 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp6: Comp6 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp7: Comp7 = nexus.get(unsafeComponentFor: childId)
|
||||
let childcomp8: Comp8 = nexus.get(unsafeComponentFor: childId)
|
||||
return (parent: (parentcomp1, parentcomp2, parentcomp3, parentcomp4, parentcomp5, parentcomp6, parentcomp7, parentcomp8), child: (childcomp1, childcomp2, childcomp3, childcomp4, childcomp5, childcomp6, childcomp7, childcomp8))
|
||||
}
|
||||
}
|
||||
|
||||
extension Requires8: FamilyEncoding where Comp1: Encodable, Comp2: Encodable, Comp3: Encodable, Comp4: Encodable, Comp5: Encodable, Comp6: Encodable, Comp7: Encodable, Comp8: Encodable {
|
||||
|
|
|
|||
|
|
@ -54,19 +54,6 @@ public struct Requires{{ idx }}<{{ CompParams }}>: FamilyRequirementsManaging wh
|
|||
public static func createMember(nexus: Nexus, components: ({{ CompParams }})) -> Entity {
|
||||
{% if compEncodable.count == 1 %}nexus.createEntity(with: components){% else %}nexus.createEntity(with: {{ CompsTuple }}){% endif %}
|
||||
}
|
||||
|
||||
public static func relativesDescending(nexus: Nexus, parentId: EntityIdentifier, childId: EntityIdentifier) -> (parent: ({{ CompParams }}), child: ({{ CompParams }})) {
|
||||
{% for comp in components %}
|
||||
let parent{{ comp|lowercase }}: {{ comp }} = nexus.get(unsafeComponentFor: parentId)
|
||||
{% endfor %}
|
||||
{% for comp in components %}
|
||||
let child{{ comp|lowercase }}: {{ comp }} = nexus.get(unsafeComponentFor: childId)
|
||||
{% endfor %}
|
||||
{% map compsLowercased into compsParent using comp %}parent{{ comp }}{% endmap %}
|
||||
{% map compsLowercased into compsChild using comp %}child{{ comp }}{% endmap %}
|
||||
{% set CompsParentChild %}parent: ({{compsParent|join: ", "}}), child: ({{compsChild|join: ", "}}){% endset %}
|
||||
return ({{ CompsParentChild }})
|
||||
}
|
||||
}
|
||||
|
||||
extension Requires{{ idx }}: FamilyEncoding where {{ CompsWhereEncodable }} {
|
||||
|
|
|
|||
Loading…
Reference in New Issue