From 104235679d2bad19b3945f1a44f375e683ed9865 Mon Sep 17 00:00:00 2001
From: Erb3 <49862976+Erb3@users.noreply.github.com>
Date: Thu, 6 Jun 2024 20:05:40 +0200
Subject: [PATCH] feat: map without names Fixes #36
---
frontend/game.js | 11 +++++++----
src/game.rs | 2 +-
src/main.rs | 9 +++++++--
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/frontend/game.js b/frontend/game.js
index b96ec6d..0eb7eeb 100644
--- a/frontend/game.js
+++ b/frontend/game.js
@@ -37,10 +37,13 @@ const map = L.map("map", {
doubleClickZoom: false,
}).setView([51.505, -0.09], 13);
-L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
- attribution:
- '© OpenStreetMap',
-}).addTo(map);
+L.tileLayer(
+ "https://a.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}@2x.png",
+ {
+ attribution:
+ '© OpenStreetMap, © CARTO',
+ }
+).addTo(map);
map.attributionControl.setPosition("bottomleft");
map.setZoom(3);
diff --git a/src/game.rs b/src/game.rs
index 8b98fd0..4ff827b 100644
--- a/src/game.rs
+++ b/src/game.rs
@@ -129,7 +129,7 @@ pub async fn game_loop(cities: Vec, io: Arc, state:
for socket in io.sockets().unwrap() {
if let Some(player) = state.get_player(socket.id).await {
- if Utc::now().timestamp_millis() > player.last_packet + 30 * 1000 {
+ if Utc::now().timestamp_millis() > player.last_packet + 3 * 60 * 1000 {
socket
.emit(
"kick",
diff --git a/src/main.rs b/src/main.rs
index bb8b05b..ff6d7b6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -108,7 +108,7 @@ async fn shutdown_signal(io: Arc) {
_ = terminate => {},
}
- info!("Termination signal received, starting graceful shutdown. Exiting in 5s");
+ info!("Termination signal received, starting graceful shutdown. Exiting soon");
for socket in io.sockets().unwrap() {
socket
.emit(
@@ -121,6 +121,11 @@ async fn shutdown_signal(io: Arc) {
socket.disconnect().unwrap();
}
- tokio::time::sleep(Duration::from_secs(5)).await;
+ tokio::time::sleep(Duration::from_secs(if cfg!(debug_assertions) {
+ 0
+ } else {
+ 5
+ }))
+ .await;
info!("Exit imminent")
}