mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-06-09 10:06:46 +02:00
Dehardcode (#588)
* psiw * yep * clear * review * чёртов пробел * end * linter fix * fix map render --------- Co-authored-by: JrInventor05Next <205915704+JrInventor05Next@users.noreply.github.com>
This commit is contained in:
@@ -27,7 +27,7 @@ namespace Content.Client._WL.DiscordAuth
|
||||
|
||||
_discordAuth = auth;
|
||||
|
||||
Title = "Информация о сессии";
|
||||
Title = Loc.GetString("psiw-title");
|
||||
|
||||
var main_tab = new TabContainer()
|
||||
{
|
||||
@@ -63,7 +63,7 @@ namespace Content.Client._WL.DiscordAuth
|
||||
var discord_content_box_title = new Label()
|
||||
{
|
||||
HorizontalAlignment = HAlignment.Center,
|
||||
Text = "Аутентификация",
|
||||
Text = Loc.GetString("psiw-auth"),
|
||||
Margin = new(0, 7)
|
||||
};
|
||||
discord_content_box_title.AddStyleClass("LabelKeyText");
|
||||
@@ -75,7 +75,7 @@ namespace Content.Client._WL.DiscordAuth
|
||||
|
||||
var discord_content_bot_ucode_title = new Label()
|
||||
{
|
||||
Text = "Уникальный код:",
|
||||
Text = Loc.GetString("psiw-unique-code"),
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
Margin = new(20, 0, 20, 0)
|
||||
};
|
||||
@@ -85,7 +85,7 @@ namespace Content.Client._WL.DiscordAuth
|
||||
var token = _discordAuth.GetUserCode();
|
||||
var discord_content_bot_ucode_value = new RichTextLabel()
|
||||
{
|
||||
Text = token ?? "Unknown"
|
||||
Text = token ?? Loc.GetString("generic-unknown-title")
|
||||
};
|
||||
|
||||
_discordAuth.SubscribeOnTokenChanged(token =>
|
||||
@@ -97,7 +97,7 @@ namespace Content.Client._WL.DiscordAuth
|
||||
{
|
||||
PanelOverride = style_box,
|
||||
MouseFilter = MouseFilterMode.Stop,
|
||||
ToolTip = "Кликните, чтобы скопировать код в буфер обмена."
|
||||
ToolTip = Loc.GetString("psiw-copy-tooltip")
|
||||
};
|
||||
|
||||
discord_content_bot_ucode_value_panel.OnMouseEntered += _ =>
|
||||
@@ -139,7 +139,7 @@ namespace Content.Client._WL.DiscordAuth
|
||||
|
||||
var progress_bar_box_label = new Label()
|
||||
{
|
||||
Text = "До смены ключа авторизации:",
|
||||
Text = Loc.GetString("psiw-auth-time-expire"),
|
||||
Margin = new(10, 0)
|
||||
};
|
||||
progress_bar_box_label.AddStyleClass("LabelKeyText");
|
||||
@@ -164,7 +164,7 @@ namespace Content.Client._WL.DiscordAuth
|
||||
var discord_tab_box = new BoxContainer();
|
||||
discord_tab_box.AddChild(discord_tab);
|
||||
|
||||
AddTab(0, "Дискорд", discord_tab_box);
|
||||
AddTab(0, Loc.GetString("psiw-discord"), discord_tab_box);
|
||||
#endregion
|
||||
|
||||
AddChild(main_tab);
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Content.Server._WL.Android
|
||||
public float IonStormSlownessProbability = 0.78f;
|
||||
|
||||
[DataField]
|
||||
public string IonStormPopupMessage = "Вы чувствуете из-за электромагнитных колебаний ваше тело становится тяжелее, а мысли запутаннее";
|
||||
public LocId IonStormPopupMessage = "android-comp-ion-storm-popup";
|
||||
|
||||
[DataField]
|
||||
public bool IsUnderIonStorm = false;
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace Content.Server._WL.Android
|
||||
androidComp.IsUnderIonStorm = true;
|
||||
_move.RefreshMovementSpeedModifiers(android, movementSpeedComp);
|
||||
|
||||
_popup.PopupEntity(androidComp.IonStormPopupMessage, android, android, Shared.Popups.PopupType.Medium);
|
||||
_popup.PopupEntity(Loc.GetString(androidComp.IonStormPopupMessage), android, android, Shared.Popups.PopupType.Medium);
|
||||
|
||||
EnsureComp<StutteringAccentComponent>(android);
|
||||
}
|
||||
@@ -253,7 +253,7 @@ namespace Content.Server._WL.Android
|
||||
{
|
||||
Act = () => _doAfter.TryStartDoAfter(doAfter),
|
||||
IconEntity = GetNetEntity(target),
|
||||
Text = "Зарядка"
|
||||
Text = Loc.GetString("android-system-charge-verb")
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Content.Server._WL.Economics.Components
|
||||
public SoundSpecifier FlipSound = new SoundPathSpecifier(@"/Audio/_WL/Economics/flip.ogg");
|
||||
|
||||
[DataField]
|
||||
public string FlippedCardName = "перевёрнутая карта";
|
||||
public LocId FlippedCardName = "pokercard-comp-flipped-card";
|
||||
|
||||
[DataField]
|
||||
public bool FlipPopup = true;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Content.Server._WL.Economics.Systems
|
||||
{
|
||||
Act = () => FlipCard(card, args.User, comp),
|
||||
IconEntity = GetNetEntity(card),
|
||||
Text = "Перевернуть"
|
||||
Text = Loc.GetString("pokercard-system-flip-verb")
|
||||
};
|
||||
|
||||
args.Verbs.Add(verb);
|
||||
@@ -72,6 +72,8 @@ namespace Content.Server._WL.Economics.Systems
|
||||
if (!args.CanInteract || !args.CanAccess)
|
||||
return;
|
||||
|
||||
var user = args.User;
|
||||
|
||||
var firstVerb = new AlternativeVerb()
|
||||
{
|
||||
Act = () =>
|
||||
@@ -84,20 +86,20 @@ namespace Content.Server._WL.Economics.Systems
|
||||
|
||||
if (container.ContainedEntities.Count == 0)
|
||||
{
|
||||
_popup.PopupCursor("В коробке нет карт!", args.User);
|
||||
_popup.PopupCursor(Loc.GetString("pokercard-system-box-no-cards-popup"), user);
|
||||
return;
|
||||
}
|
||||
|
||||
var pickedCard = _random.Pick(container.ContainedEntities);
|
||||
if (_container.RemoveEntity(cardBox, pickedCard, containerManagerComp, force: true))
|
||||
_hands.TryPickupAnyHand(args.User, pickedCard, animateUser: true);
|
||||
_hands.TryPickupAnyHand(user, pickedCard, animateUser: true);
|
||||
|
||||
if (comp.TakePopup)
|
||||
_popup.PopupEntity($"{Identity.Name(args.User, EntityManager)} вытащил карту из колоды.", cardBox);
|
||||
_popup.PopupEntity(Loc.GetString("pokercard-system-get-card-popup", ("name", Identity.Name(user, EntityManager)), ("ent", user)), cardBox);
|
||||
},
|
||||
IconEntity = GetNetEntity(cardBox),
|
||||
Priority = -1,
|
||||
Text = "Вытащить случайную карту"
|
||||
Text = Loc.GetString("pokercard-system-get-random-card-verb")
|
||||
};
|
||||
|
||||
var secondVerb = new AlternativeVerb()
|
||||
@@ -112,7 +114,7 @@ namespace Content.Server._WL.Economics.Systems
|
||||
|
||||
if (container.ContainedEntities.Count == 0)
|
||||
{
|
||||
_popup.PopupCursor("В коробке нет карт!", args.User);
|
||||
_popup.PopupCursor(Loc.GetString("pokercard-system-box-no-cards-popup"), user);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -123,7 +125,7 @@ namespace Content.Server._WL.Economics.Systems
|
||||
},
|
||||
IconEntity = GetNetEntity(cardBox),
|
||||
Priority = -1,
|
||||
Text = "Перевернуть все карты в колоде"
|
||||
Text = Loc.GetString("pokercard-system-flip-all-cards-verb")
|
||||
};
|
||||
|
||||
args.Verbs.Add(firstVerb);
|
||||
@@ -155,12 +157,12 @@ namespace Content.Server._WL.Economics.Systems
|
||||
_metaData.SetEntityName(card, comp.OriginalName);
|
||||
|
||||
if (user != null && comp.FlipPopup)
|
||||
_popup.PopupEntity($"{Identity.Name(user.Value, EntityManager)} вскрыл карту!", card);
|
||||
_popup.PopupEntity(Loc.GetString("pokercard-system-reveal-card-popup", ("name", Identity.Name(user.Value, EntityManager)), ("ent", user.Value)), card);
|
||||
}
|
||||
else
|
||||
{
|
||||
_appearance.SetData(card, PokerCardState.IsFlipped, true);
|
||||
_metaData.SetEntityName(card, comp.FlippedCardName);
|
||||
_metaData.SetEntityName(card, Loc.GetString(comp.FlippedCardName));
|
||||
}
|
||||
|
||||
_audio.PlayPvs(comp.FlipSound, card, StandartParams);
|
||||
|
||||
@@ -8,18 +8,16 @@ using Robust.Shared.Console;
|
||||
namespace Content.Server._WL.GameTicking.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Round)]
|
||||
sealed partial class NoForceMapCommand : IConsoleCommand
|
||||
sealed partial class NoForceMapCommand : LocalizedCommands
|
||||
{
|
||||
[Dependency] private IConfigurationManager _configurationManager = default!;
|
||||
|
||||
public string Command => "noforcemap";
|
||||
public string Description => Loc.GetString("Убирает карту, которая была выставлена forcemap");
|
||||
public string Help => string.Empty;
|
||||
public override string Command => "noforcemap";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
_configurationManager.SetCVar(CCVars.GameMap, string.Empty);
|
||||
shell.WriteLine(Loc.GetString("Очередь карт была очищена"));
|
||||
shell.WriteLine(Loc.GetString("cmd-noforcemap-success"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Charges.Components;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server._WL.MetaData.Components;
|
||||
|
||||
@@ -19,4 +20,15 @@ public sealed partial class RenameOnInteractComponent : Component
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool UseVerbs { get; set; } = true;
|
||||
|
||||
[DataField]
|
||||
public LocId RenameActionLocString = "renameable-component-rename-action";
|
||||
|
||||
[DataField]
|
||||
public LocId NameTitleLocString = "renameable-component-name-field";
|
||||
|
||||
[DataField]
|
||||
public LocId NewNameConditions = "renameable-system-new-name-conditions";
|
||||
[DataField]
|
||||
public ResPath VerbTexturePath = new("/Textures/Interface/AdminActions/rename.png");
|
||||
}
|
||||
|
||||
@@ -19,13 +19,6 @@ public sealed partial class RenameableSystem : EntitySystem
|
||||
[Dependency] private IPlayerManager _playMan = default!;
|
||||
[Dependency] private PopupSystem _popup = default!;
|
||||
|
||||
private static readonly LocId RenameActionLocString = "renameable-component-rename-action";
|
||||
private static readonly LocId NameTitleLocString = "renameable-component-name-field";
|
||||
|
||||
private static readonly LocId NewNameConditions = "renameable-system-new-name-conditions";
|
||||
|
||||
private static readonly ResPath VerbTexturePath = new("/Textures/Interface/AdminActions/rename.png");
|
||||
|
||||
// TODO: вынести в поле в компоненте
|
||||
private const int NewNameMaxLength = 40;
|
||||
|
||||
@@ -88,14 +81,14 @@ public sealed partial class RenameableSystem : EntitySystem
|
||||
if (!Resolve(item, ref item.Comp, false))
|
||||
return false;
|
||||
|
||||
var titleLoc = Loc.GetString(RenameActionLocString);
|
||||
var promptLoc = Loc.GetString(NameTitleLocString);
|
||||
var titleLoc = Loc.GetString(item.Comp.RenameActionLocString);
|
||||
var promptLoc = Loc.GetString(item.Comp.NameTitleLocString);
|
||||
|
||||
_quickDialog.OpenDialog(session, titleLoc, promptLoc, (string newName) =>
|
||||
{
|
||||
if (!IsNewNameValid(newName))
|
||||
{
|
||||
_popup.PopupCursor(Loc.GetString(NewNameConditions, ("count", NewNameMaxLength)), session, Shared.Popups.PopupType.Medium);
|
||||
_popup.PopupCursor(Loc.GetString(item.Comp.NewNameConditions, ("count", NewNameMaxLength)), session, Shared.Popups.PopupType.Medium);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -135,8 +128,8 @@ public sealed partial class RenameableSystem : EntitySystem
|
||||
TryOpenDialog(session, item);
|
||||
},
|
||||
Impact = Shared.Database.LogImpact.Low,
|
||||
Text = Loc.GetString(RenameActionLocString),
|
||||
Icon = new SpriteSpecifier.Texture(VerbTexturePath),
|
||||
Text = Loc.GetString(comp.RenameActionLocString),
|
||||
Icon = new SpriteSpecifier.Texture(comp.VerbTexturePath),
|
||||
Priority = 10,
|
||||
};
|
||||
|
||||
|
||||
@@ -36,4 +36,7 @@ public sealed partial class SuckableFoodComponent : Component
|
||||
|
||||
[Access(typeof(SuckableFoodSystem))]
|
||||
public EntityUid? SuckingEntity;
|
||||
|
||||
[DataField]
|
||||
public LocId PutInMouthLoc = "food-sweets-put-in-mouth-popup-message";
|
||||
}
|
||||
|
||||
@@ -40,8 +40,6 @@ public sealed partial class SuckableFoodSystem : EntitySystem
|
||||
private const float UpdatePeriod = 2f; // in seconds
|
||||
private float _updateTimer = 0f;
|
||||
|
||||
private static readonly LocId PutInMouthLoc = "food-sweets-put-in-mouth-popup-message";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -150,7 +148,7 @@ public sealed partial class SuckableFoodSystem : EntitySystem
|
||||
if (string.IsNullOrEmpty(flavor))
|
||||
return;
|
||||
|
||||
var msg = Loc.GetString(PutInMouthLoc, ("flavor", flavor), ("entity", Identity.Name(food, EntityManager, ev.EquipTarget)));
|
||||
var msg = Loc.GetString(comp.PutInMouthLoc, ("flavor", flavor), ("entity", Identity.Name(food, EntityManager, ev.EquipTarget)));
|
||||
|
||||
_popup.PopupEntity(msg, ev.EquipTarget, Filter.Entities(ev.EquipTarget), false);
|
||||
}
|
||||
|
||||
@@ -29,12 +29,7 @@ namespace Content.Shared._WL.Inventory.Systems
|
||||
if (!IsSlotBlocked((args.EquipTarget, comp), args.SlotFlags, out var reasons))
|
||||
return;
|
||||
|
||||
var reason = $"Для начала нужно снять ";
|
||||
|
||||
var stringReasons = reasons.Select(e => Identity.Name(e, EntityManager));
|
||||
reason += string.Join(" и ", stringReasons);
|
||||
|
||||
args.Reason = reason;
|
||||
args.Reason = Loc.GetString("isb-system-reason", ("entities", string.Join(", ", reasons.Select(e => Identity.Name(e, EntityManager)))));
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
@@ -49,19 +44,13 @@ namespace Content.Shared._WL.Inventory.Systems
|
||||
if (!IsSlotBlocked((args.UnEquipTarget, comp), args.Slot, out var reasons))
|
||||
return;
|
||||
|
||||
var reason = $"Для начала нужно снять ";
|
||||
|
||||
var stringReasons = reasons.Select(e => Identity.Name(e, EntityManager));
|
||||
reason += string.Join(" и ", stringReasons);
|
||||
|
||||
args.Reason = reason;
|
||||
args.Reason = Loc.GetString("isb-system-reason", ("entities", string.Join(", ", reasons.Select(e => Identity.Name(e, EntityManager)))));
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
public bool IsSlotBlocked(Entity<InventoryComponent> entityWithInventoryComp, SlotDefinition slotDef, [NotNullWhen(true)] out List<EntityUid>? reasons)
|
||||
{
|
||||
var blocked = IsSlotBlocked(entityWithInventoryComp, slotDef.SlotFlags, out var reass);
|
||||
reasons = reass;
|
||||
var blocked = IsSlotBlocked(entityWithInventoryComp, slotDef.SlotFlags, out reasons);
|
||||
return blocked;
|
||||
}
|
||||
|
||||
@@ -99,8 +88,7 @@ namespace Content.Shared._WL.Inventory.Systems
|
||||
if (!_inventory.TryGetSlot(entityWithInventoryComp.Owner, slot, out var slotDef, entityWithInventoryComp.Comp))
|
||||
return false;
|
||||
|
||||
var blocked = IsSlotBlocked(entityWithInventoryComp, slotDef, out var reass);
|
||||
reasons = reass;
|
||||
var blocked = IsSlotBlocked(entityWithInventoryComp, slotDef, out reasons);
|
||||
return blocked;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public abstract partial class ObfuscationMethod
|
||||
int result = 0;
|
||||
int gap = end - start + 1;
|
||||
result = seed ^ (global_seed * 127) + 1;
|
||||
result = System.Math.Abs((result + 619251) * 27644437);
|
||||
result = Math.Abs((result + 619251) * 27644437);
|
||||
result %= gap;
|
||||
result += start;
|
||||
return result;
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
android-comp-ion-storm-popup = Вы чувствуете, как из-за электромагнитных колебаний ваше тело становится тяжелее, а мысли запутаннее
|
||||
android-system-charge-verb = Зарядка
|
||||
@@ -0,0 +1,6 @@
|
||||
psiw-title = Информация о сессии
|
||||
psiw-auth = Аутентификация
|
||||
psiw-unique-code = Уникальный код:
|
||||
psiw-copy-tooltip = Кликните, чтобы скопировать код в буфер обмена
|
||||
psiw-auth-time-expire = До смены ключа авторизации:
|
||||
psiw-discord = Discord
|
||||
@@ -0,0 +1,2 @@
|
||||
cmd-noforcemap-desc = Убирает карту, которая была выставлена forcemap
|
||||
cmd-noforcemap-success = Очередь карт была очищена
|
||||
@@ -0,0 +1 @@
|
||||
isb-system-reason = Для начала нужно снять { $entities }
|
||||
@@ -0,0 +1,17 @@
|
||||
pokercard-comp-flipped-card = перевёрнутая карта
|
||||
pokercard-system-flip-verb = Перевернуть
|
||||
pokercard-system-box-no-cards-popup = В коробке нет карт!
|
||||
pokercard-system-get-card-popup = { $name } { GENDER($ent) ->
|
||||
[male] вытащил
|
||||
[female] вытащила
|
||||
[epicene] вытащили
|
||||
*[neuter] вытащило
|
||||
} карту из колоды
|
||||
pokercard-system-get-random-card-verb = Вытащить случайную карту
|
||||
pokercard-system-flip-all-cards-verb = Перевернуть все карты в колоде
|
||||
pokercard-system-reveal-card-popup = { $name } { GENDER($ent) ->
|
||||
[male] вскрыл
|
||||
[female] вскрыла
|
||||
[epicene] вскрыли
|
||||
*[neuter] вскрыло
|
||||
} карту
|
||||
Reference in New Issue
Block a user