This commit is contained in:
Christian Treffs 2020-08-21 12:07:46 +02:00
parent dc1d2f67b4
commit 2e6ecdf104
No known key found for this signature in database
GPG Key ID: 49A4B4B460BE3ED4
2 changed files with 4 additions and 4 deletions

View File

@ -35,10 +35,11 @@ extension Nexus {
convenience init(from sNexus: SNexus) throws {
let entityIds = sNexus.entities.map { $0.key }.reversed()
// FIXME: this does not respect the generator of the target nexus!
self.init(entityStorage: UnorderedSparseSet(),
componentsByType: [:],
componentsByEntity: [:],
entityIdGenerator: DefaultEntityIdGenerator(startProviding: entityIds), // FIXME: this does not respect the generator of the target nexus!
entityIdGenerator: DefaultEntityIdGenerator(startProviding: entityIds),
familyMembersByTraits: [:],
codingStrategy: DefaultCodingStrategy())

View File

@ -17,12 +17,11 @@ public final class SerializationTests: XCTestCase {
let e3 = nexus.createEntity()
nexus.createEntity(with: Position(x: 5, y: 18), Name(name: "yourName"))
// Fragment entities
nexus.destroy(entity: e2)
nexus.destroy(entity: e3)
nexus.destroy(entity: e1)
let encoder = JSONEncoder()
let data = try encoder.encode(nexus)
@ -43,7 +42,7 @@ public final class SerializationTests: XCTestCase {
let firstEntity = nexus.createEntity(with: Name(name: "myName"), Position(x: 1, y: 2))
let e3 = nexus.createEntity()
let secondEntity = nexus.createEntity(with: Velocity(a: 3.14), Party(partying: true))
// Fragment entities
nexus.destroy(entity: e2)
nexus.destroy(entity: e3)