From 13fa154e55296f43cea5efadf9d26aae703b28b1 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 29 Aug 2021 22:06:05 -0400 Subject: [PATCH] Changelog and added arm length (body radius) to sprite pickup range. --- CHANGELOG.md | 2 ++ common/src/states/utils.rs | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff9424baef..2ab40c8844 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The 'spot' system, which generates smaller site-like structures and scenarios - Chestnut and cedar tree varieties - Shooting sprites, such as apples and hives, can knock them out of trees +- Sprite pickup animations ### Changed @@ -66,6 +67,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Enemies no more spawn in dungeon boss room - Melee critical hit no more applies after reduction by armour - Removed Healing Sceptre as a starting weapon as it is considered an advanced weapon +- The ability to pickup sprites through walls ### Fixed diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 0c0f408d8b..f3899bfb7f 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -632,15 +632,16 @@ pub fn handle_manipulate_loadout( InventoryAction::Collect(sprite_pos) => { let sprite_pos_f32 = sprite_pos.map(|x| x as f32); // CLosure to check if distance between a point and the sprite is less than - // MAX_PICKUP_RANGE + // MAX_PICKUP_RANGE and the radius of the body let sprite_range_check = |pos: Vec3| { - (sprite_pos_f32 - pos).magnitude_squared() < MAX_PICKUP_RANGE.powi(2) + (sprite_pos_f32 - pos).magnitude_squared() + < (MAX_PICKUP_RANGE + data.body.radius()).powi(2) }; // Also do a check that a path can be found between sprite and entity // interacting with sprite Use manhattan distance * 1.5 for number // of iterations - let iters = (2.0 * (sprite_pos_f32 - data.pos.0).map(|x| x.abs()).sum()) as usize; + let iters = (3.0 * (sprite_pos_f32 - data.pos.0).map(|x| x.abs()).sum()) as usize; // Heuristic compares manhattan distance of start and end pos let heuristic = move |pos: &Vec3| (sprite_pos - pos).map(|x| x.abs()).sum() as f32;