microwave tweaks (#17107)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -43,7 +43,14 @@ namespace Content.Server.Kitchen.Components
|
|||||||
/// For right now, I don't think any recipe cook time should be greater than 60 seconds.
|
/// For right now, I don't think any recipe cook time should be greater than 60 seconds.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("currentCookTimerTime"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField("currentCookTimerTime"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public uint CurrentCookTimerTime = 5;
|
public uint CurrentCookTimerTime = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum number of seconds a microwave can be set to.
|
||||||
|
/// This is currently only used for validation and the client does not check this.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("maxCookTime"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public uint MaxCookTime = 30;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The max temperature that this microwave can heat objects to.
|
/// The max temperature that this microwave can heat objects to.
|
||||||
|
|||||||
@@ -479,15 +479,19 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
UpdateUserInterfaceState(uid, component);
|
UpdateUserInterfaceState(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSelectTime(EntityUid uid, MicrowaveComponent component, MicrowaveSelectCookTimeMessage args)
|
private void OnSelectTime(EntityUid uid, MicrowaveComponent comp, MicrowaveSelectCookTimeMessage args)
|
||||||
{
|
{
|
||||||
if (!HasContents(component) || HasComp<ActiveMicrowaveComponent>(uid) || !(TryComp<ApcPowerReceiverComponent>(uid, out var apc) && apc.Powered))
|
if (!HasContents(comp) || HasComp<ActiveMicrowaveComponent>(uid) || !(TryComp<ApcPowerReceiverComponent>(uid, out var apc) && apc.Powered))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
component.CurrentCookTimeButtonIndex = args.ButtonIndex;
|
// some validation to prevent trollage
|
||||||
component.CurrentCookTimerTime = args.NewCookTime;
|
if (args.NewCookTime % 5 != 0 || args.NewCookTime > comp.MaxCookTime)
|
||||||
_audio.PlayPvs(component.ClickSound, uid, AudioParams.Default.WithVolume(-2));
|
return;
|
||||||
UpdateUserInterfaceState(uid, component);
|
|
||||||
|
comp.CurrentCookTimeButtonIndex = args.ButtonIndex;
|
||||||
|
comp.CurrentCookTimerTime = args.NewCookTime;
|
||||||
|
_audio.PlayPvs(comp.ClickSound, uid, AudioParams.Default.WithVolume(-2));
|
||||||
|
UpdateUserInterfaceState(uid, comp);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user