fish-station/Content.Shared/Construction/Steps/ArbitraryInsertConstructionGraphStep.cs
Rinary 612f8ca9aa
Фикс всей локализации (#496)
* cargo product loc

* first cargo product translate

* second cargoproduct translate

* roadmap has optional localization

* upd

* 2024 roadmap translate

* full ru roadmap goals translate moved to russian loc

* translate some roadmap 2025

* roadmap fully translate

* holidays translate

* donation plinks rework

* translate categories

* translate planet prison objective

* translate evil twin objectives

* translate fugitive objectives

* fix planet prisoner dir

* upd

* no more planet prison dir

* partial toys translate

* fully translate toys

* lockbox loc fix

* fix Suntick loc

* fix tape loc

* borg modules translate

* translate borg tools and nanopaste

* upd

* boombox translate

* translate pda's and hand_teleporter

* reinforcement radio translate

* donation plinks translate

* barber items translate

* tape player translate

* ID cards translate

* computers translate

* translate corporate laws

* pepper spray translate

* flippo lighter translate

* magistrat's rubber stamp translate

* translate some ammunition

* clear no need desc

* translate SMGS

* fix

* Finaly guns translating

* translate clocks

* translate misc

* some cloaks translate

* fully cloaks translate

* belts translate

* translate all masks

* translate boots

* all backpacks translate

* glasses translate

* gloves translate

* bras translate

* fix rsi validator

* translate jumpskirt's

* jumpsuits translate

* security pilot's jumpsuit translate

* translate hardsuit helmets

* translate hood

* hats translate

* helmets translate

* men's underpants translate

* translate women's pants

* hardsuits translate

* fix pant desc

* translate armor

* translate coats

* translate captain's overcoat

* socks translate

* big boxes translate

* translate lockers

* power translate

* translate barber pole

* poster translate

* translate chairs

* translate vending_machines

* translate pacificator

* translate computers

* clowns ghost role translate

* translate eviltwin ghost role

* translate predator name

* another player species translate

* translate foliant

* translate borg chassis

* shuttle markers translate

* translate job spawners

* ghost roles spawners translate

* actions translate

* stacks translate

* some fixes

* uplink catalog fully translate

* return hypo on uplink

* sponsor uplink catalog translate start

* new sponsor uplink translation

* fully translate sponsor uplink catalog

* translate lockers

* translate kits

* translate syndicate boombox bundle

* predator organs translate

* body prototypes translate

* humanoid xeno organs translate

* predator body parts translate

* xenomorph body parts translate

* tajaran body parts translate

* translate disease

* species translate

* translate speech emotes

* upd

* translate frontier rules

* translate lust rules

* translate default rules

* crafting translate

* holy shit, last fixes

* no checks if you not changes prototypes

* fix

* fix linter

* fix sponsor uplink catalog

* second fix

* fix socks

* last fix

* xd

* fix

* upd locale, ALL En-US prototypes translated

* upd

* upd locale validator, checks for non lokalized strings in ru-RU

* some translations

* clear

* gaaaaaaaaaay pin

* upd

* upd

* fix

* fix linter

* translate toys

* translate

* upd

* fix

* upd

* fix

* fix linter

* upd

* fix

* better construction graph translation

* start reworking construction menu translation

* some new translations

* fix

* upd translations

* пу-пу-пу

* fix

* upd

* upd, sunrise strings in en-us

* upd

* translate voice-mask

* translate guns

* energy gun translate

* server info translate

* bar signs translate

* translate ui tabs

* translate reagent effect

* translate revenant-catalog

* translate categories

* general translate

* friends translate

* Sponsor uplink fixes|Translate

* some fixes

* translate Security, Hos, QM sponsor uplink
2024-10-30 10:04:15 +03:00

55 lines
No EOL
2.1 KiB
C#

using Content.Shared.Examine;
using Content.Shared.Tag;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Construction.Steps
{
public abstract partial class ArbitraryInsertConstructionGraphStep : EntityInsertConstructionGraphStep
{
[DataField("name")] public string Name { get; private set; } = string.Empty;
[DataField("icon")] public SpriteSpecifier? Icon { get; private set; }
[DataField("tag", customTypeSerializer: typeof(PrototypeIdSerializer<TagPrototype>))]
public string? Tag { get; private set; }
public override void DoExamine(ExaminedEvent examinedEvent)
{
if (string.IsNullOrEmpty(Name))
return;
examinedEvent.PushMarkup(Loc.GetString("construction-insert-arbitrary-entity", ("stepName", Name)));
}
public override ConstructionGuideEntry GenerateGuideEntry()
{
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
var entityManager = IoCManager.Resolve<IEntityManager>();
string? nameLocale = null;
if (Tag is not null && prototypeManager.TryIndex<TagPrototype>(Tag, out var tag))
{
var entities = prototypeManager.EnumeratePrototypes<EntityPrototype>();
foreach (var item in entities)
{
if (item.TryGetComponent<TagComponent>(out var entityTag) && entityManager.System<TagSystem>().HasTag(entityTag, Tag))
{
nameLocale = item.Name;
break;
}
}
}
return new ConstructionGuideEntry
{
Localization = "construction-presenter-arbitrary-step",
Arguments = new (string, object)[] { ("name", Loc.TryGetString($"{Name}", out var translatedname) ? translatedname : nameLocale ?? Name) },
Icon = Icon,
};
}
}
}