add deny_unknown_fields to item related structs

This commit is contained in:
Maxicarlos08 2024-02-06 21:57:04 +01:00
parent c3942b5f1f
commit 0933499a3d
No known key found for this signature in database
7 changed files with 10 additions and 1 deletions

View File

@ -982,6 +982,7 @@ const SLASHING_ENERGY_FRACTION: f32 = 0.5;
const CRUSHING_POISE_FRACTION: f32 = 1.0;
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Damage {
pub source: DamageSource,
pub kind: DamageKind,

View File

@ -141,6 +141,7 @@ impl Auras {
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(deny_unknown_fields)]
pub struct AuraBuffConstructor {
pub kind: BuffKind,
pub strength: f32,

View File

@ -8,6 +8,7 @@ use std::{convert::TryFrom, ops::Mul};
/// Specifies what and how much changed current health
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq)]
#[serde(deny_unknown_fields)]
pub struct HealthChange {
/// The amount of the health change, negative is damage, positive is healing
pub amount: f32,

View File

@ -99,6 +99,7 @@ impl Friction {
}
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, Default)]
#[serde(deny_unknown_fields)]
pub struct Stats {
/// Protection is non-linearly transformed (following summation) to a damage
/// reduction using (prot / (60 + prot))
@ -232,6 +233,7 @@ impl PartialOrd for Protection {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Armor {
pub kind: ArmorKind,
pub stats: StatsSource,

View File

@ -57,6 +57,7 @@ pub enum Utility {
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Lantern {
color: Rgb<u32>,
strength_thousandths: u32,
@ -335,6 +336,7 @@ impl Effects {
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub enum ItemKind {
/// Something wieldable
Tool(Tool),
@ -875,7 +877,7 @@ impl assets::Compound for ItemDef {
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename = "ItemDef")]
#[serde(rename = "ItemDef", deny_unknown_fields)]
struct RawItemDef {
legacy_name: String,
legacy_description: String,

View File

@ -236,6 +236,7 @@ impl ModularBase {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub enum ModularComponent {
ToolPrimaryComponent {
toolkind: ToolKind,

View File

@ -12,6 +12,7 @@ pub enum Effect {
/// A buff that may be applied to an entity
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct BuffEffect {
pub kind: comp::BuffKind,
pub data: comp::BuffData,