diff --git a/Sources/FirebladeECS/Family+Coding.swift b/Sources/FirebladeECS/Family+Coding.swift index 64b83321..ae8eb527 100644 --- a/Sources/FirebladeECS/Family+Coding.swift +++ b/Sources/FirebladeECS/Family+Coding.swift @@ -17,15 +17,15 @@ public struct FamilyMemberContainer { } /// Creates a new family member container from a sequence of components. - /// - Parameter component: A sequence of component tuples. - public init(component: S) where S: Sequence, S.Element == (repeat each C) { - components = Array(component) + /// - Parameter components: A sequence of component tuples. + public init(components sequence: S) where S: Sequence, S.Element == (repeat each C) { + components = Array(sequence) } /// Creates a new family member container from a family components iterator. /// - Parameter components: The iterator providing component tuples. - public init(components: Family.ComponentsIterator) { - self.components = Array(components) + public init(components iterator: Family.ComponentsIterator) { + components = Array(iterator) } } @@ -74,13 +74,13 @@ extension FamilyMemberContainer: Decodable where repeat each C: Decodable { public init(from decoder: Decoder) throws { let strategy = decoder.userInfo[CodingUserInfoKey.nexusCodingStrategy] as? CodingStrategy ?? DefaultCodingStrategy() var familyContainer = try decoder.unkeyedContainer() - var componentsList: [(repeat each C)] = [] + var decodedComponents: [(repeat each C)] = [] while !familyContainer.isAtEnd { let container = try familyContainer.nestedContainer(keyedBy: DynamicCodingKey.self) let memberComponents = try (repeat container.decode((each C).self, forKey: strategy.codingKey(for: (each C).self))) - componentsList.append(memberComponents) + decodedComponents.append(memberComponents) } - components = componentsList + components = decodedComponents } } diff --git a/Sources/FirebladeECS/Nexus+Family.swift b/Sources/FirebladeECS/Nexus+Family.swift index 5e787537..89794c98 100644 --- a/Sources/FirebladeECS/Nexus+Family.swift +++ b/Sources/FirebladeECS/Nexus+Family.swift @@ -91,13 +91,13 @@ extension Nexus { /// - excludedComponents: All component types that must not be assigned to an entity in this family. /// - Complexity: O(1) for existing families, O(N) where N is the number of entities for new families. /// - Returns: The family of entities having 1 required components each. - public func family( + public func family( requires comp: Comp.Type, excludesAll excludedComponents: Component.Type... - ) -> Family where Comp: Component { + ) -> Family { Family( nexus: self, - requiresAll: (comp), + requiresAll: comp, excludesAll: excludedComponents ) }