This commit is contained in:
biglyderv 2024-11-25 14:14:21 -05:00
parent edd005cb4d
commit 5414c719f1
6 changed files with 141 additions and 10 deletions

19
game.js
View file

@ -41,16 +41,21 @@ class Game extends GameBasic {
let wsEnt = client.ent;
if (!wsEnt) continue;
if (full && wsEnt.health < 1 && !wsEnt.picked) {
wsEnt.picked = true;
const hash = createHash('sha256');
hash.update(client.ip || '');
let hash = client.username;
if (!hash) {
hash = createHash('sha256');
hash.update(client.ip || '');
hash = hash.digest('hex');
}
await db.run('INSERT INTO stats (username, ip, ko) VALUES (?,?,?)', [
wsEnt.you,
hash.digest('hex'),
hash,
wsEnt.headCount
]);
}
@ -76,7 +81,7 @@ class Game extends GameBasic {
na.push(fi.str)
if (fi.entity.isYou) {
let narr = [... fi.basic];
let narr = [...fi.basic];
narr[fi.entity.serverProps.indexOf('isYou')] = 'true';
na[na.length - 1] = JSON.stringify(narr);
}
@ -100,11 +105,11 @@ class Game extends GameBasic {
that.entities = [];
for (let i = 0; i < 20; i++) {
that.entities.push(new NPC(false,that))
that.entities.push(new NPC(false, that))
}
for (let i = 0; i < 30; i++) {
that.entities.push(new Shooter(false,that))
that.entities.push(new Shooter(false, that))
}
setInterval(function () { that.sync(false) }, 1000 / 10);