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