From 07b0ba697bff4209907f6abb734fb52a889753e9 Mon Sep 17 00:00:00 2001 From: tom barrett Date: Tue, 17 Apr 2018 02:36:11 -0500 Subject: -added Iron to astroids --- src/mass.rs | 10 +++++++++- src/server/mining.rs | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mass.rs b/src/mass.rs index f38ab6d..f1ac1b2 100644 --- a/src/mass.rs +++ b/src/mass.rs @@ -4,6 +4,7 @@ use std::collections::HashMap; use self::rand::distributions::Range; use self::rand::distributions::Sample; +use item::Item; use storage::Storage; use module::Module; @@ -35,8 +36,15 @@ impl Mass { let mut vr = Range::new(-0.5, 0.5); let velocity = (vr.sample(&mut rng), vr.sample(&mut rng), vr.sample(&mut rng)); + let mut rr = Range::new(0, 20); + let mut resources = Vec::new(); + for _ in 0..rr.sample(&mut rng) { + resources.push(Item::new("Iron", 1)); + } + + let astroid = MassType::Astroid { - resources : Storage::new(Vec::new()), + resources : Storage::new(resources), }; Mass { diff --git a/src/server/mining.rs b/src/server/mining.rs index 2364f9f..fd8b6ff 100644 --- a/src/server/mining.rs +++ b/src/server/mining.rs @@ -30,8 +30,8 @@ impl ServerConnection { match modules.get("Mining").unwrap().module_type { ModuleType::Mining{ref range, ref status, ..} => { - mining_range = range.clone(); - mining_status = status.clone(); + mining_range = *range; + mining_status = *status; } _ => (), } -- cgit v1.2.3