Fixed crematorium creating ash out of nothing and being allowed to cremate while open (#2473)

This commit is contained in:
Markek1
2020-11-02 11:31:27 +01:00
committed by GitHub
parent f58a951701
commit b5d48e4db0

View File

@@ -55,6 +55,7 @@ namespace Content.Server.GameObjects.Components.Morgue
public void Cremate() public void Cremate()
{ {
if (Cooking) return; if (Cooking) return;
if (Open) return;
Appearance?.SetData(CrematoriumVisuals.Burning, true); Appearance?.SetData(CrematoriumVisuals.Burning, true);
Cooking = true; Cooking = true;
@@ -64,16 +65,19 @@ namespace Content.Server.GameObjects.Components.Morgue
Appearance?.SetData(CrematoriumVisuals.Burning, false); Appearance?.SetData(CrematoriumVisuals.Burning, false);
Cooking = false; Cooking = false;
for (var i = Contents.ContainedEntities.Count - 1; i >= 0; i--) if (Contents.ContainedEntities.Count > 0)
{ {
var item = Contents.ContainedEntities[i]; for (var i = Contents.ContainedEntities.Count - 1; i >= 0; i--)
Contents.Remove(item); {
item.Delete(); var item = Contents.ContainedEntities[i];
Contents.Remove(item);
item.Delete();
}
var ash = Owner.EntityManager.SpawnEntity("Ash", Owner.Transform.Coordinates);
Contents.Insert(ash);
} }
var ash = Owner.EntityManager.SpawnEntity("Ash", Owner.Transform.Coordinates);
Contents.Insert(ash);
TryOpenStorage(Owner); TryOpenStorage(Owner);
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Machines/ding.ogg", Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Machines/ding.ogg", Owner);