Microwave is done. Added an easter egg recipe and made the cheeseburger recipe more sensible.
This commit is contained in:
@@ -7,8 +7,10 @@ using Content.Shared.Chemistry;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Client.UserInterface.Controls;
|
|
||||||
|
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Client.UserInterface.Controls;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Kitchen
|
namespace Content.Client.GameObjects.Components.Kitchen
|
||||||
{
|
{
|
||||||
@@ -32,7 +34,15 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
_menu.OnClose += Close;
|
_menu.OnClose += Close;
|
||||||
_menu.StartButton.OnPressed += args => SendMessage(new SharedMicrowaveComponent.MicrowaveStartCookMessage());
|
_menu.StartButton.OnPressed += args => SendMessage(new SharedMicrowaveComponent.MicrowaveStartCookMessage());
|
||||||
_menu.EjectButton.OnPressed += args => SendMessage(new SharedMicrowaveComponent.MicrowaveEjectMessage());
|
_menu.EjectButton.OnPressed += args => SendMessage(new SharedMicrowaveComponent.MicrowaveEjectMessage());
|
||||||
_menu.IngredientsList.OnItemSelected += args => EjectSolidWithIndex(args.ItemIndex);
|
_menu.IngredientsList.OnItemSelected += args => SendMessage(new SharedMicrowaveComponent.MicrowaveEjectSolidIndexedMessage(_solids[args.ItemIndex]));
|
||||||
|
_menu.OnCookTimeSelected += args =>
|
||||||
|
{
|
||||||
|
var actualButton = args.Button as Button;
|
||||||
|
var newTime = (byte) int.Parse(actualButton.Text);
|
||||||
|
_menu.VisualCookTime = newTime;
|
||||||
|
SendMessage(new SharedMicrowaveComponent.MicrowaveSelectCookTimeMessage(newTime));
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
@@ -60,12 +70,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void EjectSolidWithIndex(int index)
|
private void RefreshContentsDisplay(List<Solution.ReagentQuantity> reagents, List<EntityUid> solids)
|
||||||
{
|
|
||||||
SendMessage(new SharedMicrowaveComponent.MicrowaveEjectSolidIndexedMessage(_solids[index]));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RefreshContentsDisplay(List<Solution.ReagentQuantity> reagents, List<EntityUid> solids)
|
|
||||||
{
|
{
|
||||||
_menu.IngredientsList.Clear();
|
_menu.IngredientsList.Clear();
|
||||||
foreach (var item in reagents)
|
foreach (var item in reagents)
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
using Content.Shared.Chemistry;
|
using Robust.Client.Graphics.Drawing;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Kitchen
|
namespace Content.Client.GameObjects.Components.Kitchen
|
||||||
{
|
{
|
||||||
@@ -17,18 +13,26 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
private MicrowaveBoundUserInterface Owner { get; set; }
|
private MicrowaveBoundUserInterface Owner { get; set; }
|
||||||
|
|
||||||
|
public event Action<BaseButton.ButtonEventArgs> OnCookTimeSelected;
|
||||||
|
|
||||||
|
public byte VisualCookTime { get; set; }
|
||||||
|
|
||||||
public Button StartButton { get;}
|
public Button StartButton { get;}
|
||||||
public Button EjectButton { get;}
|
public Button EjectButton { get;}
|
||||||
|
|
||||||
public GridContainer TimerButtons { get; }
|
public PanelContainer TimerFacePlate { get; }
|
||||||
|
|
||||||
|
public ButtonGroup CookTimeButtonGroup { get; }
|
||||||
|
private VBoxContainer CookTimeButtonVbox { get; }
|
||||||
|
|
||||||
public ItemList IngredientsList { get;}
|
public ItemList IngredientsList { get;}
|
||||||
|
private Label _cookTimeInfoLabel { get; }
|
||||||
|
|
||||||
public MicrowaveMenu(MicrowaveBoundUserInterface owner = null)
|
public MicrowaveMenu(MicrowaveBoundUserInterface owner = null)
|
||||||
{
|
{
|
||||||
Owner = owner;
|
Owner = owner;
|
||||||
Title = Loc.GetString("Microwave");
|
Title = Loc.GetString("Microwave");
|
||||||
var hSplit = new HSplitContainer
|
var hSplit = new HBoxContainer
|
||||||
{
|
{
|
||||||
SizeFlagsHorizontal = SizeFlags.Fill,
|
SizeFlagsHorizontal = SizeFlags.Fill,
|
||||||
SizeFlagsVertical = SizeFlags.Fill
|
SizeFlagsVertical = SizeFlags.Fill
|
||||||
@@ -37,53 +41,135 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
IngredientsList = new ItemList
|
IngredientsList = new ItemList
|
||||||
{
|
{
|
||||||
SizeFlagsVertical = SizeFlags.Expand,
|
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||||
|
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||||
SelectMode = ItemList.ItemListSelectMode.Button,
|
SelectMode = ItemList.ItemListSelectMode.Button,
|
||||||
SizeFlagsStretchRatio = 8,
|
SizeFlagsStretchRatio = 8,
|
||||||
CustomMinimumSize = (100,100)
|
CustomMinimumSize = (200,256)
|
||||||
};
|
};
|
||||||
|
|
||||||
hSplit.AddChild(IngredientsList);
|
hSplit.AddChild(IngredientsList);
|
||||||
|
|
||||||
var vSplit = new VSplitContainer();
|
var vSplit = new VBoxContainer
|
||||||
|
{
|
||||||
|
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||||
|
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||||
|
};
|
||||||
|
|
||||||
hSplit.AddChild(vSplit);
|
hSplit.AddChild(vSplit);
|
||||||
|
|
||||||
var buttonGridContainer = new GridContainer
|
var buttonGridContainer = new VBoxContainer
|
||||||
{
|
{
|
||||||
Columns = 2,
|
Align = BoxContainer.AlignMode.Center,
|
||||||
|
SizeFlagsStretchRatio = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
StartButton = new Button
|
StartButton = new Button
|
||||||
{
|
{
|
||||||
Text = Loc.GetString("START"),
|
Text = Loc.GetString("Start"),
|
||||||
|
TextAlign = Label.AlignMode.Center,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
EjectButton = new Button
|
EjectButton = new Button
|
||||||
{
|
{
|
||||||
Text = Loc.GetString("EJECT CONTENTS"),
|
Text = Loc.GetString("Eject All Contents"),
|
||||||
|
ToolTip = Loc.GetString("This vaporizes all reagents, but ejects any solids."),
|
||||||
|
TextAlign = Label.AlignMode.Center,
|
||||||
};
|
};
|
||||||
|
|
||||||
buttonGridContainer.AddChild(StartButton);
|
buttonGridContainer.AddChild(StartButton);
|
||||||
buttonGridContainer.AddChild(EjectButton);
|
buttonGridContainer.AddChild(EjectButton);
|
||||||
vSplit.AddChild(buttonGridContainer);
|
vSplit.AddChild(buttonGridContainer);
|
||||||
|
|
||||||
|
CookTimeButtonGroup = new ButtonGroup();
|
||||||
TimerButtons = new GridContainer
|
CookTimeButtonVbox = new VBoxContainer
|
||||||
{
|
{
|
||||||
Columns = 5,
|
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||||
|
Align = BoxContainer.AlignMode.Center,
|
||||||
};
|
};
|
||||||
|
|
||||||
vSplit.AddChild(TimerButtons);
|
var index = 0;
|
||||||
|
for (var i = 0; i <= 12; i++)
|
||||||
|
{
|
||||||
|
var newButton = new Button
|
||||||
|
{
|
||||||
|
Text = (index <= 0 ? 1 : index).ToString(),
|
||||||
|
TextAlign = Label.AlignMode.Center,
|
||||||
|
Group = CookTimeButtonGroup,
|
||||||
|
};
|
||||||
|
CookTimeButtonVbox.AddChild(newButton);
|
||||||
|
newButton.OnPressed += args =>
|
||||||
|
{
|
||||||
|
OnCookTimeSelected?.Invoke(args);
|
||||||
|
_cookTimeInfoLabel.Text = $"{Loc.GetString("COOK TIME")}: {VisualCookTime}";
|
||||||
|
};
|
||||||
|
index+=5;
|
||||||
|
}
|
||||||
|
|
||||||
|
_cookTimeInfoLabel = new Label
|
||||||
|
{
|
||||||
|
Text = Loc.GetString("COOK TIME:"),
|
||||||
|
Align = Label.AlignMode.Center,
|
||||||
|
Modulate = Color.White,
|
||||||
|
SizeFlagsVertical = SizeFlags.ShrinkCenter
|
||||||
|
};
|
||||||
|
|
||||||
|
var innerTimerPanel = new PanelContainer
|
||||||
|
{
|
||||||
|
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||||
|
ModulateSelfOverride = Color.Red,
|
||||||
|
CustomMinimumSize = (100, 128),
|
||||||
|
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Black},
|
||||||
|
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new VBoxContainer
|
||||||
|
{
|
||||||
|
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new PanelContainer
|
||||||
|
{
|
||||||
|
PanelOverride = new StyleBoxFlat(){BackgroundColor = Color.Red.WithAlpha(0.2f)},
|
||||||
|
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
_cookTimeInfoLabel
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
new ScrollContainer()
|
||||||
|
{
|
||||||
|
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||||
|
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
CookTimeButtonVbox,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TimerFacePlate = new PanelContainer()
|
||||||
|
{
|
||||||
|
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||||
|
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
innerTimerPanel
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
vSplit.AddChild(TimerFacePlate);
|
||||||
Contents.AddChild(hSplit);
|
Contents.AddChild(hSplit);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,19 @@
|
|||||||
using System;
|
using Content.Client.GameObjects.Components.Sound;
|
||||||
using System.Reflection.Metadata.Ecma335;
|
|
||||||
using Content.Client.GameObjects.Components.Sound;
|
|
||||||
using Content.Shared.GameObjects.Components.Power;
|
using Content.Shared.GameObjects.Components.Power;
|
||||||
using Content.Shared.GameObjects.Components.Sound;
|
using Content.Shared.GameObjects.Components.Sound;
|
||||||
using Content.Shared.Kitchen;
|
using Content.Shared.Kitchen;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Interfaces.GameObjects.Components;
|
using Robust.Client.Interfaces.GameObjects.Components;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects.Components.UserInterface;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
using YamlDotNet.RepresentationModel;
|
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Kitchen
|
namespace Content.Client.GameObjects.Components.Kitchen
|
||||||
{
|
{
|
||||||
public sealed class MicrowaveVisualizer : AppearanceVisualizer
|
public sealed class MicrowaveVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
private SoundComponent _soundComponent;
|
private SoundComponent _soundComponent;
|
||||||
private const string _microwaveSoundLoop = "/Audio/machines/microwave_loop.ogg";
|
private const string MicrowaveSoundLoop = "/Audio/machines/microwave_loop.ogg";
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
@@ -45,11 +38,15 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
var audioParams = AudioParams.Default;
|
var audioParams = AudioParams.Default;
|
||||||
audioParams.Loop = true;
|
audioParams.Loop = true;
|
||||||
var schedSound = new ScheduledSound();
|
var schedSound = new ScheduledSound();
|
||||||
schedSound.Filename = _microwaveSoundLoop;
|
schedSound.Filename = MicrowaveSoundLoop;
|
||||||
schedSound.AudioParams = audioParams;
|
schedSound.AudioParams = audioParams;
|
||||||
_soundComponent.AddScheduledSound(schedSound);
|
_soundComponent.AddScheduledSound(schedSound);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Logger.Debug($"Something terrible happened in {this}");
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var glowingPartsVisible = !(component.TryGetData(PowerDeviceVisuals.Powered, out bool powered) && !powered);
|
var glowingPartsVisible = !(component.TryGetData(PowerDeviceVisuals.Powered, out bool powered) && !powered);
|
||||||
@@ -59,7 +56,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public enum MicrowaveVisualizerLayers
|
private enum MicrowaveVisualizerLayers
|
||||||
{
|
{
|
||||||
Base,
|
Base,
|
||||||
BaseUnlit
|
BaseUnlit
|
||||||
|
|||||||
@@ -33,38 +33,55 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||||
[Dependency] private readonly IEntityManager _entityManager;
|
[Dependency] private readonly IEntityManager _entityManager;
|
||||||
[Dependency] private readonly RecipeManager _recipeManager;
|
[Dependency] private readonly RecipeManager _recipeManager;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
|
||||||
[Dependency] private readonly IServerNotifyManager _notifyManager;
|
[Dependency] private readonly IServerNotifyManager _notifyManager;
|
||||||
#pragma warning restore 649
|
#pragma warning restore 649
|
||||||
|
|
||||||
|
#region YAMLSERIALIZE
|
||||||
private int _cookTimeDefault;
|
private int _cookTimeDefault;
|
||||||
private int _cookTimeMultiplier; //For upgrades and stuff I guess?
|
private int _cookTimeMultiplier; //For upgrades and stuff I guess?
|
||||||
private string _badRecipeName;
|
private string _badRecipeName;
|
||||||
private string _startCookingSound;
|
private string _startCookingSound;
|
||||||
private string _cookingCompleteSound;
|
private string _cookingCompleteSound;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region VIEWVARIABLES
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private SolutionComponent _solution;
|
private SolutionComponent _solution;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private bool _busy = false;
|
private bool _busy = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is a fixed offset of 5.
|
||||||
|
/// The cook times for all recipes should be divisible by 5,with a minimum of 1 second.
|
||||||
|
/// For right now, I don't think any recipe cook time should be greater than 60 seconds.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables]
|
||||||
|
private byte _currentCookTimerTime { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
private bool Powered => _powerDevice.Powered;
|
private bool Powered => _powerDevice.Powered;
|
||||||
|
|
||||||
private bool HasContents => _solution.ReagentList.Count > 0 || _storage.ContainedEntities.Count > 0;
|
private bool HasContents => _solution.ReagentList.Count > 0 || _storage.ContainedEntities.Count > 0;
|
||||||
|
|
||||||
private AppearanceComponent _appearance;
|
void ISolutionChange.SolutionChanged(SolutionChangeEventArgs eventArgs) => UpdateUserInterface();
|
||||||
|
|
||||||
private AudioSystem _audioSystem;
|
private AudioSystem _audioSystem;
|
||||||
|
|
||||||
|
private AppearanceComponent _appearance;
|
||||||
private PowerDeviceComponent _powerDevice;
|
private PowerDeviceComponent _powerDevice;
|
||||||
|
|
||||||
private Container _storage;
|
private BoundUserInterface _userInterface;
|
||||||
|
|
||||||
|
private Container _storage;
|
||||||
|
/// <summary>
|
||||||
|
/// A dictionary of PrototypeIDs and integers representing quantity.
|
||||||
|
/// </summary>
|
||||||
private Dictionary<string, int> _solids;
|
private Dictionary<string, int> _solids;
|
||||||
private List<EntityUid> _solidsVisualList;
|
private List<EntityUid> _solidsVisualList;
|
||||||
|
|
||||||
private BoundUserInterface _userInterface;
|
|
||||||
void ISolutionChange.SolutionChanged(SolutionChangeEventArgs eventArgs) => UpdateUserInterface();
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
@@ -97,22 +114,40 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
private void UserInterfaceOnReceiveMessage(ServerBoundUserInterfaceMessage message)
|
private void UserInterfaceOnReceiveMessage(ServerBoundUserInterfaceMessage message)
|
||||||
{
|
{
|
||||||
if (!Powered || _busy || !HasContents) return;
|
if (!Powered || _busy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (message.Message)
|
switch (message.Message)
|
||||||
{
|
{
|
||||||
case MicrowaveStartCookMessage msg :
|
case MicrowaveStartCookMessage msg :
|
||||||
wzhzhzh();
|
if (HasContents)
|
||||||
|
{
|
||||||
|
wzhzhzh();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MicrowaveEjectMessage msg :
|
case MicrowaveEjectMessage msg :
|
||||||
VaporizeReagents();
|
if (HasContents)
|
||||||
EjectSolids();
|
{
|
||||||
UpdateUserInterface();
|
VaporizeReagents();
|
||||||
|
EjectSolids();
|
||||||
|
UpdateUserInterface();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MicrowaveEjectSolidIndexedMessage msg:
|
case MicrowaveEjectSolidIndexedMessage msg:
|
||||||
EjectIndexedSolid(msg.EntityID);
|
if (HasContents)
|
||||||
|
{
|
||||||
|
EjectSolidWithIndex(msg.EntityID);
|
||||||
|
UpdateUserInterface();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MicrowaveSelectCookTimeMessage msg:
|
||||||
|
_currentCookTimerTime = msg.newCookTime;
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -122,7 +157,10 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
private void SetAppearance(MicrowaveVisualState state)
|
private void SetAppearance(MicrowaveVisualState state)
|
||||||
{
|
{
|
||||||
if (_appearance != null || Owner.TryGetComponent(out _appearance))
|
if (_appearance != null || Owner.TryGetComponent(out _appearance))
|
||||||
|
{
|
||||||
_appearance.SetData(PowerDeviceVisuals.VisualState, state);
|
_appearance.SetData(PowerDeviceVisuals.VisualState, state);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateUserInterface()
|
private void UpdateUserInterface()
|
||||||
@@ -138,9 +176,10 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!eventArgs.User.TryGetComponent(out IActorComponent actor))
|
if (!eventArgs.User.TryGetComponent(out IActorComponent actor) || !Powered)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
if (!Powered) return;
|
}
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
_userInterface.Open(actor.playerSession);
|
_userInterface.Open(actor.playerSession);
|
||||||
|
|
||||||
@@ -177,33 +216,34 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
//Move units from attackSolution to targetSolution
|
//Move units from attackSolution to targetSolution
|
||||||
var removedSolution = attackSolution.SplitSolution(realTransferAmount);
|
var removedSolution = attackSolution.SplitSolution(realTransferAmount);
|
||||||
if (!mySolution.TryAddSolution(removedSolution))
|
if (!mySolution.TryAddSolution(removedSolution))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
_notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User,
|
_notifyManager.PopupMessage(Owner.Transform.GridPosition, eventArgs.User,
|
||||||
Loc.GetString("Transferred {0}u", removedSolution.TotalVolume));
|
Loc.GetString("Transferred {0}u", removedSolution.TotalVolume));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemEntity.TryGetComponent(typeof(FoodComponent), out var food))
|
if (!itemEntity.TryGetComponent(typeof(FoodComponent), out var food))
|
||||||
{
|
{
|
||||||
var ent = food.Owner; //Get the entity of the ItemComponent.
|
return false;
|
||||||
|
|
||||||
_storage.Insert(ent);
|
|
||||||
|
|
||||||
UpdateUserInterface();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
var ent = food.Owner; //Get the entity of the ItemComponent.
|
||||||
|
_storage.Insert(ent);
|
||||||
|
UpdateUserInterface();
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//This is required.
|
//This is required. It's 'cook'.
|
||||||
private void wzhzhzh()
|
private void wzhzhzh()
|
||||||
{
|
{
|
||||||
_busy = true;
|
_busy = true;
|
||||||
// Convert storage into Dictionary of ingredients
|
// Convert storage into Dictionary of ingredients
|
||||||
_solids.Clear();
|
_solids.Clear();
|
||||||
foreach(var item in _storage.ContainedEntities.ToList())
|
foreach(var item in _storage.ContainedEntities)
|
||||||
{
|
{
|
||||||
if(_solids.ContainsKey(item.Prototype.ID))
|
if(_solids.ContainsKey(item.Prototype.ID))
|
||||||
{
|
{
|
||||||
@@ -216,35 +256,44 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check recipes
|
// Check recipes
|
||||||
|
FoodRecipePrototype recipeToCook = null;
|
||||||
foreach(var r in _recipeManager.Recipes)
|
foreach(var r in _recipeManager.Recipes)
|
||||||
{
|
{
|
||||||
|
if (!CanSatisfyRecipe(r))
|
||||||
var success = CanSatisfyRecipe(r);
|
|
||||||
SetAppearance(MicrowaveVisualState.Cooking);
|
|
||||||
_audioSystem.Play(_startCookingSound);
|
|
||||||
var time = success ? r.CookTime : _cookTimeDefault;
|
|
||||||
Timer.Spawn(time * _cookTimeMultiplier, () =>
|
|
||||||
{
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (success)
|
recipeToCook = r;
|
||||||
{
|
|
||||||
SubtractContents(r);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
VaporizeReagents();
|
|
||||||
VaporizeSolids();
|
|
||||||
}
|
|
||||||
|
|
||||||
var entityToSpawn = success ? r.Result : _badRecipeName;
|
|
||||||
_entityManager.SpawnEntity(entityToSpawn, Owner.Transform.GridPosition);
|
|
||||||
_audioSystem.Play(_cookingCompleteSound);
|
|
||||||
SetAppearance(MicrowaveVisualState.Idle);
|
|
||||||
_busy = false;
|
|
||||||
});
|
|
||||||
UpdateUserInterface();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var goodMeal = (recipeToCook != null)
|
||||||
|
&&
|
||||||
|
(_currentCookTimerTime == (byte)recipeToCook.CookTime) ? true : false;
|
||||||
|
|
||||||
|
SetAppearance(MicrowaveVisualState.Cooking);
|
||||||
|
_audioSystem.Play(_startCookingSound);
|
||||||
|
Timer.Spawn(_currentCookTimerTime * _cookTimeMultiplier, () =>
|
||||||
|
{
|
||||||
|
|
||||||
|
if (goodMeal)
|
||||||
|
{
|
||||||
|
SubtractContents(recipeToCook);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VaporizeReagents();
|
||||||
|
VaporizeSolids();
|
||||||
|
}
|
||||||
|
|
||||||
|
var entityToSpawn = goodMeal ? recipeToCook.Result : _badRecipeName;
|
||||||
|
_entityManager.SpawnEntity(entityToSpawn, Owner.Transform.GridPosition);
|
||||||
|
_audioSystem.Play(_cookingCompleteSound);
|
||||||
|
SetAppearance(MicrowaveVisualState.Idle);
|
||||||
|
_busy = false;
|
||||||
|
});
|
||||||
|
UpdateUserInterface();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void VaporizeReagents()
|
private void VaporizeReagents()
|
||||||
@@ -257,8 +306,10 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
{
|
{
|
||||||
foreach (var item in _storage.ContainedEntities.ToList())
|
foreach (var item in _storage.ContainedEntities.ToList())
|
||||||
{
|
{
|
||||||
|
_storage.Remove(item);
|
||||||
item.Delete();
|
item.Delete();
|
||||||
}
|
}
|
||||||
|
_solids.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EjectSolids()
|
private void EjectSolids()
|
||||||
@@ -272,7 +323,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
_solids.Clear();
|
_solids.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EjectIndexedSolid(EntityUid entityID)
|
private void EjectSolidWithIndex(EntityUid entityID)
|
||||||
{
|
{
|
||||||
_storage.Remove(_entityManager.GetEntity(entityID));
|
_storage.Remove(_entityManager.GetEntity(entityID));
|
||||||
}
|
}
|
||||||
@@ -280,15 +331,27 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
private void SubtractContents(FoodRecipePrototype recipe)
|
private void SubtractContents(FoodRecipePrototype recipe)
|
||||||
{
|
{
|
||||||
foreach(var kvp in recipe.IngredientsReagents)
|
foreach(var recipeReagent in recipe.IngredientsReagents)
|
||||||
{
|
{
|
||||||
_solution.TryRemoveReagent(kvp.Key, ReagentUnit.New(kvp.Value));
|
_solution.TryRemoveReagent(recipeReagent.Key, ReagentUnit.New(recipeReagent.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var solid in recipe.IngredientsSolids)
|
foreach (var recipeSolid in recipe.IngredientsSolids)
|
||||||
{
|
{
|
||||||
_solids[solid.Key] -= solid.Value;
|
for (var i = 0; i < recipeSolid.Value; i++)
|
||||||
|
{
|
||||||
|
foreach (var item in _storage.ContainedEntities.ToList())
|
||||||
|
{
|
||||||
|
if (item.Prototype.ID == recipeSolid.Key)
|
||||||
|
{
|
||||||
|
_storage.Remove(item);
|
||||||
|
item.Delete();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanSatisfyRecipe(FoodRecipePrototype recipe)
|
private bool CanSatisfyRecipe(FoodRecipePrototype recipe)
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ using Content.Shared.Chemistry;
|
|||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.GameObjects.Components;
|
|
||||||
using Robust.Shared.GameObjects.Components.UserInterface;
|
using Robust.Shared.GameObjects.Components.UserInterface;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Content.Shared.Kitchen
|
namespace Content.Shared.Kitchen
|
||||||
{
|
{
|
||||||
@@ -44,8 +41,19 @@ namespace Content.Shared.Kitchen
|
|||||||
EntityID = entityID;
|
EntityID = entityID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public class MicrowaveSelectCookTimeMessage : BoundUserInterfaceMessage
|
||||||
|
{
|
||||||
|
public byte newCookTime;
|
||||||
|
public MicrowaveSelectCookTimeMessage(byte newTime)
|
||||||
|
{
|
||||||
|
newCookTime = newTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[NetSerializable, Serializable]
|
[NetSerializable, Serializable]
|
||||||
public class MicrowaveUpdateUserInterfaceState : BoundUserInterfaceState
|
public class MicrowaveUpdateUserInterfaceState : BoundUserInterfaceState
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2865,3 +2865,20 @@
|
|||||||
sprite: Objects/Food/xenomeatpie.rsi
|
sprite: Objects/Food/xenomeatpie.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
sprite: Objects/Food/xenomeatpie.rsi
|
sprite: Objects/Food/xenomeatpie.rsi
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
parent: FoodBase
|
||||||
|
id: DisgustingSweptSoup
|
||||||
|
name: Salty Sweet Miso Cola Soup
|
||||||
|
description: Jesus christ.
|
||||||
|
components:
|
||||||
|
- type: Food
|
||||||
|
contents:
|
||||||
|
reagents:
|
||||||
|
- ReagentId: chem.Bleach
|
||||||
|
Quantity: 15
|
||||||
|
spawn_on_finish: TrashSnackBowl
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Objects/Food/stew.rsi
|
||||||
|
- type: Icon
|
||||||
|
sprite: Objects/Food/stew.rsi
|
||||||
|
|||||||
@@ -2,10 +2,20 @@
|
|||||||
id: RecipeCheeseburger
|
id: RecipeCheeseburger
|
||||||
name: Cheeseburger Recipe
|
name: Cheeseburger Recipe
|
||||||
result: FoodCheeseburger
|
result: FoodCheeseburger
|
||||||
time: 1
|
time: 5
|
||||||
reagents:
|
reagents:
|
||||||
chem.H2O: 15
|
chem.Nutriment: 10
|
||||||
chem.Nutriment: 5
|
|
||||||
solids:
|
solids:
|
||||||
Food4NoRaisins: 2
|
FoodBreadSlice: 2
|
||||||
|
|
||||||
|
|
||||||
|
- type: microwaveMealRecipe
|
||||||
|
id: RecipeMisoColaSoup
|
||||||
|
name: Salty Sweet MisoCola Soup Recipe
|
||||||
|
result: DisgustingSweptSoup
|
||||||
|
time: 15
|
||||||
|
reagents:
|
||||||
|
chem.Cola: 5
|
||||||
|
solids:
|
||||||
|
FoodMiloSoup: 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user