From 288d9c4fc05f0dfe6a8c224f5bf777189aa6c395 Mon Sep 17 00:00:00 2001 From: BIGZi0348 <118811750+BIGZi0348@users.noreply.github.com> Date: Sat, 26 Oct 2024 17:54:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4=20?= =?UTF-8?q?=D0=B8=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BA=D0=BE=D0=B4=D0=B0=20=D0=B3=D0=B8=D0=BF=D0=BE?= =?UTF-8?q?=D1=81=D0=BF=D1=80=D0=B5=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D0=B1?= =?UTF-8?q?=D0=BE=D1=80=D0=B3=D0=BE=D0=B2=20(#745)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Я только хотел перевести... * refactor * ещё перевод * Revert "refactor" This reverts commit 355c2724c4ed9cd1357661e3ba889a88bdf17db7. * инверсия условия для проверки наличия прототипа --- .../AutoRegenReagentComponent.cs | 5 ++-- .../AutoRegenReagentSystem.cs | 23 ++++++++++++------- Resources/Locale/ru-RU/borg/stack-holder.ftl | 1 + .../components/hypospray-component.ftl | 10 +++++++- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Content.Server/_White/AutoRegenReagent/AutoRegenReagentComponent.cs b/Content.Server/_White/AutoRegenReagent/AutoRegenReagentComponent.cs index 65eac36ab6..98e91b4f75 100644 --- a/Content.Server/_White/AutoRegenReagent/AutoRegenReagentComponent.cs +++ b/Content.Server/_White/AutoRegenReagent/AutoRegenReagentComponent.cs @@ -1,6 +1,7 @@ using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Reagent; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; +using Robust.Shared.Prototypes; namespace Content.Server._White.AutoRegenReagent { @@ -11,10 +12,10 @@ namespace Content.Server._White.AutoRegenReagent public string? SolutionName = null; // we'll fail during tests otherwise [DataField("reagents", required: true)] - public List Reagents = default!; + public List> Reagents = default!; [DataField] - public string CurrentReagent = ""; + public ProtoId CurrentReagent = default!; [DataField] public int CurrentIndex = 0; diff --git a/Content.Server/_White/AutoRegenReagent/AutoRegenReagentSystem.cs b/Content.Server/_White/AutoRegenReagent/AutoRegenReagentSystem.cs index 267842b087..9978ab88ce 100644 --- a/Content.Server/_White/AutoRegenReagent/AutoRegenReagentSystem.cs +++ b/Content.Server/_White/AutoRegenReagent/AutoRegenReagentSystem.cs @@ -1,10 +1,11 @@ -using Content.Server.Chemistry.Containers.EntitySystems; +using Content.Shared.Chemistry.EntitySystems; using Content.Server.Chemistry.EntitySystems; using Content.Server.Popups; using Content.Shared.Examine; using Content.Shared.Interaction.Events; using Content.Shared.Verbs; using Robust.Shared.Timing; +using Robust.Shared.Prototypes; namespace Content.Server._White.AutoRegenReagent { @@ -13,9 +14,10 @@ namespace Content.Server._White.AutoRegenReagent /// public sealed class AutoRegenReagentSystem : EntitySystem { - [Dependency] private readonly SolutionContainerSystem _solutionSystem = default!; + [Dependency] private readonly SharedSolutionContainerSystem _solutionSystem = default!; [Dependency] private readonly PopupSystem _popups = default!; [Dependency] private readonly IGameTiming _timing = default!; + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; public override void Initialize() { @@ -45,7 +47,7 @@ namespace Content.Server._White.AutoRegenReagent if (autoComp.Solution == null) return; - _solutionSystem.TryAddReagent(autoComp.Solution.Value, autoComp.CurrentReagent, autoComp.UnitsPerInterval); + _solutionSystem.TryAddReagent(autoComp.Solution.Value, autoComp.CurrentReagent, autoComp.UnitsPerInterval, out _); } } @@ -69,7 +71,8 @@ namespace Content.Server._White.AutoRegenReagent private void OnExamined(EntityUid uid, AutoRegenReagentComponent component, ExaminedEvent args) { - args.PushMarkup(Loc.GetString("reagent-name", ("reagent", component.CurrentReagent))); + if (_prototypeManager.TryIndex(component.CurrentReagent, out var reagentProto)) + args.PushMarkup(Loc.GetString("reagent-name", ("reagent", reagentProto.LocalizedName))); } private void AddSwitchVerb(EntityUid uid, AutoRegenReagentComponent component, @@ -106,7 +109,7 @@ namespace Content.Server._White.AutoRegenReagent component.CurrentReagent = component.Reagents[component.CurrentIndex]; } - private string SwitchReagent(AutoRegenReagentComponent component, EntityUid? user = null) + private void SwitchReagent(AutoRegenReagentComponent component, EntityUid? user = null) { if (component.CurrentIndex + 1 == component.Reagents.Count) component.CurrentIndex = 0; @@ -118,10 +121,14 @@ namespace Content.Server._White.AutoRegenReagent component.CurrentReagent = component.Reagents[component.CurrentIndex]; - if (user != null) - _popups.PopupEntity(Loc.GetString("autoregen-switched", ("reagent", component.CurrentReagent)), user.Value, user.Value); + if (user == null) + return; + + if (!_prototypeManager.TryIndex(component.CurrentReagent, out var reagentProto)) + return; + + _popups.PopupEntity(Loc.GetString("autoregen-switched", ("reagent", reagentProto.LocalizedName)), user.Value, user.Value); - return component.CurrentReagent; } } } diff --git a/Resources/Locale/ru-RU/borg/stack-holder.ftl b/Resources/Locale/ru-RU/borg/stack-holder.ftl index a66f2936c8..315f2e4969 100644 --- a/Resources/Locale/ru-RU/borg/stack-holder.ftl +++ b/Resources/Locale/ru-RU/borg/stack-holder.ftl @@ -2,3 +2,4 @@ stack-holder-empty = Тут пусто. stack-holder = Оно содержит: { $number } { $item }. autoregen-switched = Реагент сменён на { $reagent }. reagent-name = Текущий реагент: { $reagent }. +autoreagent-switch = Сменить реагент diff --git a/Resources/Locale/ru-RU/chemistry/components/hypospray-component.ftl b/Resources/Locale/ru-RU/chemistry/components/hypospray-component.ftl index b106125192..91aee995d6 100644 --- a/Resources/Locale/ru-RU/chemistry/components/hypospray-component.ftl +++ b/Resources/Locale/ru-RU/chemistry/components/hypospray-component.ftl @@ -1,6 +1,10 @@ ## UI -hypospray-volume-text = Объем: [color=white]{ $currentVolume }/{ $totalVolume }[/color] +hypospray-all-mode-text = Только ввод +hypospray-mobs-only-mode-text = Забор и ввод +hypospray-invalid-text = Ошибка +hypospray-volume-label = Объем: [color=white]{$currentVolume}/{$totalVolume}u[/color] + Mode: [color=white]{$modeString}[/color] ## Entity @@ -11,3 +15,7 @@ hypospray-component-empty-message = Он пустой! hypospray-component-feel-prick-message = Вы чувствуете слабый укольчик! hypospray-component-transfer-already-full-message = { $owner } уже заполнен! hypospray-cant-inject = Нельзя сделать инъекцию в { $target }! + +hypospray-verb-mode-label = Переключить забор из емкостей +hypospray-verb-mode-inject-all = Вы больше не можете производить забор из емкостей. +hypospray-verb-mode-inject-mobs-only = Теперь вы можете производить забор из емкостей.