mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
c212de00c2
- replace serde_derive by feature of serde incl. source code modifications to compile - reduce futures-timer to "2.0" to be same as async_std - update notify - removed mio, bincode and lz4 compress in common as networking is now in own crate btw there is a better lz4 compress crate, which is newer than 2017 - update prometheus to 0.9 - can't update uvth yet due to usues - hashbrown to 7.2 to only need a single version - libsqlite3 update - image didn't change as there is a problem with `image 0.23` - switch old directories with newer directories-next - no num upgrade as we still depend on num 0.2 anyways - rodio and cpal upgrade - const-tewaker update - dispatch (untested) update - git2 update - iterations update
38 lines
1.4 KiB
Rust
38 lines
1.4 KiB
Rust
//! Structs representing a playable Character
|
|
|
|
use crate::comp;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// The limit on how many characters that a player can have
|
|
pub const MAX_CHARACTERS_PER_PLAYER: usize = 8;
|
|
|
|
// TODO: Since loadout persistence came a few weeks after character persistence,
|
|
// we stored their main weapon in the `tool` field here. While loadout
|
|
// persistence is still new, saved characters may not have an associated loadout
|
|
// entry in the DB, so we use this `tool` field to create an entry the first
|
|
// time they enter the game.
|
|
//
|
|
// Once we are happy that all characters have a loadout, or we manually
|
|
// update/delete those that don't, it's no longer necessary and we can
|
|
// remove this from here, as well as in the DB schema and persistence code.
|
|
|
|
/// The minimum character data we need to create a new character on the server.
|
|
/// The `tool` field was historically used to persist the character's weapon
|
|
/// before Loadouts were persisted, and will be removed in the future.
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct Character {
|
|
pub id: Option<i32>,
|
|
pub alias: String,
|
|
pub tool: Option<String>,
|
|
}
|
|
|
|
/// Data needed to render a single character item in the character list
|
|
/// presented during character selection.
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct CharacterItem {
|
|
pub character: Character,
|
|
pub body: comp::Body,
|
|
pub level: usize,
|
|
pub loadout: comp::Loadout,
|
|
}
|