mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 20:35:02 +01:00
First phase of serialization
This commit is contained in:
parent
aed3e86a17
commit
6896698883
7 changed files with 152 additions and 15 deletions
|
|
@ -1,12 +1,13 @@
|
|||
use egui_inspect::{derive::Inspect, inspect};
|
||||
use s2dc::{vec2, MobileEntity};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
math::{WorldPos, TILE_SIZE},
|
||||
world::{TPosSc, TilePos},
|
||||
};
|
||||
|
||||
#[derive(Debug, Inspect)]
|
||||
#[derive(Debug, Inspect, Serialize, Deserialize)]
|
||||
pub struct Player {
|
||||
#[inspect_with(inspect_mobile_entity)]
|
||||
pub col_en: MobileEntity,
|
||||
|
|
@ -50,4 +51,11 @@ impl Player {
|
|||
pub fn feet_y(&self) -> i32 {
|
||||
self.col_en.en.pos.y + self.col_en.en.bb.y
|
||||
}
|
||||
|
||||
pub(crate) fn save(&self) {
|
||||
log::info!(
|
||||
"{:?}",
|
||||
std::fs::write("player.dat", rmp_serde::to_vec(self).unwrap())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue