Skip to content

Commit

Permalink
Merge branch 'master-ru' into 'master-ru'
Browse files Browse the repository at this point in the history
Upstream sync (Localization)

See merge request Workbench-Team/space-station-14!113
  • Loading branch information
MilenVolf committed Aug 9, 2023
2 parents 9d6ed45 + 50a1b4f commit c1e0c89
Show file tree
Hide file tree
Showing 107 changed files with 3,419 additions and 877 deletions.
5 changes: 0 additions & 5 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.Random.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
using Content.Shared.Dataset;
using Content.Shared.Humanoid;
using Content.Shared.Preferences;
using Content.Shared.Random.Helpers;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;

namespace Content.Client.Preferences.UI
{
public sealed partial class HumanoidProfileEditor
{
private readonly IRobustRandom _random;
private readonly IPrototypeManager _prototypeManager;

private void RandomizeEverything()
Expand Down
115 changes: 53 additions & 62 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,75 +52,66 @@
<ScrollContainer VerticalExpand="True">
<!-- appearanceList -->
<BoxContainer Orientation="Vertical">
<!-- SexAndAgeRow -->
<BoxContainer Orientation="Horizontal" SeparationOverride="10">
<BoxContainer Margin="10" Orientation="Vertical" HorizontalExpand="True">
<!-- Show clothing -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-clothing'}" />
<Control HorizontalExpand="True"/>
<Button Name="ShowClothes" Pressed="True" ToggleMode="True" Text="{Loc 'humanoid-profile-editor-clothing-show'}" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Clothing -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-clothing-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CClothingButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Backpack -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-backpack-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CBackpackButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Sex -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-sex-label'}" />
<OptionButton Name="CSexButton" />
</BoxContainer>
</prefUi:HighlightedContainer>
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-sex-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CSexButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Pronouns -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-pronouns-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CPronounsButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Age -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-age-label'}" />
<LineEdit Name="CAgeEdit" MinSize="40 0" />
</BoxContainer>
</prefUi:HighlightedContainer>
<!-- Gender -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-pronouns-label'}" />
<OptionButton Name="CPronounsButton" />
</BoxContainer>
</prefUi:HighlightedContainer>
</BoxContainer>
<BoxContainer Orientation="Horizontal" SeparationOverride="10">
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-age-label'}" />
<Control HorizontalExpand="True"/>
<LineEdit Name="CAgeEdit" MinSize="40 0" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Species -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-species-label'}" />
<OptionButton Name="CSpeciesButton" />
</BoxContainer>
</prefUi:HighlightedContainer>
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-species-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CSpeciesButton" HorizontalAlignment="Right" />
</BoxContainer>
</BoxContainer>
<!-- Skin -->
<prefUi:HighlightedContainer>
<BoxContainer HorizontalExpand="True" Orientation="Vertical">
<Label Text="{Loc 'humanoid-profile-editor-skin-color-label'}" />
<Slider HorizontalExpand="True" Name="CSkin" MinValue="0" MaxValue="100" Value="20" />
<BoxContainer Name="CRgbSkinColorContainer" Visible="False" Orientation="Vertical" HorizontalExpand="True"></BoxContainer>
</BoxContainer>
</prefUi:HighlightedContainer>
<BoxContainer Margin="10" HorizontalExpand="True" Orientation="Vertical">
<Label Text="{Loc 'humanoid-profile-editor-skin-color-label'}" />
<Slider HorizontalExpand="True" Name="CSkin" MinValue="0" MaxValue="100" Value="20" />
<BoxContainer Name="CRgbSkinColorContainer" Visible="False" Orientation="Vertical" HorizontalExpand="True"></BoxContainer>
</BoxContainer>
<!-- Hair -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<humanoid:SingleMarkingPicker Name="CHairStylePicker" Category="Hair" />
<humanoid:SingleMarkingPicker Name="CFacialHairPicker" Category="FacialHair" />
</BoxContainer>
</prefUi:HighlightedContainer>
<!-- Clothing -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-clothing-label'}" />
<OptionButton Name="CClothingButton" />
</BoxContainer>
</prefUi:HighlightedContainer>
<!-- Backpack -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-backpack-label'}" />
<OptionButton Name="CBackpackButton" />
</BoxContainer>
</prefUi:HighlightedContainer>
<BoxContainer Margin="10" Orientation="Horizontal">
<humanoid:SingleMarkingPicker Name="CHairStylePicker" Category="Hair" />
<humanoid:SingleMarkingPicker Name="CFacialHairPicker" Category="FacialHair" />
</BoxContainer>
<!-- Eyes -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Vertical">
<Label Text="{Loc 'humanoid-profile-editor-eyes-label'}" />
<humanoid:EyeColorPicker Name="CEyeColorPicker" />
</BoxContainer>
</prefUi:HighlightedContainer>
<BoxContainer Margin="10" Orientation="Vertical">
<Label Text="{Loc 'humanoid-profile-editor-eyes-label'}" />
<humanoid:EyeColorPicker Name="CEyeColorPicker" />
</BoxContainer>
</BoxContainer>
</ScrollContainer>
</BoxContainer>
Expand Down
20 changes: 15 additions & 5 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Inventory;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Content.Shared.StatusIcon;
Expand Down Expand Up @@ -112,7 +113,6 @@ public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IProt
IEntityManager entityManager, IConfigurationManager configurationManager)
{
RobustXamlLoader.Load(this);
_random = IoCManager.Resolve<IRobustRandom>();
_prototypeManager = prototypeManager;
_entMan = entityManager;
_preferencesManager = preferencesManager;
Expand All @@ -138,6 +138,8 @@ public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IProt

_tabContainer.SetTabTitle(0, Loc.GetString("humanoid-profile-editor-appearance-tab"));

ShowClothes.OnPressed += ToggleClothes;

#region Sex

_sexButton.OnItemSelected += args =>
Expand Down Expand Up @@ -519,6 +521,11 @@ public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IProt
IsDirty = false;
}

private void ToggleClothes(BaseButton.ButtonEventArgs obj)
{
RebuildSpriteView();
}

private void UpdateRoleRequirements()
{
_jobList.DisposeAllChildren();
Expand Down Expand Up @@ -736,7 +743,7 @@ private void RebuildSpriteView()
}
else
{
_previewSprite.Sprite = sprite;
_previewSprite.SetEntity(_previewDummy.Value);
}

if (_previewSpriteSide == null)
Expand All @@ -753,7 +760,7 @@ private void RebuildSpriteView()
}
else
{
_previewSpriteSide.Sprite = sprite;
_previewSpriteSide.SetEntity(_previewDummy.Value);
}
_needUpdatePreview = true;
}
Expand Down Expand Up @@ -1122,8 +1129,11 @@ private void UpdatePreview()
if (Profile is null)
return;

