Simplify Healing Component deletion.

I just fixed the bug causing it to need explicit dropping so this hack
can go.
This commit is contained in:
Pieter-Jan Briers
2019-03-21 17:51:25 +01:00
parent e1ca54fc2e
commit 45b803ce41

View File

@@ -37,7 +37,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
if (attacked.TryGetComponent(out DamageableComponent damagecomponent)) if (attacked.TryGetComponent(out DamageableComponent damagecomponent))
{ {
damagecomponent.TakeHealing(DamageType.Brute, Heal); damagecomponent.TakeHealing(DamageType.Brute, Heal);
DropAndDelete(user); Owner.Delete();
} }
} }
@@ -46,19 +46,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
if (user.TryGetComponent(out DamageableComponent damagecomponent)) if (user.TryGetComponent(out DamageableComponent damagecomponent))
{ {
damagecomponent.TakeHealing(DamageType.Brute, Heal); damagecomponent.TakeHealing(DamageType.Brute, Heal);
DropAndDelete(user); Owner.Delete();
return false; return false;
} }
return false; return false;
} }
void DropAndDelete(IEntity user)
{
if(user.TryGetComponent(out HandsComponent handscomponent))
{
handscomponent.Drop(Owner);
Owner.Delete();
}
}
} }
} }