From 2d0569c3d9a75a338137149e94e2f389e24ddf0f Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Mon, 29 Jul 2019 18:23:26 +0100 Subject: [PATCH] Better item throwing --- server/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/lib.rs b/server/src/lib.rs index 54ff766ee2..346099ea9f 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -23,6 +23,7 @@ use common::{ vol::Vox, }; use log::debug; +use rand::Rng; use specs::{join::Join, world::EntityBuilder as EcsEntityBuilder, Builder, Entity as EcsEntity}; use std::{ collections::HashSet, @@ -726,10 +727,13 @@ impl Server { } for (pos, ori, item) in dropped_items { + let vel = ori.0.normalized() * 5.0 + + Vec3::unit_z() * 10.0 + + Vec3::::zero().map(|_| rand::thread_rng().gen::() - 0.5) * 4.0; self.create_object(Default::default(), comp::object::Body::Pouch) - .with(comp::Pos(pos.0 + Vec3::unit_z() * 1.0)) + .with(comp::Pos(pos.0 + Vec3::unit_z() * 0.25)) .with(item) - .with(comp::Vel(ori.0.normalized() * 2.0 + Vec3::unit_z() * 2.0)) + .with(comp::Vel(vel)) .build(); }