From 57737852bcd65ec788dab7fd9769930da61f0c9f Mon Sep 17 00:00:00 2001 From: Markus Wiegand Date: Wed, 10 Jan 2024 19:47:56 +0100 Subject: [PATCH] add properties for new armor system (#170) --- model/item/kind_armor.go | 22 ++++++++++++++-------- model/item/kind_tacticalRig.go | 10 ++++++---- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/model/item/kind_armor.go b/model/item/kind_armor.go index 750b5c9..2085216 100644 --- a/model/item/kind_armor.go +++ b/model/item/kind_armor.go @@ -9,16 +9,22 @@ const ( type Armor struct { Item `bson:",inline"` - Type string `json:"type" bson:"type"` - Armor ArmorProps `json:"armor" bson:"armor"` - RicochetChance string `json:"ricochetChance,omitempty" bson:"ricochetChance,omitempty"` - Penalties Penalties `json:"penalties" bson:"penalties"` - Blocking []string `json:"blocking" bson:"blocking"` - Slots Slots `json:"slots" bson:"slots"` - Compatibility List `json:"compatibility" bson:"compatibility"` + Type string `json:"type" bson:"type"` + Armor ArmorProps `json:"armor" bson:"armor"` + Components []ArmorComponent `json:"components" bson:"components"` + RicochetChance string `json:"ricochetChance,omitempty" bson:"ricochetChance,omitempty"` + Penalties Penalties `json:"penalties" bson:"penalties"` + Blocking []string `json:"blocking" bson:"blocking"` + Slots Slots `json:"slots" bson:"slots"` + Compatibility List `json:"compatibility" bson:"compatibility"` } -// ArmorProps represents the armor properties of Armor and TacticalRig +// ArmorComponent describes the entity of an armor component +type ArmorComponent struct { + ArmorProps `bson:",inline"` +} + +// ArmorProps represents the armor properties of ArmorComponent and Armor type ArmorProps struct { Class int64 `json:"class" bson:"class"` Durability float64 `json:"durability" bson:"durability"` diff --git a/model/item/kind_tacticalRig.go b/model/item/kind_tacticalRig.go index 20de675..4838be6 100644 --- a/model/item/kind_tacticalRig.go +++ b/model/item/kind_tacticalRig.go @@ -9,8 +9,10 @@ const ( type TacticalRig struct { Item `bson:",inline"` - Capacity int64 `json:"capacity" bson:"capacity"` - Grids []Grid `json:"grids" bson:"grids"` - Penalties Penalties `json:"penalties" bson:"penalties"` - Armor *ArmorProps `json:"armor,omitempty" bson:"armor,omitempty"` + Capacity int64 `json:"capacity" bson:"capacity"` + Grids []Grid `json:"grids" bson:"grids"` + Penalties Penalties `json:"penalties" bson:"penalties"` + Armor *ArmorProps `json:"armor,omitempty" bson:"armor,omitempty"` // Deprecated + ArmorComponents []ArmorComponent `json:"armorComponents,omitempty" bson:"armorComponents,omitempty"` + Slots Slots `json:"slots" bson:"slots"` }