diff options
| author | troido <troido@protonmail.com> | 2020-09-21 00:59:38 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-09-21 00:59:38 +0200 |
| commit | 92e437e50498f7705e33a556535ba39a2b918f9d (patch) | |
| tree | 54c60fffdbadf0d5323e77016c11c439599e126c /src/components | |
| parent | 1e7c665728eb638cdf921824f4c22f54b81f29de (diff) | |
made talk and reply a form of interact again
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/interactable.rs | 16 | ||||
| -rw-r--r-- | src/components/mod.rs | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/components/interactable.rs b/src/components/interactable.rs index ec8c1db..2e286cf 100644 --- a/src/components/interactable.rs +++ b/src/components/interactable.rs @@ -16,7 +16,9 @@ use crate::{ pub enum Interactable { Trigger(Trigger), Visit(RoomId), - Mine(Stat) + Mine(Stat), + Say(String), + Reply(String) } use Interactable::*; @@ -28,6 +30,8 @@ impl Interactable { ("trigger", Parameter::String(s)) => Trigger(Trigger::from_str(s)?), ("visit", Parameter::String(s)) => Visit(RoomId::from_str(s)), ("mine", Parameter::String(s)) => Mine(Stat::from_str(s)?), + ("say", Parameter::String(s)) => Say(s.clone()), + ("reply", Parameter::String(s)) => Reply(s.clone()), _ => None? }) } @@ -42,17 +46,13 @@ impl Interactable { true } } - Mine(_) => arg.is_none() + Mine(_) => arg.is_none(), + Say(_) => arg.is_none(), + Reply(_) => arg.is_some(), } } } -#[derive(Component, Debug, Clone, PartialEq)] -#[storage(HashMapStorage)] -pub struct Talkable { - pub text: String -} - #[derive(Component, Debug, Clone, PartialEq)] #[storage(HashMapStorage)] diff --git a/src/components/mod.rs b/src/components/mod.rs index 68e666c..f315060 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -16,7 +16,7 @@ pub use messages::{ TriggerBox }; pub use faction::Faction; -pub use interactable::{Interactable, Talkable, Exchanger}; +pub use interactable::{Interactable, Exchanger}; pub use equipment::Equipment; pub use inventory::Inventory; pub use serialise::Serialise; |
