Use Segments for RandomMetadata (#11190)

* use segments for randomized names now

* separator datafields

* public api
This commit is contained in:
Nemanja
2022-09-14 03:13:22 -04:00
committed by GitHub
parent f14f3d4999
commit cff6fe267c
7 changed files with 43 additions and 38 deletions

View File

@@ -1,6 +1,4 @@
using Content.Shared.Actions.ActionTypes;
using Content.Shared.Dataset;
using Content.Shared.Disease;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -44,11 +42,5 @@ namespace Content.Server.RatKing
/// </summary>
[ViewVariables, DataField("molesMiasmaPerDomain")]
public float MolesMiasmaPerDomain = 100f;
// Both of these are used to generate the random name for rat king.
[DataField("titleNameDataset", customTypeSerializer: typeof(PrototypeIdSerializer<DatasetPrototype>))]
public string TitleNameDataset = "RegalRatNameTitle";
[DataField("kingdomNameDataset", customTypeSerializer: typeof(PrototypeIdSerializer<DatasetPrototype>))]
public string KingdomNameDataset = "RegalRatNameKingdom";
}
};

View File

@@ -1,23 +1,16 @@
using Content.Server.Actions;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Disease;
using Content.Server.Disease.Components;
using Content.Server.Nutrition.Components;
using Content.Server.Popups;
using Content.Shared.Actions;
using Content.Shared.Atmos;
using Content.Shared.Dataset;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Server.RatKing
{
public sealed class RatKingSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly ActionsSystem _action = default!;
[Dependency] private readonly AtmosphereSystem _atmos = default!;
@@ -37,11 +30,6 @@ namespace Content.Server.RatKing
{
_action.AddAction(uid, component.ActionRaiseArmy, null);
_action.AddAction(uid, component.ActionDomain, null);
var kingdom = _proto.Index<DatasetPrototype>(component.KingdomNameDataset);
var title = _proto.Index<DatasetPrototype>(component.TitleNameDataset);
MetaData(uid).EntityName = $"{_random.Pick(kingdom.Values)} {_random.Pick(title.Values)}";
}
/// <summary>