EntitySystem.Get<HumanoidAppearanceSystem>().LoadProfile(_previewDummy!.Value, Profile);
LobbyCharacterPreviewPanel.GiveDummyJobClothes(_previewDummy!.Value, Profile);
var humanoid = _entMan.System<HumanoidAppearanceSystem>();
humanoid.LoadProfile(_previewDummy!.Value, Profile);

if (ShowClothes.Pressed)
LobbyCharacterPreviewPanel.GiveDummyJobClothes(_previewDummy!.Value, Profile);
}

public void UpdateControls()
Expand Down
7 changes: 7 additions & 0 deletions Content.Client/Stunnable/StunbatonSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using Content.Shared.Stunnable;

namespace Content.Client.Stunnable;

public sealed class StunbatonSystem : SharedStunbatonSystem
{
}
61 changes: 38 additions & 23 deletions Content.Server/Body/Systems/MetabolizerSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Linq;
using Content.Server.Body.Components;
using Content.Server.Chemistry.Components.SolutionManager;
using Content.Server.Chemistry.EntitySystems;
Expand All @@ -10,26 +9,30 @@
using Content.Shared.FixedPoint;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using JetBrains.Annotations;
using Robust.Shared.Collections;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;

namespace Content.Server.Body.Systems
{
[UsedImplicitly]
public sealed class MetabolizerSystem : EntitySystem
{
[Dependency] private readonly BodySystem _bodySystem = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;

private EntityQuery<OrganComponent> _organQuery;
private EntityQuery<SolutionContainerManagerComponent> _solutionQuery;

public override void Initialize()
{
base.Initialize();

_organQuery = GetEntityQuery<OrganComponent>();
_solutionQuery = GetEntityQuery<SolutionContainerManagerComponent>();

SubscribeLocalEvent<MetabolizerComponent, ComponentInit>(OnMetabolizerInit);
SubscribeLocalEvent<MetabolizerComponent, ApplyMetabolicMultiplierEvent>(OnApplyMetabolicMultiplier);
}
Expand All @@ -40,7 +43,7 @@ private void OnMetabolizerInit(EntityUid uid, MetabolizerComponent component, Co
{
_solutionContainerSystem.EnsureSolution(uid, component.SolutionName);
}
else if (CompOrNull<OrganComponent>(uid)?.Body is { } body)
else if (_organQuery.CompOrNull(uid)?.Body is { } body)
{
_solutionContainerSystem.EnsureSolution(body, component.SolutionName);
}
Expand All @@ -65,25 +68,30 @@ public override void Update(float frameTime)
{
base.Update(frameTime);

foreach (var metab in EntityManager.EntityQuery<MetabolizerComponent>(false))
var metabolizers = new ValueList<(EntityUid Uid, MetabolizerComponent Component)>(Count<MetabolizerComponent>());
var query = EntityQueryEnumerator<MetabolizerComponent>();

while (query.MoveNext(out var uid, out var comp))
{
metabolizers.Add((uid, comp));
}

foreach (var (uid, metab) in metabolizers)
{
metab.AccumulatedFrametime += frameTime;

// Only update as frequently as it should
if (metab.AccumulatedFrametime >= metab.UpdateFrequency)
{
metab.AccumulatedFrametime -= metab.UpdateFrequency;
TryMetabolize((metab).Owner, metab);
}
if (metab.AccumulatedFrametime < metab.UpdateFrequency)
continue;

metab.AccumulatedFrametime -= metab.UpdateFrequency;
TryMetabolize(uid, metab);
}
}

private void TryMetabolize(EntityUid uid, MetabolizerComponent? meta = null, OrganComponent? organ = null)
private void TryMetabolize(EntityUid uid, MetabolizerComponent meta, OrganComponent? organ = null)
{
if (!Resolve(uid, ref meta))
return;

Resolve(uid, ref organ, false);
_organQuery.Resolve(uid, ref organ, false);

// First step is get the solution we actually care about
Solution? solution = null;
Expand All @@ -95,16 +103,18 @@ private void TryMetabolize(EntityUid uid, MetabolizerComponent? meta = null, Org
{
if (organ?.Body is { } body)
{
if (!Resolve(body, ref manager, false))
if (!_solutionQuery.Resolve(body, ref manager, false))
return;

_solutionContainerSystem.TryGetSolution(body, meta.SolutionName, out solution, manager);
solutionEntityUid = body;
}
}
else
{
if (!Resolve(uid, ref manager, false))
if (!_solutionQuery.Resolve(uid, ref manager, false))
return;

_solutionContainerSystem.TryGetSolution(uid, meta.SolutionName, out solution, manager);
solutionEntityUid = uid;
}
Expand All @@ -123,18 +133,22 @@ private void TryMetabolize(EntityUid uid, MetabolizerComponent? meta = null, Org
if (!_prototypeManager.TryIndex<ReagentPrototype>(reagent.ReagentId, out var proto))
continue;

FixedPoint2 mostToRemove = FixedPoint2.Zero;
var mostToRemove = FixedPoint2.Zero;
if (proto.Metabolisms == null)
{
if (meta.RemoveEmpty)
{
_solutionContainerSystem.TryRemoveReagent(solutionEntityUid.Value, solution, reagent.ReagentId,
FixedPoint2.New(1));
}

continue;
}

// we're done here entirely if this is true
if (reagents >= meta.MaxReagentsProcessable)
return;

reagents += 1;

// loop over all our groups and see which ones apply
Expand All @@ -152,7 +166,6 @@ private void TryMetabolize(EntityUid uid, MetabolizerComponent? meta = null, Org
if (entry.MetabolismRate > mostToRemove)
mostToRemove = entry.MetabolismRate;


mostToRemove *= group.MetabolismRateModifier;

mostToRemove = FixedPoint2.Clamp(mostToRemove, 0, reagent.Quantity);
Expand All @@ -169,7 +182,7 @@ private void TryMetabolize(EntityUid uid, MetabolizerComponent? meta = null, Org
}

var actualEntity = organ?.Body ?? solutionEntityUid.Value;
var args = new ReagentEffectArgs(actualEntity, (meta).Owner, solution, proto, mostToRemove,
var args = new ReagentEffectArgs(actualEntity, uid, solution, proto, mostToRemove,
EntityManager, null, scale);

// do all effects, if conditions apply
Expand All @@ -190,8 +203,10 @@ private void TryMetabolize(EntityUid uid, MetabolizerComponent? meta = null, Org

// remove a certain amount of reagent
if (mostToRemove > FixedPoint2.Zero)
{
_solutionContainerSystem.TryRemoveReagent(solutionEntityUid.Value, solution, reagent.ReagentId,
mostToRemove);
}
}
}
}
Expand Down
Loading

0 comments on commit c1e0c89

Please sign in to comment.