From 2502484cf9f2851389de7b71081810f49001e081 Mon Sep 17 00:00:00 2001 From: xavo95 Date: Fri, 13 Sep 2024 21:02:16 +0200 Subject: [PATCH] Weapon addition --- game-server/src/logic/components/weapon.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 game-server/src/logic/components/weapon.rs diff --git a/game-server/src/logic/components/weapon.rs b/game-server/src/logic/components/weapon.rs new file mode 100644 index 0000000..a2e6031 --- /dev/null +++ b/game-server/src/logic/components/weapon.rs @@ -0,0 +1,19 @@ +use shorekeeper_protocol::{EntityComponentPb, EquipComponentPb}; +use shorekeeper_protocol::entity_component_pb::ComponentPb; +use crate::logic::ecs::component::Component; + +pub struct Weapon { + pub weapon_id: i32, + pub weapon_breach_level: i32, +} + +impl Component for Weapon { + fn set_pb_data(&self, pb: &mut shorekeeper_protocol::EntityPb) { + pb.component_pbs.push(EntityComponentPb { + component_pb: Some(ComponentPb::EquipComponent(EquipComponentPb { + weapon_id: self.weapon_id, + weapon_breach_level: self.weapon_breach_level, + })) + }) + } +}