Browse Source

IndividualInventoryItem::weapon

pbs
jake 4 years ago
parent
commit
5345939b1b
  1. 8
      src/ship/items/inventory.rs

8
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),

Loading…
Cancel
Save