Player skins !
This commit is contained in:
+18
-1
@@ -29,6 +29,8 @@ export interface SavedPlayer {
|
||||
inventory: (ItemData | null)[];
|
||||
// players saved before health and hunger start full
|
||||
vitals?: SavedVitals;
|
||||
// base64 png, see /skin
|
||||
skin?: string;
|
||||
}
|
||||
|
||||
export class ServerPlayer {
|
||||
@@ -52,6 +54,10 @@ export class ServerPlayer {
|
||||
cursor: Cursor = { item: undefined };
|
||||
selected_slot = 0;
|
||||
screen: OpenScreen | undefined;
|
||||
// base64 png, see /skin. undefined is the default skin
|
||||
skin: string | undefined;
|
||||
// a /skin download is on its way, one at a time
|
||||
downloading_skin = false;
|
||||
|
||||
// last json sent for each synced thing, so only changes get sent
|
||||
sent = new Map<string, string>();
|
||||
@@ -66,7 +72,16 @@ export class ServerPlayer {
|
||||
}
|
||||
|
||||
info(): PlayerInfo {
|
||||
return { id: this.id, name: this.name, x: this.x, y: this.y, z: this.z, yaw: this.yaw, pitch: this.pitch };
|
||||
return {
|
||||
id: this.id,
|
||||
name: this.name,
|
||||
x: this.x,
|
||||
y: this.y,
|
||||
z: this.z,
|
||||
yaw: this.yaw,
|
||||
pitch: this.pitch,
|
||||
skin: this.skin,
|
||||
};
|
||||
}
|
||||
|
||||
save(): SavedPlayer {
|
||||
@@ -79,6 +94,7 @@ export class ServerPlayer {
|
||||
selected_slot: this.selected_slot,
|
||||
inventory: this.inventory.to_data(),
|
||||
vitals: this.vitals.save(),
|
||||
skin: this.skin,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -91,5 +107,6 @@ export class ServerPlayer {
|
||||
this.selected_slot = saved.selected_slot;
|
||||
this.inventory.load(saved.inventory);
|
||||
this.vitals.load(saved.vitals);
|
||||
this.skin = saved.skin;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user