despawn skeleton limbs on player death

This commit is contained in:
yuni 2024-04-23 03:49:47 +02:00
parent 7f55ca7d80
commit ce65022905

View file

@ -8,6 +8,7 @@
// + + + ███
// + ▀████████████████████████████████████████████████████▀
use crate::world;
use bevy::ecs::system::EntityCommands;
use bevy::prelude::*;
@ -168,6 +169,7 @@ pub fn load(
parent.spawn((
Limb::Base,
Animation::HumanFloat,
world::DespawnOnPlayerDeath,
SceneBundle {
scene: load_scene_by_path(human.base.as_str(), asset_server),
..default()
@ -182,6 +184,7 @@ pub fn load(
let mut parent_limb = parent.spawn((
limb.class,
Animation::HumanFloat,
world::DespawnOnPlayerDeath,
SceneBundle {
scene: load_scene_by_path(limb.path.as_str(), asset_server),
transform: Transform::from_translation(limb.pos).with_rotation(rot),
@ -202,6 +205,7 @@ pub fn load(
let mut entity_commands = parent.spawn((
child_limb.class,
Animation::HumanFloat,
world::DespawnOnPlayerDeath,
SceneBundle {
scene: load_scene_by_path(child_limb.path.as_str(), asset_server),
transform: Transform::from_translation(child_limb.pos).with_rotation(rot),