mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-22 07:58:06 +03:00
# Description Port fix fryer ui and sound from [Frontier](https://github.com/new-frontiers-14/frontier-station-14). Commits:e77ade7db76e2fe0cd25--- <details><summary><h1>Media</h1></summary> <p> https://github.com/user-attachments/assets/580b9f99-8fe6-4212-84ef-0af7ad143bca </p> </details> --- # Changelog 🆑 Checkraze, GreaseMonk and Will-Oliver-Br - fix: Now the fryer interface works again. --------- Co-authored-by: Checkraze <71046427+Cheackraze@users.noreply.github.com> Co-authored-by: GreaseMonk <1354802+GreaseMonk@users.noreply.github.com> Co-authored-by: Eris <eris@erisws.com>
93 lines
3.1 KiB
C#
93 lines
3.1 KiB
C#
using Content.Server.Kitchen.Components;
|
|
using Content.Server.Nyanotrasen.Kitchen.Components;
|
|
using Content.Shared.Chemistry.Components;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.Hands.Components;
|
|
using Content.Shared.Interaction;
|
|
using Content.Shared.Item;
|
|
using Content.Shared.Nyanotrasen.Kitchen.UI;
|
|
using Content.Shared.Storage;
|
|
using Content.Shared.Tools.Components;
|
|
|
|
namespace Content.Server.Nyanotrasen.Kitchen.EntitySystems;
|
|
|
|
public sealed partial class DeepFryerSystem
|
|
{
|
|
public bool CanInsertItem(EntityUid uid, DeepFryerComponent component, EntityUid item)
|
|
{
|
|
// Keep this consistent with the checks in TryInsertItem.
|
|
return HasComp<ItemComponent>(item) &&
|
|
!HasComp<StorageComponent>(item) &&
|
|
component.Storage.ContainedEntities.Count < component.StorageMaxEntities;
|
|
}
|
|
|
|
private bool TryInsertItem(EntityUid uid, DeepFryerComponent component, EntityUid user, EntityUid item)
|
|
{
|
|
if (!HasComp<ItemComponent>(item))
|
|
{
|
|
_popupSystem.PopupEntity(
|
|
Loc.GetString("deep-fryer-interact-using-not-item"),
|
|
uid,
|
|
user);
|
|
return false;
|
|
}
|
|
|
|
if (HasComp<StorageComponent>(item))
|
|
{
|
|
_popupSystem.PopupEntity(
|
|
Loc.GetString("deep-fryer-storage-no-fit",
|
|
("item", item)),
|
|
uid,
|
|
user);
|
|
return false;
|
|
}
|
|
|
|
if (component.Storage.ContainedEntities.Count >= component.StorageMaxEntities)
|
|
{
|
|
_popupSystem.PopupEntity(
|
|
Loc.GetString("deep-fryer-storage-full"),
|
|
uid,
|
|
user);
|
|
return false;
|
|
}
|
|
|
|
if (!_handsSystem.TryDropIntoContainer(user, item, component.Storage))
|
|
return false;
|
|
|
|
AfterInsert(uid, component, item);
|
|
|
|
_adminLogManager.Add(LogType.Action, LogImpact.Low,
|
|
$"{ToPrettyString(user)} put {ToPrettyString(item)} inside {ToPrettyString(uid)}.");
|
|
|
|
return true;
|
|
}
|
|
|
|
private void OnInteractUsing(EntityUid uid, DeepFryerComponent component, InteractUsingEvent args)
|
|
{
|
|
if (args.Handled)
|
|
return;
|
|
|
|
// By default, allow entities with SolutionTransfer or Tool
|
|
// components to perform their usual actions. Inserting them (if
|
|
// the chef really wants to) will be supported through the UI.
|
|
if (HasComp<SolutionTransferComponent>(args.Used) ||
|
|
HasComp<ToolComponent>(args.Used))
|
|
return;
|
|
|
|
if (TryInsertItem(uid, component, args.User, args.Used))
|
|
args.Handled = true;
|
|
}
|
|
|
|
private void OnInsertItem(EntityUid uid, DeepFryerComponent component, DeepFryerInsertItemMessage args)
|
|
{
|
|
var user = args.Actor;
|
|
|
|
if (!TryComp<HandsComponent>(user, out var handsComponent) ||
|
|
handsComponent.ActiveHandEntity == null)
|
|
return;
|
|
|
|
if (handsComponent.ActiveHandEntity != null)
|
|
TryInsertItem(uid, component, user, handsComponent.ActiveHandEntity.Value);
|
|
}
|
|
}
|