Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
blackknight954 committed Nov 1, 2024
2 parents 8212ab6 + 9c6023f commit 94d2550
Show file tree
Hide file tree
Showing 308 changed files with 11,196 additions and 3,592 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Guidebook/DocumentParsingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void Initialize()
.Assert(_tagControlParsers.ContainsKey, tag => $"unknown tag: {tag}")
.Bind(tag => _tagControlParsers[tag]);

_controlParser = OneOf(_tagParser, TryHeaderControl, ListControlParser, TextControlParser)
_controlParser = OneOf(_tagParser, TryHeaderControl, TryListControl, TextControlParser) // Frontier: ListControlParser<TryListControl
.Before(SkipWhitespaces);

foreach (var typ in _reflectionManager.GetAllChildren<IDocumentTag>())
Expand Down
17 changes: 17 additions & 0 deletions Content.Client/Guidebook/DocumentParsingManager.static.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Content.Client.Guidebook;
public sealed partial class DocumentParsingManager
{
private const string ListBullet = " › ";
private const string SublistBullet = " • "; // Frontier

// Parser that consumes a - and then just parses normal rich text with some prefix text (a bullet point).
private static readonly Parser<char, char> TryEscapedChar = Try(Char('\\')
Expand Down Expand Up @@ -123,6 +124,22 @@ public sealed partial class DocumentParsingManager
.Cast<Control>())
.Labelled("list");

// Frontier: sublists - should duplicate ListControlParser but for more hyphens, and print out more spaces before your list character
private static readonly Parser<char, Control> SublistControlParser = Try(String("--"))
.Then(SkipWhitespaces)
.Then(Map(
control => new BoxContainer
{
Children = { new Label { Text = SublistBullet, VerticalAlignment = VAlignment.Top }, control },
Orientation = LayoutOrientation.Horizontal
},
TextControlParser)
.Cast<Control>())
.Labelled("sublist");

private static readonly Parser<char, Control> TryListControl = OneOf(SublistControlParser, ListControlParser);
// End Frontier: sublists

#region Text Parsing

#region Basic Text Parsing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Content.Shared.Kitchen.Components;
using Content.Shared.Nyanotrasen.Kitchen.Components;

namespace Content.Client.Kitchen.Components
namespace Content.Client.Nyanotrasen.Kitchen.Components
{
[RegisterComponent]
//Unnecessary item: [ComponentReference(typeof(SharedDeepFriedComponent))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@
using Content.Client.Kitchen.Components;
using Content.Shared.Clothing;
using Content.Shared.Hands;
using Content.Shared.Kitchen.Components;
using Content.Shared.Nyanotrasen.Kitchen.Components;
using Robust.Shared.Prototypes;
using Content.Shared.Nyanotrasen.Kitchen.Prototypes;
using Content.Client.Nyanotrasen.Kitchen.Components;

namespace Content.Client.Kitchen.Visualizers
{
public sealed class DeepFriedVisualizerSystem : VisualizerSystem<DeepFriedComponent>
{
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
private readonly static string ShaderName = "Crispy";
[Dependency] private readonly IPrototypeManager _prototype = default!;

private const string FriedShader = "Crispy";
private const string SpectralShader = "Spectral";

public override void Initialize()
{
Expand All @@ -27,11 +32,14 @@ protected override void OnAppearanceChange(EntityUid uid, DeepFriedComponent com
if (args.Sprite == null)
return;

if (!_appearance.TryGetData(uid, DeepFriedVisuals.Fried, out bool isFried, args.Component))
// Frontier: get shader to use
var shader = GetDeepFriedEntityShader(uid, args.Component);
if (shader == null)
return;
// End Frontier

for (var i = 0; i < args.Sprite.AllLayers.Count(); ++i)
args.Sprite.LayerSetShader(i, ShaderName);
args.Sprite.LayerSetShader(i, shader); // Frontier: ShaderName<crispinessLevels.Shader
}

private void OnHeldVisualsUpdated(EntityUid uid, DeepFriedComponent component, HeldVisualsUpdatedEvent args)
Expand All @@ -44,12 +52,18 @@ private void OnHeldVisualsUpdated(EntityUid uid, DeepFriedComponent component, H
if (!TryComp(args.User, out SpriteComponent? sprite))
return;

// Frontier: get shader to use
var shader = GetDeepFriedEntityShader(uid);
if (shader == null)
return;
// End Frontier

foreach (var key in args.RevealedLayers)
{
if (!sprite.LayerMapTryGet(key, out var index) || sprite[index] is not Layer layer)
continue;

sprite.LayerSetShader(index, ShaderName);
sprite.LayerSetShader(index, shader); // Frontier: ShaderName<shader
}
}

Expand All @@ -63,13 +77,32 @@ private void OnEquipmentVisualsUpdated(EntityUid uid, DeepFriedComponent compone
if (!TryComp(args.Equipee, out SpriteComponent? sprite))
return;

// Frontier: get shader to use
var shader = GetDeepFriedEntityShader(uid);
if (shader == null)
return;
// End Frontier

foreach (var key in args.RevealedLayers)
{
if (!sprite.LayerMapTryGet(key, out var index) || sprite[index] is not Layer layer)
continue;

sprite.LayerSetShader(index, ShaderName);
sprite.LayerSetShader(index, shader); // Frontier: ShaderName<shader
}
}

private string? GetDeepFriedEntityShader(EntityUid uid, AppearanceComponent? comp = null)
{
if (comp == null && !TryComp(uid, out comp))
return null;

string? shader = null;
if (_appearance.TryGetData(uid, DeepFriedVisuals.Fried, out bool isFried, comp) && isFried)
shader = FriedShader;
else if (_appearance.TryGetData(uid, DeepFriedVisuals.Spectral, out bool isSpectral, comp) && isSpectral)
shader = SpectralShader;
return shader;
}
}
}
3 changes: 2 additions & 1 deletion Content.Client/Salvage/UI/SalvageExpeditionWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Shared.CCVar;
using Content.Shared._NF.CCVar; // Frontier
using Content.Shared.Parallax.Biomes;
using Content.Shared.Salvage;
using Content.Shared.Salvage.Expeditions;
Expand Down Expand Up @@ -303,7 +304,7 @@ protected override void FrameUpdate(FrameEventArgs args)
else
{
var cooldown = _cooldown
? TimeSpan.FromSeconds(_cfgManager.GetCVar(CCVars.SalvageExpeditionFailedCooldown))
? TimeSpan.FromSeconds(_cfgManager.GetCVar(NFCCVars.SalvageExpeditionFailedCooldown))
: TimeSpan.FromSeconds(_cfgManager.GetCVar(CCVars.SalvageExpeditionCooldown));

NextOfferBar.Value = 1f - (float) (remaining / cooldown);
Expand Down
21 changes: 21 additions & 0 deletions Content.Client/_NF/Guidebook/Controls/GuideMedicalComposition.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<BoxContainer xmlns="https://spacestation14.io"
Orientation="Horizontal"
HorizontalAlignment="Stretch"
HorizontalExpand="True"
Margin="0 0 0 5">
<BoxContainer Name="ReactantsContainer" Orientation="Vertical" HorizontalExpand="True" VerticalAlignment="Center">
<Label Name="ReagentLabel"
HorizontalExpand="True"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Access="Public"
Margin="25 0 0 0"/> <!-- Frontier: left margin 2<25 - matches reagent plant metabolism's stacked margins with GuideFoodEmbed -->
</BoxContainer>
<BoxContainer Orientation="Vertical" VerticalAlignment="Center">
<Label Name="AmountLabel"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Access="Public"
Margin="10 0 0 0"/> <!-- Frontier: left margin 2<10 -->
</BoxContainer>
</BoxContainer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Content.Client.Guidebook.Controls;
using Content.Client.UserInterface.ControlExtensions;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._NF.Guidebook.Controls; // Frontier: add _EE

[UsedImplicitly, GenerateTypedNameReferences]
public sealed partial class GuideMedicalComposition : BoxContainer, ISearchableControl
{
public GuideMedicalComposition(ReagentPrototype proto, FixedPoint2 quantity)
{
RobustXamlLoader.Load(this);

ReagentLabel.Text = proto.LocalizedName;
AmountLabel.Text = quantity.ToString();
}

public bool CheckMatchesSearch(string query)
{
return this.ChildrenContainText(query);
}

public void SetHiddenState(bool state, string query)
{
Visible = CheckMatchesSearch(query) ? state : !state;
}
}
21 changes: 21 additions & 0 deletions Content.Client/_NF/Guidebook/Controls/GuideMedicalDamage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<BoxContainer xmlns="https://spacestation14.io"
Orientation="Horizontal"
HorizontalAlignment="Stretch"
HorizontalExpand="True"
Margin="0 0 0 5">
<BoxContainer Name="DamageContainer" Orientation="Vertical" HorizontalExpand="True" VerticalAlignment="Center">
<RichTextLabel Name="DamageLabel"
HorizontalExpand="True"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Access="Public"
Margin="25 0 0 0"/> <!-- Frontier: left margin 2<25 - matches reagent plant metabolism's stacked margins with GuideFoodEmbed -->
</BoxContainer>
<BoxContainer Orientation="Vertical" VerticalAlignment="Center">
<RichTextLabel Name="AmountLabel"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Access="Public"
Margin="10 0 0 0"/> <!-- Frontier: left margin 2<10 -->
</BoxContainer>
</BoxContainer>
40 changes: 40 additions & 0 deletions Content.Client/_NF/Guidebook/Controls/GuideMedicalDamage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Content.Client.Guidebook.Controls;
using Content.Client.UserInterface.ControlExtensions;
using Content.Shared.Damage.Prototypes;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._NF.Guidebook.Controls;

[UsedImplicitly, GenerateTypedNameReferences]
public sealed partial class GuideMedicalDamage : BoxContainer, ISearchableControl
{
public GuideMedicalDamage(DamageTypePrototype proto, FixedPoint2 quantity)
{
RobustXamlLoader.Load(this);

DamageLabel.Text = proto.LocalizedName;
AmountLabel.Text = quantity.ToString();
}

public GuideMedicalDamage(DamageGroupPrototype proto, FixedPoint2 quantity)
{
RobustXamlLoader.Load(this);

DamageLabel.Text = Loc.GetString("guidebook-medical-damage-group", ("name", proto.LocalizedName));
AmountLabel.Text = quantity.ToString();
}

public bool CheckMatchesSearch(string query)
{
return this.ChildrenContainText(query);
}

public void SetHiddenState(bool state, string query)
{
Visible = CheckMatchesSearch(query) ? state : !state;
}
}
53 changes: 53 additions & 0 deletions Content.Client/_NF/Guidebook/Controls/GuideMedicalEmbed.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<BoxContainer xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Orientation="Vertical"
Margin="5 5 5 5">
<PanelContainer HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BorderThickness="1" BorderColor="#777777"/>
</PanelContainer.PanelOverride>
<BoxContainer Orientation="Vertical">
<PanelContainer Name="NameBackground" HorizontalExpand="True" VerticalExpand="False">
<RichTextLabel Name="ResultName" HorizontalAlignment="Center"/>
</PanelContainer>
<BoxContainer Name="RecipesContainer" HorizontalExpand="True" Visible="false">
<Collapsible HorizontalExpand="True">
<CollapsibleHeading Title="{Loc 'guidebook-food-recipes-header'}"/>
<CollapsibleBody>
<GridContainer Name="RecipesDescriptionContainer"
Margin="10 0 10 0"
Columns="1"
HSeparationOverride="0"
HorizontalAlignment="Stretch"
HorizontalExpand="True"/>
</CollapsibleBody>
</Collapsible>
</BoxContainer>
<BoxContainer Name="CompositionContainer" HorizontalExpand="True" Visible="false">
<Collapsible>
<CollapsibleHeading Title="{Loc 'guidebook-medical-reagents-header'}"/>
<CollapsibleBody>
<BoxContainer Name="CompositionDescriptionContainer"
Orientation="Vertical"
Margin="10 0 10 0"
HorizontalExpand="True"/>
</CollapsibleBody>
</Collapsible>
</BoxContainer>
<BoxContainer Name="DamageContainer" HorizontalExpand="True" Visible="false">
<Collapsible>
<CollapsibleHeading Title="{Loc 'guidebook-medical-damage-header'}"/>
<CollapsibleBody>
<BoxContainer Name="DamageDescriptionContainer"
Orientation="Vertical"
Margin="10 0 10 0"
HorizontalExpand="True"/>
</CollapsibleBody>
</Collapsible>
</BoxContainer>
<BoxContainer Margin="10 5 10 10" HorizontalExpand="True">
<RichTextLabel Name="Description" HorizontalAlignment="Left"/>
</BoxContainer>
</BoxContainer>
</PanelContainer>
</BoxContainer>
Loading

0 comments on commit 94d2550

Please sign in to comment.