Commit 28476d9 Picoseconds
committed
1 parent 9177f2d commit 28476d9 Copy full SHA for 28476d9
File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ export default class Game {
57
57
this . started = true ;
58
58
this . lastUpdate = Date . now ( ) ;
59
59
this . generateStructures ( ) ;
60
+ setInterval ( this . sendLeaderboardUpdates . bind ( this ) , 2000 ) ;
60
61
process . nextTick ( this . update ) ;
61
62
}
62
63
@@ -312,14 +313,8 @@ export default class Game {
312
313
}
313
314
}
314
315
315
- /**
316
- * Called every once in a while to send new data
317
- */
318
- tick ( ) {
316
+ sendLeaderboardUpdates ( ) {
319
317
let packetFactory = PacketFactory . getInstance ( ) ;
320
-
321
- this . sendPlayerUpdates ( ) ;
322
-
323
318
let leaderboardUpdate : ( string | number ) [ ] = [ ] ;
324
319
325
320
for ( let player of stableSort ( this . state . players . filter ( player => ! player . dead ) , ( a , b ) => {
@@ -342,6 +337,13 @@ export default class Game {
342
337
}
343
338
}
344
339
340
+ /**
341
+ * Called every once in a while to send new data
342
+ */
343
+ tick ( ) {
344
+ this . sendPlayerUpdates ( ) ;
345
+ }
346
+
345
347
/**
346
348
* Sends GameObject updates to players
347
349
*/
You can’t perform that action at this time.
0 commit comments