docs: document game phases, save system, notifications, and events (#65)
This commit is contained in:
@@ -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>,
|
||||
|
||||
Reference in New Issue
Block a user