From 523a635dc88bc7890a0e1d3c062a8165259761d6 Mon Sep 17 00:00:00 2001 From: troido Date: Thu, 24 Sep 2020 09:38:18 +0200 Subject: don't try to read into the json data structure all manually --- src/componentwrapper.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/componentwrapper.rs') 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::>>().ok_or(aerr!("invalid flag name"))? ) }; -- cgit