moves steak cooking to use construction graphs, new temperature construction graph step (#13219)

This commit is contained in:
Timothy Teakettle
2023-01-20 16:09:13 +00:00
committed by GitHub
parent 7575c0944b
commit a7a4137cc7
8 changed files with 214 additions and 82 deletions

View File

@@ -1,6 +1,8 @@
using Content.Server.Administration.Logs;
using Content.Server.Construction.Components;
using Content.Server.DoAfter;
using Content.Server.Temperature.Components;
using Content.Server.Temperature.Systems;
using Content.Shared.Construction;
using Content.Shared.Construction.EntitySystems;
using Content.Shared.Construction.Steps;
@@ -39,6 +41,7 @@ namespace Content.Server.Construction
// Event handling. Add your subscriptions here! Just make sure they're all handled by EnqueueEvent.
SubscribeLocalEvent<ConstructionComponent, InteractUsingEvent>(EnqueueEvent, new []{typeof(AnchorableSystem)});
SubscribeLocalEvent<ConstructionComponent, OnTemperatureChangeEvent>(EnqueueEvent);
}
/// <summary>
@@ -383,6 +386,24 @@ namespace Content.Server.Construction
return HandleResult.DoAfter;
}
case TemperatureConstructionGraphStep temperatureChangeStep:
{
if (ev is not OnTemperatureChangeEvent) {
break;
}
if (TryComp<TemperatureComponent>(uid, out var tempComp))
{
if ((!temperatureChangeStep.MinTemperature.HasValue || tempComp.CurrentTemperature >= temperatureChangeStep.MinTemperature.Value) &&
(!temperatureChangeStep.MaxTemperature.HasValue || tempComp.CurrentTemperature <= temperatureChangeStep.MaxTemperature.Value))
{
return HandleResult.True;
}
}
return HandleResult.False;
}
#endregion
// --- CONSTRUCTION STEP EVENT HANDLING FINISH ---