diff --git a/cosmos_server/src/entities/player/persistence.rs b/cosmos_server/src/entities/player/persistence.rs index 14ef54ee..0e4f20e2 100644 --- a/cosmos_server/src/entities/player/persistence.rs +++ b/cosmos_server/src/entities/player/persistence.rs @@ -81,7 +81,7 @@ fn save_player_link( q_serialized_data: Query<(&SerializedData, &EntityId, Option<&LoadingDistance>)>, ) { for (entity, e_id, player, loc) in q_player_needs_saved.iter() { - info!("Saving player {player:?} @ {loc}"); + info!("Saving player {player:?} ({entity:?}) @ {loc}"); let _ = fs::create_dir_all(PLAYER_LINK_PATH); let sfi = calculate_sfi(entity, &q_parent, &q_entity_id, &q_serialized_data).expect("Missing save file identifier for player!"); diff --git a/cosmos_server/src/persistence/saving.rs b/cosmos_server/src/persistence/saving.rs index f5b4a8df..5bcff214 100644 --- a/cosmos_server/src/persistence/saving.rs +++ b/cosmos_server/src/persistence/saving.rs @@ -11,13 +11,14 @@ use bevy::{ core::Name, ecs::schedule::{IntoSystemSetConfigs, SystemSet}, hierarchy::Parent, - log::{error, warn}, + log::{error, info, warn}, prelude::{App, Commands, Component, Entity, First, IntoSystemConfigs, Or, Query, ResMut, Transform, With, Without}, reflect::Reflect, }; use bevy_rapier3d::prelude::Velocity; use cosmos_core::{ ecs::{despawn_needed, NeedsDespawned}, + entities::player::Player, netty::cosmos_encoder, persistence::LoadingDistance, physics::location::Location, @@ -158,6 +159,7 @@ fn done_saving( &EntityId, Option<&LoadingDistance>, Option<&SaveFileIdentifier>, + Option<&Player>, ), With, >, @@ -179,7 +181,7 @@ fn done_saving( } } - for (entity, name, sd, entity_id, loading_distance, mut save_file_identifier) in q_needs_saved.iter() { + for (entity, name, sd, entity_id, loading_distance, mut save_file_identifier, player) in q_needs_saved.iter() { commands.entity(entity).remove::().remove::(); if !sd.should_save() { @@ -235,6 +237,10 @@ fn done_saving( error!("Unable to save {entity:?}\n{e}"); } + if let Some(player) = player { + info!("Saving player data for {player:?} to disk.") + } + if matches!(&save_file_identifier.identifier_type, SaveFileIdentifierType::Base(_, _, _)) { if let Some(loc) = sd.location { sectors_cache.insert(loc.sector(), entity_id.clone(), loading_distance.map(|ld| ld.load_distance())); diff --git a/cosmos_server/src/universe/asteroid_spawner.rs b/cosmos_server/src/universe/asteroid_spawner.rs index 0897f28b..613bc3d3 100644 --- a/cosmos_server/src/universe/asteroid_spawner.rs +++ b/cosmos_server/src/universe/asteroid_spawner.rs @@ -171,9 +171,11 @@ fn generate_asteroids(mut commands: Commands, q_players: Query<&Location, With