From 5345939b1b2d727e5a6a1b733f32de7c9cddadd3 Mon Sep 17 00:00:00 2001 From: jake Date: Thu, 3 Dec 2020 15:00:38 -0700 Subject: [PATCH] IndividualInventoryItem::weapon --- src/ship/items/inventory.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ship/items/inventory.rs b/src/ship/items/inventory.rs index 7c45b9e..ebf3cc6 100644 --- a/src/ship/items/inventory.rs +++ b/src/ship/items/inventory.rs @@ -5,6 +5,7 @@ use crate::entity::character::CharacterEntityId; use crate::entity::item::{ItemEntityId, ItemDetail, ItemEntity, ItemType, ItemLocation, InventoryEntity, InventoryItemEntity, EquippedEntity}; use crate::entity::item::tool::Tool; use crate::entity::item::mag::Mag; +use crate::entity::item::weapon::Weapon; use crate::ship::items::{ClientItemId, BankItem, BankItemHandle}; use crate::ship::items::floor::{IndividualFloorItem, StackedFloorItem}; @@ -30,6 +31,13 @@ impl IndividualInventoryItem { } } + pub fn weapon(&self) -> Option<&Weapon> { + match self.item { + ItemDetail::Weapon(ref weapon) => Some(weapon), + _ => None + } + } + pub fn mag_mut(&mut self) -> Option<&mut Mag> { match self.item { ItemDetail::Mag(ref mut mag) => Some(mag),