Fixes construction graphs proccing while being microwaved (#23835)

* Fixes construction graphs proccing while being microwaved

* git those indents in line

* We knew we were missing something!
This commit is contained in:
deathride58
2024-01-12 03:42:41 -05:00
committed by GitHub
parent 1c3c596bae
commit f5c40c3623
3 changed files with 77 additions and 22 deletions

View File

@@ -380,6 +380,13 @@ namespace Content.Server.Construction
if (ev is not OnTemperatureChangeEvent)
break;
// Some things, like microwaves, might need to block the temperature construction step from kicking in, or override it entirely.
var tempEvent = new OnConstructionTemperatureEvent();
RaiseLocalEvent(uid, tempEvent, true);
if (tempEvent.Result is not null)
return tempEvent.Result.Value;
// prefer using InternalTemperature since that's more accurate for cooking.
float temp;
if (TryComp<InternalTemperatureComponent>(uid, out var internalTemp))
@@ -588,34 +595,39 @@ namespace Content.Server.Construction
/// </summary>
Completed
}
}
/// <summary>
/// Specifies the result after attempting to handle a specific step with an event.
/// </summary>
public enum HandleResult : byte
{
/// <summary>
/// The interaction wasn't handled or validated.
/// </summary>
False,
/// <summary>
/// Specifies the result after attempting to handle a specific step with an event.
/// The interaction would be handled successfully. Nothing was modified.
/// </summary>
private enum HandleResult : byte
{
/// <summary>
/// The interaction wasn't handled or validated.
/// </summary>
False,
Validated,
/// <summary>
/// The interaction would be handled successfully. Nothing was modified.
/// </summary>
Validated,
/// <summary>
/// The interaction was handled successfully.
/// </summary>
True,
/// <summary>
/// The interaction was handled successfully.
/// </summary>
True,
/// <summary>
/// The interaction is waiting on a DoAfter now.
/// This means the interaction started the DoAfter.
/// </summary>
DoAfter,
}
/// <summary>
/// The interaction is waiting on a DoAfter now.
/// This means the interaction started the DoAfter.
/// </summary>
DoAfter,
}
#endregion
#endregion
public sealed class OnConstructionTemperatureEvent : HandledEntityEventArgs
{
public HandleResult? Result;
}
}