This commit is contained in:
Killian Marty 2023-12-06 09:52:34 +01:00
parent 1a3e16d65e
commit 2601346af3

View file

@ -12,6 +12,8 @@ const connections = new Set();
var playerCount = 0;
var players = []
const NAME_MAXLEN = 25;
app.get('/', (req, res) => {
res.send('Grand Tabernacle Auto VI');
});
@ -50,6 +52,7 @@ function generatePosition(){
x = Math.floor(Math.random()*mapWidth);
y = Math.floor(Math.random()*mapHeight);
count++;
console.log(x,y, count);
if(count >= 1000){
break;
}
@ -93,8 +96,8 @@ wss.on('connection', (socket, req) => {
if(username===undefined || username == null){
username = "Soldat Inconnu"
}
if(username.length > 100){
username=username.substring(0, 100);
if(username.length > NAME_MAXLEN){
username=username.substring(0, NAME_MAXLEN);
}
createNewPlayer(socket, username);