summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-04-21 18:14:52 +0200
committertroido <troido@protonmail.com>2020-04-21 18:14:52 +0200
commit36dc11d82fdc7b5db965f0c33c1ee5da9aa1818c (patch)
treeb90286433f8d129db69d0dc15c213b938392cc65 /src/components
parent99e3ad27e075ccf327d0f399bfa73d75be66d13d (diff)
added options notification
Diffstat (limited to 'src/components')
-rw-r--r--src/components/ear.rs10
-rw-r--r--src/components/interactable.rs2
2 files changed, 10 insertions, 2 deletions
diff --git a/src/components/ear.rs b/src/components/ear.rs
index 1432164..4aafa72 100644
--- a/src/components/ear.rs
+++ b/src/components/ear.rs
@@ -35,6 +35,10 @@ pub enum Notification {
Die {
actor: String,
target: String
+ },
+ Options {
+ description: String,
+ options: Vec<(String, String)>
}
}
@@ -53,7 +57,8 @@ impl Notification {
Heal => "heal"
},
Kill{actor: _, target: _} => "kill",
- Die{actor: _, target: _} => "die"
+ Die{actor: _, target: _} => "die",
+ Options{description: _, options: _} => "options"
}).to_string()
}
@@ -77,6 +82,9 @@ impl Notification {
},
Die{actor, target} => {
format!("{} was killed by {}", target, actor)
+ },
+ Options{description, options} => {
+ format!("{}. Options: {}", description, options.iter().map(|(command, desc)| format!("'{}': {};", command, desc)).collect::<Vec<String>>().join(" "))
}
};
(self.type_name(), body)
diff --git a/src/components/interactable.rs b/src/components/interactable.rs
index f48fb9d..757e27e 100644
--- a/src/components/interactable.rs
+++ b/src/components/interactable.rs
@@ -69,7 +69,7 @@ impl Interactable {
if let Some(txt) = arg {
txt.starts_with("visit ") || txt.starts_with("disallow ") || txt.starts_with("allow ") || txt.starts_with("whitelist")
} else {
- false
+ true
}
}
Mine(_) => arg.is_none()