server.player.playerdb
fn load_player #
fn load_player(dir string, key string) ?PlayerData
fn save_player #
fn save_player(dir string, key string, data PlayerData) !
save_player writes player data atomically - the JSON goes to a temp file first, then a rename swaps it over the target. A crash mid-write can only ever leave a stale but valid save behind, never a truncated one.
struct InvItem #
struct InvItem {
pub mut:
id int
meta int
count int
block_runtime_id int
}
struct PlayerData #
struct PlayerData {
pub mut:
x f32
y f32
z f32
yaw f32
pitch f32
gamemode int
items []InvItem
has_last_death bool
last_death_x f32
last_death_y f32
last_death_z f32
}