Added broken interpolation
This commit is contained in:
@@ -9,6 +9,8 @@ const state = {
|
||||
},
|
||||
leaderboard: [],
|
||||
updates: [],
|
||||
firstUpdateTime: null,
|
||||
gameStartTime: null,
|
||||
settings: {
|
||||
playerSize: 10,
|
||||
playerSpeed: 2,
|
||||
@@ -74,10 +76,14 @@ const mutations = {
|
||||
state.socketConnected = connected
|
||||
},
|
||||
ADD_UPDATE (state, update) {
|
||||
if (state.updates.length === 0) {
|
||||
state.gameStartTime = Date.now()
|
||||
state.firstUpdateTime = update.time
|
||||
}
|
||||
|
||||
if (state.updates.length > 2) {
|
||||
state.updates.shift()
|
||||
}
|
||||
update.time = update.time.epochSecond
|
||||
state.updates.push(update)
|
||||
},
|
||||
CLEAR_UPDATE (state) {
|
||||
@@ -86,6 +92,8 @@ const mutations = {
|
||||
SET_LEADERBOARD (state, players) {
|
||||
state.leaderboard = []
|
||||
|
||||
if (!players) return
|
||||
|
||||
players.forEach(player => {
|
||||
state.leaderboard.push({
|
||||
name: player.name,
|
||||
|
||||
Reference in New Issue
Block a user