"""Fix""" microwave (#3411)

Shitcode is now a little less shit
This commit is contained in:
Visne
2021-02-25 06:03:20 +01:00
committed by GitHub
parent 2079c2e2b6
commit 7c32574547

View File

@@ -300,9 +300,6 @@ namespace Content.Server.GameObjects.Components.Kitchen
recipeToCook = r; recipeToCook = r;
} }
var goodMeal = (recipeToCook != null)
&&
(_currentCookTimerTime == (uint)recipeToCook.CookTime);
SetAppearance(MicrowaveVisualState.Cooking); SetAppearance(MicrowaveVisualState.Cooking);
_audioSystem.PlayFromEntity(_startCookingSound, Owner, AudioParams.Default); _audioSystem.PlayFromEntity(_startCookingSound, Owner, AudioParams.Default);
Owner.SpawnTimer((int)(_currentCookTimerTime * _cookTimeMultiplier), (Action)(() => Owner.SpawnTimer((int)(_currentCookTimerTime * _cookTimeMultiplier), (Action)(() =>
@@ -319,20 +316,16 @@ namespace Content.Server.GameObjects.Components.Kitchen
} }
else else
{ {
if (goodMeal) if (recipeToCook != null)
{ {
SubtractContents(recipeToCook!); SubtractContents(recipeToCook);
Owner.EntityManager.SpawnEntity(recipeToCook.Result, Owner.Transform.Coordinates);
} }
else else
{ {
VaporizeReagents(); VaporizeReagents();
VaporizeSolids(); VaporizeSolids();
} Owner.EntityManager.SpawnEntity(_badRecipeName, Owner.Transform.Coordinates);
if (recipeToCook != null)
{
var entityToSpawn = goodMeal ? recipeToCook.Result : _badRecipeName;
Owner.EntityManager.SpawnEntity(entityToSpawn, Owner.Transform.Coordinates);
} }
} }
_audioSystem.PlayFromEntity(_cookingCompleteSound, Owner, AudioParams.Default.WithVolume(-1f)); _audioSystem.PlayFromEntity(_cookingCompleteSound, Owner, AudioParams.Default.WithVolume(-1f));
@@ -427,6 +420,11 @@ namespace Content.Server.GameObjects.Components.Kitchen
private MicrowaveSuccessState CanSatisfyRecipe(FoodRecipePrototype recipe, Dictionary<string,int> solids) private MicrowaveSuccessState CanSatisfyRecipe(FoodRecipePrototype recipe, Dictionary<string,int> solids)
{ {
if (_currentCookTimerTime != (uint) recipe.CookTime)
{
return MicrowaveSuccessState.RecipeFail;
}
if (!Owner.TryGetComponent(out SolutionContainerComponent? solution)) if (!Owner.TryGetComponent(out SolutionContainerComponent? solution))
{ {
return MicrowaveSuccessState.RecipeFail; return MicrowaveSuccessState.RecipeFail;
@@ -458,7 +456,6 @@ namespace Content.Server.GameObjects.Components.Kitchen
} }
} }
return MicrowaveSuccessState.RecipePass; return MicrowaveSuccessState.RecipePass;
} }