summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-04-17 11:15:02 +0200
committertroido <troido@protonmail.com>2020-04-17 11:15:02 +0200
commit13e9ab2c859b9a6a1935acbb93d34a7f10b7e122 (patch)
treee28b2e0d944dc6fad62d6407a411598cedc935cf /src/components
parent608918af8174e9afb761cdd2ad46e489b21c5f4e (diff)
added Mine interaction
Diffstat (limited to 'src/components')
-rw-r--r--src/components/equipment.rs4
-rw-r--r--src/components/interactable.rs9
-rw-r--r--src/components/mod.rs7
3 files changed, 16 insertions, 4 deletions
diff --git a/src/components/equipment.rs b/src/components/equipment.rs
index 386ef38..ab573d8 100644
--- a/src/components/equipment.rs
+++ b/src/components/equipment.rs
@@ -27,7 +27,8 @@ impl Slot {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Stat {
Strength,
- Defence
+ Defence,
+ Mining
}
impl Stat {
@@ -35,6 +36,7 @@ impl Stat {
match txt {
"strength" => Some(Self::Strength),
"defence" => Some(Self::Defence),
+ "mining" => Some(Self::Mining),
_ => None
}
}
diff --git a/src/components/interactable.rs b/src/components/interactable.rs
index f1f0508..f48fb9d 100644
--- a/src/components/interactable.rs
+++ b/src/components/interactable.rs
@@ -8,7 +8,7 @@ use specs::{
use crate::{
exchange::Exchange,
ItemId,
- components::Trigger,
+ components::{Trigger, equipment::Stat},
RoomId
};
@@ -19,7 +19,8 @@ pub enum Interactable {
Say(String),
Reply(String),
Exchange(String, HashMap<String, Exchange>),
- Visit(RoomId)
+ Visit(RoomId),
+ Mine(Stat)
}
use Interactable::*;
@@ -47,6 +48,7 @@ impl Interactable {
.collect::<Option<HashMap<String, Exchange>>>()?
),
"visit" => Visit(RoomId::from_str(arg.as_str()?)),
+ "mine" => Mine(Stat::from_str(arg.as_str()?)?),
_ => None?
})
}
@@ -62,7 +64,7 @@ impl Interactable {
} else {
true
}
- }
+ },
Visit(_) => {
if let Some(txt) = arg {
txt.starts_with("visit ") || txt.starts_with("disallow ") || txt.starts_with("allow ") || txt.starts_with("whitelist")
@@ -70,6 +72,7 @@ impl Interactable {
false
}
}
+ Mine(_) => arg.is_none()
}
}
}
diff --git a/src/components/mod.rs b/src/components/mod.rs
index 64fa717..8ffe30d 100644
--- a/src/components/mod.rs
+++ b/src/components/mod.rs
@@ -240,3 +240,10 @@ pub struct Dedup {
pub priority: i64
}
+
+#[derive(Component, Debug, Clone)]
+pub struct Minable {
+ pub progress: i64,
+ pub total: i64,
+ pub trigger: Trigger
+}