summaryrefslogtreecommitdiff
path: root/src/components/interactable.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-09-25 08:54:20 +0200
committertroido <troido@protonmail.com>2020-09-25 08:54:20 +0200
commit09306cb76c6e1eabb4082a985a0a0fa335bda5c1 (patch)
treee43abd096374a8e79186b519d80372112ab0ca74 /src/components/interactable.rs
parent9eb3a9da97e53cee14e585e027badb3783b8e25e (diff)
proper serialisation for playerstate; strum for old-style enums
Diffstat (limited to 'src/components/interactable.rs')
-rw-r--r--src/components/interactable.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/components/interactable.rs b/src/components/interactable.rs
index 651437c..8141416 100644
--- a/src/components/interactable.rs
+++ b/src/components/interactable.rs
@@ -1,5 +1,6 @@
use std::collections::HashMap;
+use std::str::FromStr;
use specs::{
Component,
HashMapStorage,
@@ -30,9 +31,9 @@ impl Interactable {
pub fn parse_from_parameter(typ: &str, arg: &Parameter) -> Option<Self> {
Some(match (typ, arg) {
- ("trigger", Parameter::String(s)) => Trigger(Trigger::from_str(s)?),
+ ("trigger", Parameter::String(s)) => Trigger(Trigger::from_str(s).ok()?),
("visit", Parameter::String(s)) => Visit(RoomId(s.clone())),
- ("mine", Parameter::String(s)) => Mine(Stat::from_str(s)?),
+ ("mine", Parameter::String(s)) => Mine(Stat::from_str(s).ok()?),
("say", Parameter::String(s)) => Say(s.clone()),
("reply", Parameter::String(s)) => Reply(s.clone()),
("exchange", p) => {