diff --git a/common/src/combat.rs b/common/src/combat.rs index 371ec66297..2b77be0e8c 100644 --- a/common/src/combat.rs +++ b/common/src/combat.rs @@ -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, diff --git a/common/src/comp/aura.rs b/common/src/comp/aura.rs index 212c73365d..5f462a97c3 100644 --- a/common/src/comp/aura.rs +++ b/common/src/comp/aura.rs @@ -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, diff --git a/common/src/comp/health.rs b/common/src/comp/health.rs index 2476169571..3837166bb2 100644 --- a/common/src/comp/health.rs +++ b/common/src/comp/health.rs @@ -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, diff --git a/common/src/comp/inventory/item/armor.rs b/common/src/comp/inventory/item/armor.rs index f85213d88f..7778c26afa 100644 --- a/common/src/comp/inventory/item/armor.rs +++ b/common/src/comp/inventory/item/armor.rs @@ -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, diff --git a/common/src/comp/inventory/item/mod.rs b/common/src/comp/inventory/item/mod.rs index c59db7dc19..f6e84da511 100644 --- a/common/src/comp/inventory/item/mod.rs +++ b/common/src/comp/inventory/item/mod.rs @@ -57,6 +57,7 @@ pub enum Utility { } #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub struct Lantern { color: Rgb, 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, diff --git a/common/src/comp/inventory/item/modular.rs b/common/src/comp/inventory/item/modular.rs index 29be4079f3..f7ab0fad51 100644 --- a/common/src/comp/inventory/item/modular.rs +++ b/common/src/comp/inventory/item/modular.rs @@ -236,6 +236,7 @@ impl ModularBase { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub enum ModularComponent { ToolPrimaryComponent { toolkind: ToolKind, diff --git a/common/src/effect.rs b/common/src/effect.rs index c55b338b71..cc61ec6e85 100644 --- a/common/src/effect.rs +++ b/common/src/effect.rs @@ -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,