forked from DeltaV-Station/Delta-v
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
214 changed files
with
4,283 additions
and
228 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
Content.Client/Nyanotrasen/Kitchen/Components/DeepFriedComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Content.Shared.Kitchen.Components; | ||
|
||
namespace Content.Client.Kitchen.Components | ||
{ | ||
[RegisterComponent] | ||
//Unnecessary item: [ComponentReference(typeof(SharedDeepFriedComponent))] | ||
public sealed partial class DeepFriedComponent : SharedDeepFriedComponent | ||
{ | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
Content.Client/Nyanotrasen/Kitchen/Components/DeepFryerComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Content.Shared.Kitchen.Components; | ||
|
||
namespace Content.Client.Kitchen.Components | ||
{ | ||
[RegisterComponent] | ||
// Unnecessary line: [ComponentReference(typeof(SharedDeepFryerComponent))] | ||
public sealed partial class DeepFryerComponent : SharedDeepFryerComponent | ||
{ | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
Content.Client/Nyanotrasen/Kitchen/UI/DeepFryerBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using Robust.Client.GameObjects; | ||
using Content.Shared.Kitchen.UI; | ||
|
||
namespace Content.Client.Nyanotrasen.Kitchen.UI | ||
{ | ||
public sealed class DeepFryerBoundUserInterface : BoundUserInterface | ||
{ | ||
private DeepFryerWindow? _window; | ||
|
||
private NetEntity[] _entities = default!; | ||
|
||
public DeepFryerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
base.Open(); | ||
_window = new DeepFryerWindow(); | ||
_window.OnClose += Close; | ||
_window.ItemList.OnItemSelected += args => | ||
{ | ||
SendMessage(new DeepFryerRemoveItemMessage(_entities[args.ItemIndex])); | ||
}; | ||
_window.InsertItem.OnPressed += _ => | ||
{ | ||
SendMessage(new DeepFryerInsertItemMessage()); | ||
}; | ||
_window.ScoopVat.OnPressed += _ => | ||
{ | ||
SendMessage(new DeepFryerScoopVatMessage()); | ||
}; | ||
_window.ClearSlag.OnPressed += args => | ||
{ | ||
SendMessage(new DeepFryerClearSlagMessage()); | ||
}; | ||
_window.RemoveAllItems.OnPressed += _ => | ||
{ | ||
SendMessage(new DeepFryerRemoveAllItemsMessage()); | ||
}; | ||
_window.OpenCentered(); | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
|
||
if (_window == null) | ||
return; | ||
|
||
if (state is not DeepFryerBoundUserInterfaceState cast) | ||
return; | ||
|
||
_entities = cast.ContainedEntities; | ||
_window.UpdateState(cast); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
|
||
if (!disposing) | ||
return; | ||
|
||
_window?.Dispose(); | ||
} | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
Content.Client/Nyanotrasen/Kitchen/UI/DeepFryerWindow.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<DefaultWindow xmlns="https://spacestation14.io" | ||
Title="{Loc 'deep-fryer-window-title'}" | ||
MinSize="600 400" | ||
> | ||
<BoxContainer Orientation="Horizontal" VerticalExpand="True"> | ||
<BoxContainer | ||
Orientation="Vertical" | ||
HorizontalExpand="True" | ||
> | ||
<Label | ||
Text="{Loc 'deep-fryer-label-baskets'}" | ||
Align="Left"/> | ||
<ItemList Name="ItemList" | ||
Access="Public" | ||
VerticalExpand="True" | ||
HorizontalExpand="True" | ||
SelectMode="Button"> | ||
</ItemList> | ||
</BoxContainer> | ||
<BoxContainer | ||
Orientation="Vertical" | ||
Margin="8 0" | ||
MinSize="200 0" | ||
> | ||
<Label Text="{Loc 'deep-fryer-label-oil-level'}"/> | ||
<ProgressBar Name="OilLevel" | ||
HorizontalExpand="True" | ||
MinValue="0" | ||
MaxValue="1" | ||
Page="0" | ||
Value="1"> | ||
</ProgressBar> | ||
<Label Text="{Loc 'deep-fryer-label-oil-purity'}"/> | ||
<ProgressBar Name="OilPurity" | ||
HorizontalExpand="True" | ||
MinValue="0" | ||
MaxValue="1" | ||
Page="0" | ||
Value="1"> | ||
</ProgressBar> | ||
<Button Name="InsertItem" | ||
Access="Public" | ||
TextAlign="Center" | ||
HorizontalExpand="True" | ||
Text="{Loc 'deep-fryer-button-insert-item'}" | ||
ToolTip="{Loc 'deep-fryer-button-insert-item-tooltip'}"/> | ||
<Button Name="ScoopVat" | ||
Access="Public" | ||
TextAlign="Center" | ||
HorizontalExpand="True" | ||
Text="{Loc 'deep-fryer-button-scoop-vat'}" | ||
ToolTip="{Loc 'deep-fryer-button-scoop-vat-tooltip'}"/> | ||
<Button Name="ClearSlag" | ||
Access="Public" | ||
TextAlign="Center" | ||
HorizontalExpand="True" | ||
Text="{Loc 'deep-fryer-button-clear-slag'}" | ||
ToolTip="{Loc 'deep-fryer-button-clear-slag-tooltip'}"/> | ||
<Button Name="RemoveAllItems" | ||
Access="Public" | ||
TextAlign="Center" | ||
HorizontalExpand="True" | ||
Text="{Loc 'deep-fryer-button-remove-all-items'}" | ||
ToolTip="{Loc 'deep-fryer-button-remove-all-items-tooltip'}"/> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</DefaultWindow> |
71 changes: 71 additions & 0 deletions
71
Content.Client/Nyanotrasen/Kitchen/UI/DeepFryerWindow.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Content.Shared.Kitchen.UI; | ||
|
||
namespace Content.Client.Nyanotrasen.Kitchen.UI | ||
{ | ||
[GenerateTypedNameReferences] | ||
[Access(typeof(DeepFryerBoundUserInterface))] | ||
public sealed partial class DeepFryerWindow : DefaultWindow | ||
{ | ||
[Dependency] private readonly IEntityManager _entityManager = default!; | ||
|
||
private static readonly Color WarningColor = Color.FromHsv(new Vector4(0.0f, 1.0f, 0.8f, 1.0f)); | ||
|
||
public DeepFryerWindow() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
IoCManager.InjectDependencies(this); | ||
} | ||
|
||
public void UpdateState(DeepFryerBoundUserInterfaceState state) | ||
{ | ||
OilLevel.Value = (float) state.OilLevel; | ||
OilPurity.Value = (float) state.OilPurity; | ||
|
||
if (state.OilPurity < state.FryingOilThreshold) | ||
{ | ||
if (OilPurity.ForegroundStyleBoxOverride == null) | ||
{ | ||
OilPurity.ForegroundStyleBoxOverride = new StyleBoxFlat(); | ||
|
||
var oilPurityStyle = (StyleBoxFlat) OilPurity.ForegroundStyleBoxOverride; | ||
oilPurityStyle.BackgroundColor = WarningColor; | ||
} | ||
} | ||
else | ||
{ | ||
OilPurity.ForegroundStyleBoxOverride = null; | ||
} | ||
|
||
ItemList.Clear(); | ||
|
||
foreach (var netEntity in state.ContainedEntities) | ||
{ | ||
var entity = _entityManager.GetEntity(netEntity); | ||
if (_entityManager.Deleted(entity)) | ||
continue; | ||
|
||
// Duplicated from MicrowaveBoundUserInterface.cs: keep an eye on that file for when it changes. | ||
Texture? texture; | ||
if (_entityManager.TryGetComponent(entity, out IconComponent? iconComponent)) | ||
{ | ||
texture = _entityManager.System<SpriteSystem>().GetIcon(iconComponent); | ||
} | ||
else if (_entityManager.TryGetComponent(entity, out SpriteComponent? spriteComponent)) | ||
{ | ||
texture = spriteComponent.Icon?.Default; | ||
} | ||
else | ||
{ | ||
continue; | ||
} | ||
|
||
ItemList.AddItem(_entityManager.GetComponent<MetaDataComponent>(entity).EntityName, texture); | ||
} | ||
} | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
Content.Client/Nyanotrasen/Kitchen/Visualizers/DeepFriedVisualizer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System.Linq; | ||
using Robust.Client.GameObjects; | ||
using static Robust.Client.GameObjects.SpriteComponent; | ||
using Content.Client.Kitchen.Components; | ||
using Content.Shared.Clothing; | ||
using Content.Shared.Hands; | ||
using Content.Shared.Kitchen.Components; | ||
|
||
namespace Content.Client.Kitchen.Visualizers | ||
{ | ||
public sealed class DeepFriedVisualizerSystem : VisualizerSystem<DeepFriedComponent> | ||
{ | ||
private readonly static string ShaderName = "Crispy"; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<DeepFriedComponent, HeldVisualsUpdatedEvent>(OnHeldVisualsUpdated); | ||
SubscribeLocalEvent<DeepFriedComponent, EquipmentVisualsUpdatedEvent>(OnEquipmentVisualsUpdated); | ||
} | ||
|
||
protected override void OnAppearanceChange(EntityUid uid, DeepFriedComponent component, ref AppearanceChangeEvent args) | ||
{ | ||
if (args.Sprite == null) | ||
return; | ||
|
||
if (!args.Component.TryGetData(DeepFriedVisuals.Fried, out bool isFried)) | ||
return; | ||
|
||
for (var i = 0; i < args.Sprite.AllLayers.Count(); ++i) | ||
args.Sprite.LayerSetShader(i, ShaderName); | ||
} | ||
|
||
private void OnHeldVisualsUpdated(EntityUid uid, DeepFriedComponent component, HeldVisualsUpdatedEvent args) | ||
{ | ||
if (args.RevealedLayers.Count == 0) | ||
{ | ||
return; | ||
} | ||
|
||
if (!TryComp(args.User, out SpriteComponent? sprite)) | ||
return; | ||
|
||
foreach (var key in args.RevealedLayers) | ||
{ | ||
if (!sprite.LayerMapTryGet(key, out var index) || sprite[index] is not Layer layer) | ||
continue; | ||
|
||
sprite.LayerSetShader(index, ShaderName); | ||
} | ||
} | ||
|
||
private void OnEquipmentVisualsUpdated(EntityUid uid, DeepFriedComponent component, EquipmentVisualsUpdatedEvent args) | ||
{ | ||
if (args.RevealedLayers.Count == 0) | ||
{ | ||
return; | ||
} | ||
|
||
if (!TryComp(args.Equipee, out SpriteComponent? sprite)) | ||
return; | ||
|
||
foreach (var key in args.RevealedLayers) | ||
{ | ||
if (!sprite.LayerMapTryGet(key, out var index) || sprite[index] is not Layer layer) | ||
continue; | ||
|
||
sprite.LayerSetShader(index, ShaderName); | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
Content.Client/Nyanotrasen/Kitchen/Visualizers/DeepFryerVisualizer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Robust.Client.GameObjects; | ||
using Content.Client.Chemistry.Visualizers; | ||
using Content.Client.Kitchen.Components; | ||
using Content.Shared.Kitchen.Components; | ||
|
||
namespace Content.Client.Kitchen.Visualizers | ||
{ | ||
public sealed class DeepFryerVisualizerSystem : VisualizerSystem<DeepFryerComponent> | ||
{ | ||
protected override void OnAppearanceChange(EntityUid uid, DeepFryerComponent component, ref AppearanceChangeEvent args) | ||
{ | ||
if (!args.Component.TryGetData(DeepFryerVisuals.Bubbling, out bool isBubbling) || | ||
!TryComp<SolutionContainerVisualsComponent>(uid, out var scvComponent)) | ||
{ | ||
return; | ||
} | ||
|
||
scvComponent.FillBaseName = isBubbling ? "on-" : "off-"; | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Content.Client/Nyanotrasen/Players/PlayTimeTracking/JobRequirementsManager.Whitelist.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using Content.Shared.CCVar; | ||
using Content.Shared.Players.PlayTimeTracking; | ||
using Content.Shared.Roles; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Client.Players.PlayTimeTracking; | ||
|
||
public sealed partial class JobRequirementsManager | ||
{ | ||
private bool _whitelisted = false; | ||
|
||
private void RxWhitelist(MsgWhitelist message) | ||
{ | ||
_whitelisted = message.Whitelisted; | ||
} | ||
|
||
public bool IsWhitelisted() | ||
{ | ||
return _whitelisted; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.