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

@@ -14,8 +14,6 @@ namespace Content.Server.Storage.Components
[Access(typeof(SecretStashSystem))]
public sealed class SecretStashComponent : Component
{
private string _secretPartName = string.Empty;
/// <summary>
/// Max item size that can be fitted into secret stash.
/// </summary>
@@ -27,11 +25,7 @@ namespace Content.Server.Storage.Components
/// If empty string, will replace it with entity name in init.
/// </summary>
[DataField("secretPartName", readOnly: true)]
public string SecretPartName
{
get => _secretPartName;
set => _secretPartName = Loc.GetString(value);
}
public string SecretPartName { get; set; } = "";
/// <summary>
/// Container used to keep secret stash item.

View File

@@ -24,14 +24,6 @@ namespace Content.Server.Storage.EntitySystems
private void OnInit(EntityUid uid, SecretStashComponent component, ComponentInit args)
{
// set default secret part name
if (component.SecretPartName == string.Empty)
{
var meta = EntityManager.GetComponent<MetaDataComponent>(uid);
var entityName = Loc.GetString("comp-secret-stash-secret-part-name", ("name", meta.EntityName));
component.SecretPartName = entityName;
}
component.ItemContainer = _containerSystem.EnsureContainer<ContainerSlot>(uid, "stash", out _);
}
@@ -79,7 +71,7 @@ namespace Content.Server.Storage.EntitySystems
if (item.Size > component.MaxItemSize)
{
var msg = Loc.GetString("comp-secret-stash-action-hide-item-too-big",
("item", itemName), ("stash", component.SecretPartName));
("item", itemName), ("stash", GetSecretPartName(uid, component)));
_popupSystem.PopupEntity(msg, uid, userUid);
return false;
}
@@ -92,7 +84,7 @@ namespace Content.Server.Storage.EntitySystems
// all done, show success message
var successMsg = Loc.GetString("comp-secret-stash-action-hide-success",
("item", itemName), ("this", component.SecretPartName));
("item", itemName), ("this", GetSecretPartName(uid, component)));
_popupSystem.PopupEntity(successMsg, uid, userUid);
return true;
}
@@ -121,10 +113,21 @@ namespace Content.Server.Storage.EntitySystems
// show success message
var successMsg = Loc.GetString("comp-secret-stash-action-get-item-found-something",
("stash", component.SecretPartName));
("stash", GetSecretPartName(uid, component)));
_popupSystem.PopupEntity(successMsg, uid, userUid);
return true;
}
private string GetSecretPartName(EntityUid uid, SecretStashComponent stash)
{
if (stash.SecretPartName != "")
return Loc.GetString(stash.SecretPartName);
var meta = EntityManager.GetComponent<MetaDataComponent>(uid);
var entityName = Loc.GetString("comp-secret-stash-secret-part-name", ("name", meta.EntityName));
return entityName;
}
}
}