Improving documentation

This commit is contained in:
juliancoffee 2024-02-03 17:57:11 +02:00
parent eeb7cab8c3
commit aecdadca14
4 changed files with 20 additions and 17 deletions

View File

@ -198,11 +198,11 @@ impl<
const EXTENSION: &'static str = "ron";
}
// Semantic gender aka body_type
//
// Should be used for localization with extreme care.
// For basically everything except *maybe* humanoids, it's simply wrong to
// assume that this may be used as grammatical gender.
/// Semantic gender aka body_type
///
/// Should be used for localization with extreme care.
/// For basically everything except *maybe* humanoids, it's simply wrong to
/// assume that this may be used as grammatical gender.
//
// TODO: remove this and instead add GUI for players to choose preferred gender.
// Read a comment for `gender_str` in voxygen/i18n-helpers/src/lib.rs.
@ -1366,7 +1366,7 @@ impl Body {
}
}
// Read comment on `Gender` for more
/// Read comment on `Gender` for more
pub fn humanoid_gender(&self) -> Option<Gender> {
match self {
Body::Humanoid(b) => match b.body_type {

View File

@ -57,6 +57,11 @@ impl ChatMode {
pub const fn default() -> Self { Self::World }
}
/// Enum representing death types
///
/// All variants should be strictly typed, no string content.
///
/// If it's too complicated to create an enum for death type, consult i18n team
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum KillType {
Buff(BuffKind),
@ -65,18 +70,17 @@ pub enum KillType {
Explosion,
Energy,
Other,
// Projectile(String), TODO: add projectile name when available
// Projectile(Type), TODO: add projectile name when available
}
/// Enum representing death reasons
///
/// All variants should be strictly typed, no string content.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum KillSource {
Player(Uid, KillType),
NonPlayer(String, KillType),
NonExistent(KillType),
// #[deprecated = "if you use it, please expose enum for translators"]
//
// when I say 'enum' I mean it, not just arg to Content.
// Environment(String),
FallDamage,
Suicide,
Other,

View File

@ -17,15 +17,14 @@ pub struct PlayerInfo {
alias: String,
}
/// Enum representing death reasons
///
/// All variants should be strictly typed, no string content.
#[derive(Clone, Serialize, Deserialize)]
pub enum KillSource {
Player(PlayerInfo, KillType),
NonPlayer(String, KillType),
NonExistent(KillType),
// #[deprecated = "if you use it, please expose enum for translators"]
//
// when I say 'enum' I mean it, not just arg to Content.
// Environment(String),
FallDamage,
Suicide,
Other,

View File

@ -166,7 +166,7 @@ impl Client {
ServerMsg::RegisterAnswer(m) => PreparedMsg::new(0, &m, &self.register_stream_params),
ServerMsg::General(g) => {
match g {
//Character Screen related
// Character Screen related
ServerGeneral::CharacterDataLoadResult(_)
| ServerGeneral::CharacterListUpdate(_)
| ServerGeneral::CharacterActionError(_)
@ -176,7 +176,7 @@ impl Client {
| ServerGeneral::SpectatorSuccess(_) => {
PreparedMsg::new(1, &g, &self.character_screen_stream_params)
},
//In-game related
// In-game related
ServerGeneral::GroupUpdate(_)
| ServerGeneral::Invite { .. }
| ServerGeneral::InvitePending(_)