Skip to content

Commit

Permalink
feat: map without names
Browse files Browse the repository at this point in the history
Fixes #36
  • Loading branch information
Erb3 committed Jun 6, 2024
1 parent 70b65fe commit 1042356
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
11 changes: 7 additions & 4 deletions frontend/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
}).addTo(map);
L.tileLayer(
"https://a.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}@2x.png",
{
attribution:
'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, &copy; <a href="https://carto.com/attributions">CARTO</a>',
}
).addTo(map);
map.attributionControl.setPosition("bottomleft");
map.setZoom(3);

Expand Down
2 changes: 1 addition & 1 deletion src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub async fn game_loop(cities: Vec<datasource::City>, io: Arc<SocketIo>, 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",
Expand Down
9 changes: 7 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async fn shutdown_signal(io: Arc<SocketIo>) {
_ = 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(
Expand All @@ -121,6 +121,11 @@ async fn shutdown_signal(io: Arc<SocketIo>) {
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")
}

0 comments on commit 1042356

Please sign in to comment.