Correctly delete entities (including those that don't drop items!)

This commit is contained in:
crabman 2024-02-11 23:23:57 +01:00
parent 72d5ed68c8
commit aaa1bd2af9
No known key found for this signature in database

View File

@ -597,14 +597,12 @@ impl ServerEvent for DestroyEvent {
{
// Only drop loot if entity has agency (not a player),
// and if it is not owned by another entity (not a pet)
if !matches!(alignment, Some(Alignment::Owned(_))) {
let Some(items) = data
if !matches!(alignment, Some(Alignment::Owned(_)))
&& let Some(items) = data
.item_drops
.remove(ev.entity)
.map(|comp::ItemDrops(item)| item)
else {
continue;
};
{
// Remove entries where zero exp was awarded - this happens because some
// entities like Object bodies don't give EXP.
let mut item_receivers = HashMap::new();