added skip timeout

This commit is contained in:
Wenszel 2022-06-08 22:13:18 +02:00
parent f0d6fa758d
commit 4e52512c7d
3 changed files with 2 additions and 12 deletions

View File

@ -79,6 +79,7 @@ module.exports = (io, socket) => {
}
// Updating timer
room.nextMoveTime = Date.now() + 15000;
setTimeout(skip, 15000);
// Pushing above data to database
RoomModel.findOneAndUpdate({ _id: req.session.roomId }, room, err => {
if (err) return err;
@ -110,6 +111,7 @@ module.exports = (io, socket) => {
}
// Updating timer
room.nextMoveTime = Date.now() + 15000;
setTimeout(skip, 15000);
// Pushing above data to database
RoomModel.findOneAndUpdate({ _id: req.session.roomId }, room, (err, updatedRoom) => {
if (!updatedRoom) return err;

View File

@ -2,7 +2,6 @@ import React, { useState, useEffect, useContext, useCallback } from 'react';
import ReactLoading from 'react-loading';
import { PlayerDataContext, SocketContext } from '../App';
import Map from './game-board-components/Map';
import Dice from './game-board-components/Dice';
import Navbar from './Navbar';
const Gameboard = () => {
@ -96,10 +95,3 @@ const Gameboard = () => {
};
export default Gameboard;
/*
<Dice
rolledNumber={rolledNumber}
nowMoving={nowMoving}
color={movingPlayer}
rolledNumberCallback={rolledNumberCallback}
/>*/

View File

@ -26,10 +26,6 @@ const NameContainer = ({ player, time }) => {
// Function responsible for counting down to the end of time every second
const countdown = () => {
// If the time if over emit information to server
if (remainingTime <= 0) {
return socket.emit('game:skip');
}
setRemainingTime(Math.ceil((time - Date.now()) / 1000));
};