microwave tweaks (#17107)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -479,15 +479,19 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
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;
|
||||
|
||||
component.CurrentCookTimeButtonIndex = args.ButtonIndex;
|
||||
component.CurrentCookTimerTime = args.NewCookTime;
|
||||
_audio.PlayPvs(component.ClickSound, uid, AudioParams.Default.WithVolume(-2));
|
||||
UpdateUserInterfaceState(uid, component);
|
||||
// some validation to prevent trollage
|
||||
if (args.NewCookTime % 5 != 0 || args.NewCookTime > comp.MaxCookTime)
|
||||
return;
|
||||
|
||||
comp.CurrentCookTimeButtonIndex = args.ButtonIndex;
|
||||
comp.CurrentCookTimerTime = args.NewCookTime;
|
||||
_audio.PlayPvs(comp.ClickSound, uid, AudioParams.Default.WithVolume(-2));
|
||||
UpdateUserInterfaceState(uid, comp);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user