File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,15 @@ describe("behavior", function () {
203
203
expect ( world . create ( ) ) . toEqual ( 201 ) ;
204
204
} ) ;
205
205
206
+ it ( "insert does not break sequence when entity == world.entitySequence" , function ( ) {
207
+ const world = new World ;
208
+
209
+ const a = world . insert ( 0 ) ;
210
+ const b = world . create ( ) ; // should be 1
211
+
212
+ expect ( a + 1 ) . toEqual ( b ) ;
213
+ } ) ;
214
+
206
215
it ( "view doesn't loop infinitely" , function ( ) {
207
216
const world = new World ;
208
217
world . create ( A ) ;
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ export class World {
82
82
*/
83
83
insert < T extends Component [ ] > ( entity : Entity , ...components : T ) : Entity {
84
84
// ensure this doesn't break our entity sequence
85
- if ( entity > this . entitySequence ) this . entitySequence = entity + 1 ;
85
+ if ( entity >= this . entitySequence ) this . entitySequence = entity + 1 ;
86
86
this . entities . add ( entity ) ;
87
87
for ( let i = 0 , len = components . length ; i < len ; ++ i ) {
88
88
this . emplace ( entity , components [ i ] ) ;
You can’t perform that action at this time.
0 commit comments