Merge pull request #892 from FL-OZ/microwave_hot_fix
This commit is contained in:
@@ -27,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
public MicrowaveBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner,uiKey)
|
public MicrowaveBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner,uiKey)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Open()
|
protected override void Open()
|
||||||
@@ -39,9 +39,9 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
_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 =>
|
_menu.IngredientsList.OnItemSelected += args =>
|
||||||
{
|
{
|
||||||
SendMessage(new SharedMicrowaveComponent.MicrowaveEjectSolidIndexedMessage(_solids[args.ItemIndex]));
|
SendMessage(new SharedMicrowaveComponent.MicrowaveEjectSolidIndexedMessage(_solids[args.ItemIndex]));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_menu.IngredientsListReagents.OnItemSelected += args =>
|
_menu.IngredientsListReagents.OnItemSelected += args =>
|
||||||
@@ -49,7 +49,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
SendMessage(
|
SendMessage(
|
||||||
new SharedMicrowaveComponent.MicrowaveVaporizeReagentIndexedMessage(_reagents[args.ItemIndex]));
|
new SharedMicrowaveComponent.MicrowaveVaporizeReagentIndexedMessage(_reagents[args.ItemIndex]));
|
||||||
};
|
};
|
||||||
|
|
||||||
_menu.OnCookTimeSelected += args =>
|
_menu.OnCookTimeSelected += args =>
|
||||||
{
|
{
|
||||||
var actualButton = args.Button as Button;
|
var actualButton = args.Button as Button;
|
||||||
@@ -80,6 +80,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_menu.ToggleBusyDisableOverlayPanel(cstate.IsMicrowaveBusy);
|
||||||
RefreshContentsDisplay(cstate.ReagentsReagents, cstate.ContainedSolids);
|
RefreshContentsDisplay(cstate.ReagentsReagents, cstate.ContainedSolids);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -101,9 +102,12 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
_menu.IngredientsList.Clear();
|
_menu.IngredientsList.Clear();
|
||||||
foreach (var entityID in solids)
|
foreach (var entityID in solids)
|
||||||
{
|
{
|
||||||
var entity = _entityManager.GetEntity(entityID);
|
if (!_entityManager.TryGetEntity(entityID, out var entity))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (entity.TryGetComponent(out IconComponent icon))
|
if (!entity.Deleted && entity.TryGetComponent(out IconComponent icon))
|
||||||
{
|
{
|
||||||
var solidItem = _menu.IngredientsList.AddItem(entity.Name, icon.Icon.Default);
|
var solidItem = _menu.IngredientsList.AddItem(entity.Name, icon.Icon.Default);
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
public ButtonGroup CookTimeButtonGroup { get; }
|
public ButtonGroup CookTimeButtonGroup { get; }
|
||||||
private VBoxContainer CookTimeButtonVbox { get; }
|
private VBoxContainer CookTimeButtonVbox { get; }
|
||||||
|
|
||||||
|
private VBoxContainer ButtonGridContainer { get; }
|
||||||
|
|
||||||
|
private PanelContainer DisableCookingPanelOverlay { get;}
|
||||||
|
|
||||||
|
|
||||||
public ItemList IngredientsList { get;}
|
public ItemList IngredientsList { get;}
|
||||||
|
|
||||||
public ItemList IngredientsListReagents { get; }
|
public ItemList IngredientsListReagents { get; }
|
||||||
@@ -35,6 +40,16 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
{
|
{
|
||||||
Owner = owner;
|
Owner = owner;
|
||||||
Title = Loc.GetString("Microwave");
|
Title = Loc.GetString("Microwave");
|
||||||
|
DisableCookingPanelOverlay = new PanelContainer
|
||||||
|
{
|
||||||
|
MouseFilter = MouseFilterMode.Stop,
|
||||||
|
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.60f)},
|
||||||
|
SizeFlagsHorizontal = SizeFlags.Fill,
|
||||||
|
SizeFlagsVertical = SizeFlags.Fill,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
var hSplit = new HBoxContainer
|
var hSplit = new HBoxContainer
|
||||||
{
|
{
|
||||||
SizeFlagsHorizontal = SizeFlags.Fill,
|
SizeFlagsHorizontal = SizeFlags.Fill,
|
||||||
@@ -58,14 +73,14 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
SizeFlagsStretchRatio = 2,
|
SizeFlagsStretchRatio = 2,
|
||||||
CustomMinimumSize = (100,128)
|
CustomMinimumSize = (100,128)
|
||||||
};
|
};
|
||||||
|
|
||||||
hSplit.AddChild(IngredientsListReagents);
|
hSplit.AddChild(IngredientsListReagents);
|
||||||
//Padding between the lists.
|
//Padding between the lists.
|
||||||
hSplit.AddChild(new Control
|
hSplit.AddChild(new Control
|
||||||
{
|
{
|
||||||
CustomMinimumSize = (0,5),
|
CustomMinimumSize = (0,5),
|
||||||
});
|
});
|
||||||
|
|
||||||
hSplit.AddChild(IngredientsList);
|
hSplit.AddChild(IngredientsList);
|
||||||
|
|
||||||
var vSplit = new VBoxContainer
|
var vSplit = new VBoxContainer
|
||||||
@@ -76,7 +91,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
hSplit.AddChild(vSplit);
|
hSplit.AddChild(vSplit);
|
||||||
|
|
||||||
var buttonGridContainer = new VBoxContainer
|
ButtonGridContainer = new VBoxContainer
|
||||||
{
|
{
|
||||||
Align = BoxContainer.AlignMode.Center,
|
Align = BoxContainer.AlignMode.Center,
|
||||||
SizeFlagsStretchRatio = 3
|
SizeFlagsStretchRatio = 3
|
||||||
@@ -96,10 +111,10 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
TextAlign = Label.AlignMode.Center,
|
TextAlign = Label.AlignMode.Center,
|
||||||
};
|
};
|
||||||
|
|
||||||
buttonGridContainer.AddChild(StartButton);
|
ButtonGridContainer.AddChild(StartButton);
|
||||||
buttonGridContainer.AddChild(EjectButton);
|
ButtonGridContainer.AddChild(EjectButton);
|
||||||
vSplit.AddChild(buttonGridContainer);
|
vSplit.AddChild(ButtonGridContainer);
|
||||||
|
|
||||||
//Padding
|
//Padding
|
||||||
vSplit.AddChild(new Control
|
vSplit.AddChild(new Control
|
||||||
{
|
{
|
||||||
@@ -114,6 +129,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
Align = BoxContainer.AlignMode.Center,
|
Align = BoxContainer.AlignMode.Center,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
for (var i = 0; i <= 12; i++)
|
for (var i = 0; i <= 12; i++)
|
||||||
{
|
{
|
||||||
@@ -134,7 +150,8 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
var cookTimeOneSecondButton = (Button)CookTimeButtonVbox.GetChild(0);
|
var cookTimeOneSecondButton = (Button)CookTimeButtonVbox.GetChild(0);
|
||||||
cookTimeOneSecondButton.Pressed = true;
|
cookTimeOneSecondButton.Pressed = true;
|
||||||
|
|
||||||
|
|
||||||
_cookTimeInfoLabel = new Label
|
_cookTimeInfoLabel = new Label
|
||||||
{
|
{
|
||||||
Text = Loc.GetString($"COOK TIME: {VisualCookTime}"),
|
Text = Loc.GetString($"COOK TIME: {VisualCookTime}"),
|
||||||
@@ -158,7 +175,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
Children =
|
Children =
|
||||||
{
|
{
|
||||||
|
|
||||||
new PanelContainer
|
new PanelContainer
|
||||||
{
|
{
|
||||||
PanelOverride = new StyleBoxFlat(){BackgroundColor = Color.Gray.WithAlpha(0.2f)},
|
PanelOverride = new StyleBoxFlat(){BackgroundColor = Color.Gray.WithAlpha(0.2f)},
|
||||||
@@ -199,8 +216,15 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
vSplit.AddChild(TimerFacePlate);
|
vSplit.AddChild(TimerFacePlate);
|
||||||
Contents.AddChild(hSplit);
|
Contents.AddChild(hSplit);
|
||||||
|
Contents.AddChild(DisableCookingPanelOverlay);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ToggleBusyDisableOverlayPanel(bool shouldDisable)
|
||||||
|
{
|
||||||
|
DisableCookingPanelOverlay.Visible = shouldDisable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,9 @@ using Robust.Server.GameObjects.Components.Container;
|
|||||||
using Content.Server.GameObjects.Components.Power;
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using YamlDotNet.Serialization.NodeTypeResolvers;
|
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Kitchen
|
namespace Content.Server.GameObjects.Components.Kitchen
|
||||||
{
|
{
|
||||||
@@ -76,7 +74,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
private BoundUserInterface _userInterface;
|
private BoundUserInterface _userInterface;
|
||||||
|
|
||||||
private Container _storage;
|
private Container _storage;
|
||||||
|
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
@@ -101,7 +99,6 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
_audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
_audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
||||||
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>()
|
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>()
|
||||||
.GetBoundUserInterface(MicrowaveUiKey.Key);
|
.GetBoundUserInterface(MicrowaveUiKey.Key);
|
||||||
|
|
||||||
_userInterface.OnReceiveMessage += UserInterfaceOnReceiveMessage;
|
_userInterface.OnReceiveMessage += UserInterfaceOnReceiveMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +134,6 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MicrowaveVaporizeReagentIndexedMessage msg:
|
case MicrowaveVaporizeReagentIndexedMessage msg:
|
||||||
if (HasContents)
|
if (HasContents)
|
||||||
{
|
{
|
||||||
@@ -146,7 +142,6 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MicrowaveSelectCookTimeMessage msg:
|
case MicrowaveSelectCookTimeMessage msg:
|
||||||
_currentCookTimerTime = msg.newCookTime;
|
_currentCookTimerTime = msg.newCookTime;
|
||||||
ClickSound();
|
ClickSound();
|
||||||
@@ -173,7 +168,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
solidsVisualList.Add(item.Uid);
|
solidsVisualList.Add(item.Uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
_userInterface.SetState(new MicrowaveUpdateUserInterfaceState(_solution.Solution.Contents, solidsVisualList));
|
_userInterface.SetState(new MicrowaveUpdateUserInterfaceState(_solution.Solution.Contents, solidsVisualList, _busy));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||||
@@ -246,7 +241,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_busy = true;
|
_busy = true;
|
||||||
// Convert storage into Dictionary of ingredients
|
// Convert storage into Dictionary of ingredients
|
||||||
var solidsDict = new Dictionary<string, int>();
|
var solidsDict = new Dictionary<string, int>();
|
||||||
@@ -279,7 +274,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
(_currentCookTimerTime == (uint)recipeToCook.CookTime) ? true : false;
|
(_currentCookTimerTime == (uint)recipeToCook.CookTime) ? true : false;
|
||||||
|
|
||||||
SetAppearance(MicrowaveVisualState.Cooking);
|
SetAppearance(MicrowaveVisualState.Cooking);
|
||||||
_audioSystem.Play(_startCookingSound);
|
_audioSystem.Play(_startCookingSound, AudioParams.Default);
|
||||||
Timer.Spawn((int)(_currentCookTimerTime * _cookTimeMultiplier), () =>
|
Timer.Spawn((int)(_currentCookTimerTime * _cookTimeMultiplier), () =>
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -295,12 +290,12 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
var entityToSpawn = goodMeal ? recipeToCook.Result : _badRecipeName;
|
var entityToSpawn = goodMeal ? recipeToCook.Result : _badRecipeName;
|
||||||
_entityManager.SpawnEntity(entityToSpawn, Owner.Transform.GridPosition);
|
_entityManager.SpawnEntity(entityToSpawn, Owner.Transform.GridPosition);
|
||||||
_audioSystem.Play(_cookingCompleteSound);
|
_audioSystem.Play(_cookingCompleteSound, AudioParams.Default);
|
||||||
SetAppearance(MicrowaveVisualState.Idle);
|
SetAppearance(MicrowaveVisualState.Idle);
|
||||||
_busy = false;
|
_busy = false;
|
||||||
|
UpdateUserInterface();
|
||||||
});
|
});
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void VaporizeReagents()
|
private void VaporizeReagents()
|
||||||
@@ -396,12 +391,12 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClickSound()
|
private void ClickSound()
|
||||||
{
|
{
|
||||||
|
|
||||||
_audioSystem.Play("/Audio/machines/machine_switch.ogg", AudioParams.Default.WithVolume(-2f));
|
_audioSystem.Play("/Audio/machines/machine_switch.ogg", AudioParams.Default.WithVolume(-2f));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Content.Shared.Kitchen
|
|||||||
EntityID = entityID;
|
EntityID = entityID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public class MicrowaveVaporizeReagentIndexedMessage : BoundUserInterfaceMessage
|
public class MicrowaveVaporizeReagentIndexedMessage : BoundUserInterfaceMessage
|
||||||
{
|
{
|
||||||
@@ -70,10 +70,12 @@ namespace Content.Shared.Kitchen
|
|||||||
{
|
{
|
||||||
public readonly IReadOnlyList<Solution.ReagentQuantity> ReagentsReagents;
|
public readonly IReadOnlyList<Solution.ReagentQuantity> ReagentsReagents;
|
||||||
public readonly List<EntityUid> ContainedSolids;
|
public readonly List<EntityUid> ContainedSolids;
|
||||||
public MicrowaveUpdateUserInterfaceState(IReadOnlyList<Solution.ReagentQuantity> reagents, List<EntityUid> solids)
|
public bool IsMicrowaveBusy;
|
||||||
|
public MicrowaveUpdateUserInterfaceState(IReadOnlyList<Solution.ReagentQuantity> reagents, List<EntityUid> solids, bool busyStatus)
|
||||||
{
|
{
|
||||||
ReagentsReagents = reagents;
|
ReagentsReagents = reagents;
|
||||||
ContainedSolids = solids;
|
ContainedSolids = solids;
|
||||||
|
IsMicrowaveBusy = busyStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user