docs: document game phases, save system, notifications, and events (#65)

This commit is contained in:
demenik
2025-12-10 18:14:15 +01:00
parent 392b93d47b
commit 04a9125a31
13 changed files with 57 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ pub mod components;
pub mod messages;
pub mod ui;
/// Plugin dealing with savegame loading and saving.
pub struct SavegamePlugin;
impl Plugin for SavegamePlugin {
@@ -25,6 +26,7 @@ impl Plugin for SavegamePlugin {
}
}
/// The structure of a save file.
#[derive(Serialize, Deserialize)]
struct SaveData {
grid_width: u32,
@@ -37,6 +39,7 @@ struct SaveData {
inventory: Vec<ItemStack>,
}
/// Serializes game state and writes it to a file.
fn dump_savegame(
mut messages: MessageReader<SavegameDumpMessage>,
save_path: Res<SavegamePath>,
@@ -106,6 +109,7 @@ fn dump_savegame(
}
}
/// Reads a save file and restores game state.
fn load_savegame(
mut commands: Commands,
mut messages: MessageReader<SavegameLoadMessage>,
@@ -174,7 +178,7 @@ fn load_savegame(
}
}
/// Resets all components/resources loaded by `load_savegame`
/// Resets all components/resources loaded by `load_savegame`.
fn reset_savegame(
mut commands: Commands,
grid: Res<Grid>,