Commit 1f573a2c authored by Rahix's avatar Rahix 🦀
Browse files

bottle_angel: Show empty bottle drop points

Instead of deleting drop points on contact, change them to be an empty
drop point instead.
parent 5f075603
...@@ -2,6 +2,7 @@ use crate::colliders; ...@@ -2,6 +2,7 @@ use crate::colliders;
use crate::components; use crate::components;
use crate::entities; use crate::entities;
use crate::resources; use crate::resources;
use crate::sprites;
use crate::svg_loader; use crate::svg_loader;
pub struct BottleAngelShift { pub struct BottleAngelShift {
...@@ -66,8 +67,9 @@ impl BottleAngelState { ...@@ -66,8 +67,9 @@ impl BottleAngelState {
#[legion::system] #[legion::system]
#[read_component(colliders::Collider)] #[read_component(colliders::Collider)]
#[read_component(components::Matebottledrop)] #[read_component(components::Matebottledrop)]
#[write_component(components::Sprite)]
pub fn collect_bottledrops( pub fn collect_bottledrops(
world: &legion::world::SubWorld, world: &mut legion::world::SubWorld,
cmd: &mut legion::systems::CommandBuffer, cmd: &mut legion::systems::CommandBuffer,
#[resource] player: &resources::Player, #[resource] player: &resources::Player,
#[resource] collision_world: &colliders::CollisionWorld, #[resource] collision_world: &colliders::CollisionWorld,
...@@ -79,7 +81,7 @@ pub fn collect_bottledrops( ...@@ -79,7 +81,7 @@ pub fn collect_bottledrops(
.get(world, player.0) .get(world, player.0)
.unwrap(); .unwrap();
let mut bottledrops = <&components::Matebottledrop>::query(); let mut bottledrops = <(&components::Matebottledrop, &mut components::Sprite)>::query();
for pair in collision_world for pair in collision_world
.world .world
.proximities_with(collider.handle.unwrap(), false) .proximities_with(collider.handle.unwrap(), false)
...@@ -90,8 +92,9 @@ pub fn collect_bottledrops( ...@@ -90,8 +92,9 @@ pub fn collect_bottledrops(
} }
let entity = *collision_world.world.objects.get(pair.1).unwrap().data(); let entity = *collision_world.world.objects.get(pair.1).unwrap().data();
if bottledrops.get(world, entity).is_ok() { if let Ok((_, sprite)) = bottledrops.get_mut(world, entity) {
cmd.remove(entity); *sprite = components::Sprite::new(sprites::Sprite::BottleDropPointEmpty);
cmd.remove_component::<components::Matebottledrop>(entity);
bottle_angel_state.collected_drops += 1; bottle_angel_state.collected_drops += 1;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment