Store worlds in user data dir

This commit is contained in:
crumblingstatue 2023-04-15 12:36:47 +02:00
parent d2da1b39ed
commit d7f57a2176
8 changed files with 98 additions and 30 deletions

View file

@ -1,3 +1,5 @@
use std::path::Path;
use egui_inspect::{derive::Inspect, inspect};
use s2dc::{vec2, MobileEntity};
use serde::{Deserialize, Serialize};
@ -52,8 +54,8 @@ impl Player {
self.col_en.en.pos.y + self.col_en.en.bb.y
}
pub(crate) fn save(&self) {
let result = std::fs::write("player.dat", rmp_serde::to_vec(self).unwrap());
pub(crate) fn save(&self, path: &Path) {
let result = std::fs::write(path.join("player.dat"), rmp_serde::to_vec(self).unwrap());
log::info!("{result:?}");
}
}