Serv
- add variable for disable bot movement Site - fix bug with message in end screen game - fix dispose for list user in tournament page
This commit is contained in:
@ -3,10 +3,10 @@
|
||||
# ::: :::::::: #
|
||||
# Bot.py :+: :+: :+: #
|
||||
# +:+ +:+ +:+ #
|
||||
# By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ #
|
||||
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/10/05 03:54:20 by tomoron #+# #+# #
|
||||
# Updated: 2024/10/14 20:18:58 by tomoron ### ########.fr #
|
||||
# Updated: 2024/10/16 01:25:20 by edbernar ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -18,6 +18,8 @@ import random
|
||||
import asyncio
|
||||
import time
|
||||
|
||||
DISABLE_BOT_MOVEMENT = False
|
||||
|
||||
class Bot(Player):
|
||||
def __init__(self, game=None, tournament=None):
|
||||
self.socket = DummySocket(game)
|
||||
@ -84,6 +86,7 @@ class Bot(Player):
|
||||
async def goToObjectiveLoop(self):
|
||||
lastUpdate = time.time()
|
||||
while not self.isEnd():
|
||||
if (not DISABLE_BOT_MOVEMENT):
|
||||
if(self.pos["pos"] != self.objective["pos"] or self.pos["up"] != self.objective["up"]):
|
||||
self.pos["up"] = self.objective["up"]
|
||||
|
||||
|
@ -3,10 +3,10 @@
|
||||
# ::: :::::::: #
|
||||
# GameSettings.py :+: :+: :+: #
|
||||
# +:+ +:+ +:+ #
|
||||
# By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ #
|
||||
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/10/06 16:33:56 by tomoron #+# #+# #
|
||||
# Updated: 2024/10/12 23:31:00 by tomoron ### ########.fr #
|
||||
# Updated: 2024/10/16 01:24:44 by edbernar ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/18 00:53:53 by edbernar #+# #+# */
|
||||
/* Updated: 2024/10/15 20:47:20 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/10/16 00:55:59 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -262,9 +262,9 @@ class MultiOnlineGamePage
|
||||
endGameDiv.style.display = 'flex';
|
||||
intervalEnd = setInterval(() => {
|
||||
if (content.opponentLeft)
|
||||
simpleText.innerText = `Your opponent has given up...\nYou will be redirected to the ` + content.tournamentCode ? "tournamenet" : "lobby" + ` in ${time} seconds`
|
||||
simpleText.innerText = `Your opponent has given up...\nYou will be redirected to the ` + (content.tournamentCode ? "tournament" : "lobby") + ` in ${time} seconds`
|
||||
else
|
||||
simpleText.innerText = `You will be redirected to the ` + content.tournamentCode ? "tournamenet" : "lobby" + ` in ${time} seconds`
|
||||
simpleText.innerText = `You will be redirected to the ` + (content.tournamentCode ? "tournament" : "lobby") + ` in ${time} seconds`
|
||||
time--;
|
||||
if (time == -1)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/01 13:42:29 by edbernar #+# #+# */
|
||||
/* Updated: 2024/10/14 21:49:04 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/10/16 01:10:29 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -15,14 +15,14 @@ import { pageRenderer } from '/static/javascript/main.js';
|
||||
|
||||
const playerNb = [1, 2, 4, 5, 13, 14, 15, 16];
|
||||
const playerList = {
|
||||
player1: {id: 0, username: null, pfp: null},
|
||||
player2: {id: 0, username: null, pfp: null},
|
||||
player4: {id: 0, username: null, pfp: null},
|
||||
player5: {id: 0, username: null, pfp: null},
|
||||
player13: {id: 0, username: null, pfp: null},
|
||||
player14: {id: 0, username: null, pfp: null},
|
||||
player15: {id: 0, username: null, pfp: null},
|
||||
player16: {id: 0, username: null, pfp: null},
|
||||
player1: {id: -1, username: null, pfp: null},
|
||||
player2: {id: -1, username: null, pfp: null},
|
||||
player4: {id: -1, username: null, pfp: null},
|
||||
player5: {id: -1, username: null, pfp: null},
|
||||
player13: {id: -1, username: null, pfp: null},
|
||||
player14: {id: -1, username: null, pfp: null},
|
||||
player15: {id: -1, username: null, pfp: null},
|
||||
player16: {id: -1, username: null, pfp: null},
|
||||
};
|
||||
let divTopInfo = null;
|
||||
let divInfo = null;
|
||||
@ -62,7 +62,7 @@ class TournamentPage
|
||||
divInfo = null;
|
||||
divChat = null;
|
||||
Object.values(playerList).forEach((info) => {
|
||||
info.id = 0;
|
||||
info.id = -1;
|
||||
info.username = null;
|
||||
info.pfp = null;
|
||||
});
|
||||
@ -75,11 +75,8 @@ class TournamentPage
|
||||
let i = 0;
|
||||
|
||||
Object.values(playerList).forEach((info) => {
|
||||
if (!found && info.id == 0 || info.id == content.id)
|
||||
{
|
||||
if (!found && info.id == -1 || (info.id == content.id && info.id != 0))
|
||||
found = true;
|
||||
alreadyConnected = info.id == content.id;
|
||||
}
|
||||
if (!found)
|
||||
i++;
|
||||
});
|
||||
@ -88,11 +85,6 @@ class TournamentPage
|
||||
console.warn("Tournament is full.");
|
||||
return ;
|
||||
}
|
||||
// if (alreadyConnected)
|
||||
// {
|
||||
// console.warn("Player is already in game.");
|
||||
// return ;
|
||||
// }
|
||||
newInfo(`${content.username} joined the tournament.`);
|
||||
document.getElementById('user-' + playerNb[i]).innerText = content.username;
|
||||
document.getElementById('pfp-' + playerNb[i]).style.backgroundImage = `url(${content.pfp})`;
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/01 13:29:50 by edbernar #+# #+# */
|
||||
/* Updated: 2024/10/12 23:16:30 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/10/16 01:20:33 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -18,6 +18,7 @@ import { pageRenderer } from '/static/javascript/main.js'
|
||||
|
||||
function typeTournament(content)
|
||||
{
|
||||
console.log("New tournament request : ", content);
|
||||
if (pageRenderer.actualPage == LobbyPage)
|
||||
{
|
||||
if (content.action == 0)
|
||||
|
Reference in New Issue
Block a user