Comparing version 0.2.1 to 0.2.2
@@ -34,2 +34,7 @@ import { EventSubscriber } from '@a-type/utils'; | ||
} | ||
const newArchetypeId = (this.entityLookup[entityId] = this.flipBit(oldArchetypeId, instance.$.type.id)); | ||
if (oldArchetypeId === newArchetypeId) { | ||
// not currently supported... | ||
throw new Error(`Tried to add component ${instance.$.type.id} to ${entityId}, but it already has that component`); | ||
} | ||
const oldArchetype = this.getOrCreate(oldArchetypeId); | ||
@@ -39,3 +44,2 @@ // remove data from old archetype | ||
entity.__addComponent(instance); | ||
const newArchetypeId = (this.entityLookup[entityId] = this.flipBit(oldArchetypeId, instance.$.type.id)); | ||
const archetype = this.getOrCreate(newArchetypeId); | ||
@@ -42,0 +46,0 @@ // copy entity from old to new |
{ | ||
"name": "0g", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -62,2 +62,13 @@ import { EventSubscriber } from '@a-type/utils'; | ||
} | ||
const newArchetypeId = (this.entityLookup[entityId] = this.flipBit( | ||
oldArchetypeId, | ||
instance.$.type.id, | ||
)); | ||
if (oldArchetypeId === newArchetypeId) { | ||
// not currently supported... | ||
throw new Error( | ||
`Tried to add component ${instance.$.type.id} to ${entityId}, but it already has that component`, | ||
); | ||
} | ||
const oldArchetype = this.getOrCreate(oldArchetypeId); | ||
@@ -69,6 +80,2 @@ | ||
const newArchetypeId = (this.entityLookup[entityId] = this.flipBit( | ||
oldArchetypeId, | ||
instance.$.type.id, | ||
)); | ||
const archetype = this.getOrCreate(newArchetypeId); | ||
@@ -75,0 +82,0 @@ // copy entity from old to new |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
238979
4535