Skip to content

Commit

Permalink
Ammo Icons: Add support for Skyrim Arrow Overhaul & more (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
VainlyStrain authored Dec 14, 2023
1 parent 0d66ac3 commit 425efce
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/data/ammo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ pub enum AmmoType {
Slingshot(InvColor),
Melee(InvColor),
Grenade(InvColor),
BodkinArrow(InvColor),
BroadheadArrow(InvColor),
HammerheadArrow(InvColor),
CrescentArrow(InvColor),
FireArrow(InvColor),
WhistleArrow(InvColor),
PractceArrow(InvColor),
}

/// The default ammunition is an arrow drawn in white.
Expand All @@ -37,6 +44,13 @@ impl HasKeywords for AmmoType {
let ammo_keywords: Vec<AmmoType> = keywords
.iter()
.filter_map(|xs| match xs.as_str() {
"ArrowBodkin" => Some(Self::BodkinArrow(color.clone())),
"ArrowBroadhead" => Some(Self::BroadheadArrow(color.clone())),
"ArrowHammer" => Some(Self::HammerheadArrow(color.clone())),
"ArrowCrescent" => Some(Self::CrescentArrow(color.clone())),
"ArrowFire" => Some(Self::FireArrow(color.clone())),
"ArrowWhistle" => Some(Self::WhistleArrow(color.clone())),
"ArrowPractice" => Some(Self::PractceArrowArrow(color.clone())),
"OCF_AmmoTypeArrow" => Some(Self::Arrow(color.clone())),
"OCF_AmmoTypeBolt" => Some(Self::Bolt(color.clone())),
"OCF_AmmoTypeBullet" => Some(Self::Bullet(color.clone())),
Expand Down Expand Up @@ -65,12 +79,29 @@ impl HasIcon for AmmoType {
Self::Slingshot(c) => c.color(),
Self::Melee(c) => c.color(),
Self::Grenade(c) => c.color(),
Self::BodkinArrow(c) => c.color(),
Self::BroadheadArrow(c) => c.color(),
Self::HammerheadArrow(c) => c.color(),
Self::CrescentArrow(c) => c.color(),
Self::FireArrow(c) => c.color(),
Self::WhistleArrow(c) => c.color(),
Self::PractceArrow(c) => c.color(),
}
}

fn icon(&self) -> &Icon {
match self {
AmmoType::Bullet(_) => &Icon::AmmoBullet,
AmmoType::Bolt(_) => &Icon::AmmoBolt,
AmmoType::Dart(_) => &Icon::AmmoDart,
AmmoType::Slingshot(_) => &Icon::AmmoSlingshot,
AmmoType::BodkinArrow(_) => &Icon::AmmoBodkinArrow,
AmmoType::BroadheadArrow(_) => &Icon::AmmoBroadheadArrow,
AmmoType::HammerheadArrow(_) => &Icon::AmmoHammerheadArrow,
AmmoType::CrescentArrow(_) => &Icon::AmmoCrescentArrow,
AmmoType::FireArrow(_) => &Icon::AmmoFireArrow,
AmmoType::WhistleArrow(_) => &Icon::AmmoWhistleArrow,
AmmoType::PractceArrow(_) => &Icon::AmmoPractceArrow,
_ => &Icon::AmmoArrow,
}
}
Expand Down
20 changes: 20 additions & 0 deletions src/images/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ use strum::{Display, EnumString, EnumVariantNames};
pub enum Icon {
Alteration,
AmmoArrow,
AmmoBolt,
AmmoBullet,
AmmoDart,
AmmoSlingshot,
AmmoBodkinArrow,
AmmoBroadheadArrow,
AmmoHammerheadArrow,
AmmoCrescentArrow,
AmmoFireArrow,
AmmoWhistleArrow,
AmmoPracticeArrow,
ArmorAmulet,
ArmorBackpack,
ArmorBelt,
Expand Down Expand Up @@ -210,6 +220,16 @@ impl Icon {

Icon::AmmoArrow => Icon::AmmoArrow,
Icon::AmmoBullet => Icon::AmmoArrow,
Icon::AmmoBolt => Icon::AmmoArrow,
Icon::AmmoDart => Icon::AmmoArrow,
Icon::AmmoSlingshot => Icon::AmmoArrow,
Icon::AmmoBodkinArrow => Icon::AmmoArrow,
Icon::AmmoBroadheadArrow => Icon::AmmoArrow,
Icon::AmmoHammerheadArrow => Icon::AmmoArrow,
Icon::AmmoCrescentArrow => Icon::AmmoArrow,
Icon::AmmoFireArrow => Icon::AmmoArrow,
Icon::AmmoWhistleArrow => Icon::AmmoArrow,
Icon::AmmoPracticeArrow => Icon::AmmoArrow,

// All armor becomes the heavy armor icon.
Icon::ArmorAmulet => Icon::ArmorHeavy,
Expand Down

0 comments on commit 425efce

Please sign in to comment.