Changes for prototype load parallelization (#13066)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Pieter-Jan Briers
2022-12-20 23:25:34 +01:00
committed by GitHub
parent 584921b423
commit a323671984
50 changed files with 169 additions and 249 deletions

View File

@@ -69,40 +69,25 @@ public struct SeedChemQuantity
public class SeedData
{
#region Tracking
private string _name = String.Empty;
private string _noun = String.Empty;
private string _displayName = String.Empty;
/// <summary>
/// The name of this seed. Determines the name of seed packets.
/// </summary>
[DataField("name")]
public string Name
{
get => _name;
private set => _name = Loc.GetString(value);
}
public string Name { get; private set; } = "";
/// <summary>
/// The noun for this type of seeds. E.g. for fungi this should probably be "spores" instead of "seeds". Also
/// used to determine the name of seed packets.
/// </summary>
[DataField("noun")]
public string Noun
{
get => _noun;
private set => _noun = Loc.GetString(value);
}
public string Noun { get; private set; } = "";
/// <summary>
/// Name displayed when examining the hydroponics tray. Describes the actual plant, not the seed itself.
/// </summary>
[DataField("displayName")]
public string DisplayName
{
get => _displayName;
private set => _displayName = Loc.GetString(value);
}
public string DisplayName { get; private set; } = "";
[DataField("mysterious")] public bool Mysterious;

View File

@@ -80,7 +80,8 @@ public sealed partial class BotanySystem : EntitySystem
if (!TryGetSeed(component, out var seed))
return;
args.PushMarkup(Loc.GetString($"seed-component-description", ("seedName", seed.DisplayName)));
var name = Loc.GetString(seed.DisplayName);
args.PushMarkup(Loc.GetString($"seed-component-description", ("seedName", name)));
args.PushMarkup(Loc.GetString($"seed-component-plant-yield-text", ("seedYield", seed.Yield)));
args.PushMarkup(Loc.GetString($"seed-component-plant-potency-text", ("seedPotency", seed.Potency)));
}
@@ -100,7 +101,9 @@ public sealed partial class BotanySystem : EntitySystem
sprite.LayerSetSprite(0, new SpriteSpecifier.Rsi(proto.PlantRsi, "seed"));
}
var val = Loc.GetString("botany-seed-packet-name", ("seedName", proto.Name), ("seedNoun", proto.Noun));
var name = Loc.GetString(proto.Name);
var noun = Loc.GetString(proto.Noun);
var val = Loc.GetString("botany-seed-packet-name", ("seedName", name), ("seedNoun", noun));
MetaData(seed).EntityName = val;
return seed;
@@ -123,7 +126,8 @@ public sealed partial class BotanySystem : EntitySystem
return Enumerable.Empty<EntityUid>();
}
_popupSystem.PopupCursor(Loc.GetString("botany-harvest-success-message", ("name", proto.DisplayName)), user, PopupType.Medium);
var name = Loc.GetString(proto.DisplayName);
_popupSystem.PopupCursor(Loc.GetString("botany-harvest-success-message", ("name", name)), user, PopupType.Medium);
return GenerateProduct(proto, Transform(user).Coordinates, yieldMod);
}

View File

@@ -76,9 +76,10 @@ namespace Content.Server.Botany.Systems
}
else if (!component.Dead)
{
var displayName = Loc.GetString(component.Seed.DisplayName);
args.PushMarkup(Loc.GetString("plant-holder-component-something-already-growing-message",
("seedName", component.Seed.DisplayName),
("toBeForm", component.Seed.DisplayName.EndsWith('s') ? "are" : "is")));
("seedName", displayName),
("toBeForm", displayName.EndsWith('s') ? "are" : "is")));
if (component.Health <= component.Seed.Endurance / 2)
{
@@ -134,9 +135,11 @@ namespace Content.Server.Botany.Systems
if (!_botanySystem.TryGetSeed(seeds, out var seed))
return ;
var name = Loc.GetString(seed.Name);
var noun = Loc.GetString(seed.Noun);
_popupSystem.PopupCursor(Loc.GetString("plant-holder-component-plant-success-message",
("seedName", seed.Name),
("seedNoun", seed.Noun)), args.User, PopupType.Medium);
("seedName", name),
("seedNoun", noun)), args.User, PopupType.Medium);
component.Seed = seed;
component.Dead = false;
@@ -249,8 +252,9 @@ namespace Content.Server.Botany.Systems
component.Seed.Unique = false;
var seed = _botanySystem.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates);
seed.RandomOffset(0.25f);
var displayName = Loc.GetString(component.Seed.DisplayName);
_popupSystem.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message",
("seedName", component.Seed.DisplayName)), args.User);
("seedName", displayName)), args.User);
component.Health -= (_random.Next(3, 5) * 10);
if (_random.Prob(0.3f))