summaryrefslogtreecommitdiff
path: root/src/componentwrapper.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-09-24 09:38:18 +0200
committertroido <troido@protonmail.com>2020-09-24 09:38:18 +0200
commit523a635dc88bc7890a0e1d3c062a8165259761d6 (patch)
tree56b0e379349250ecbf75eda6ccdb1f6f791dcbb1 /src/componentwrapper.rs
parentdaaf3a25e9c6cc1843b0a3aff71d4142f83dde10 (diff)
don't try to read into the json data structure all manually
Diffstat (limited to 'src/componentwrapper.rs')
-rw-r--r--src/componentwrapper.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/componentwrapper.rs b/src/componentwrapper.rs
index 08d95ee..b952657 100644
--- a/src/componentwrapper.rs
+++ b/src/componentwrapper.rs
@@ -3,6 +3,7 @@ use std::collections::{HashMap, HashSet};
use serde::Deserialize;
use specs::Builder;
use rand::Rng;
+use std::str::FromStr;
use crate::{
PlayerId,
@@ -166,7 +167,7 @@ components!(all:
Healing (delay: i64, health: i64) {Healing{delay, health, next_heal: None}};
Autofight () {Autofight::default()};
MonsterAI (move_chance: f64, homesickness: f64, view_distance: i64);
- Spawner (amount: i64, clan: String, template: Template) {
+ Spawner (amount: i64, clan: String, template: Template, radius: i64) {
Spawner{
amount: amount as usize,
clan: Clan{name:
@@ -177,7 +178,8 @@ components!(all:
}
},
template: template.unsaved(),
- saturated: false
+ saturated: false,
+ radius
}
};
Clan (name: String);
@@ -212,7 +214,7 @@ components!(all:
Flags(
flags
.iter()
- .map(|s| Flag::from_str(s))
+ .map(|s| Flag::from_str(s).ok())
.collect::<Option<HashSet<Flag>>>().ok_or(aerr!("invalid flag name"))?
)
};