Changelog and added arm length (body radius) to sprite pickup range.

This commit is contained in:
Sam 2021-08-29 22:06:05 -04:00
parent 6d91bae44b
commit 13fa154e55
2 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -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<f32>| {
(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<i32>| (sprite_pos - pos).map(|x| x.abs()).sum() as f32;