Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try Fix Loadouts, Again #1652

Merged
merged 3 commits into from
Jan 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Content.Server/Clothing/Systems/LoadoutSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ public sealed class LoadoutSystem : EntitySystem
[Dependency] private readonly ISerializationManager _serialization = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IComponentFactory _componentFactory = default!;
[Dependency] private readonly ILogManager _log = default!;

private ISawmill _sawmill = default!;


public override void Initialize()
{
_sawmill = _log.GetSawmill("loadouts");

SubscribeLocalEvent<PlayerSpawnCompleteEvent>(OnPlayerSpawnComplete);
}

Expand Down Expand Up @@ -89,6 +94,16 @@ public void ApplyCharacterLoadout(

foreach (var loadout in allLoadouts)
{
if (loadout.Item1 == EntityUid.Invalid
|| !HasComp<MetaDataComponent>(loadout.Item1)
|| Deleted(loadout.Item1))
{
_sawmill.Warning($"Loadout {loadout.Item2.LoadoutName} failed to load properly, deleting.");
EntityManager.QueueDeleteEntity(loadout.Item1);

continue;
}

var loadoutProto = _protoMan.Index<LoadoutPrototype>(loadout.Item2.LoadoutName);
if (loadoutProto.CustomName && loadout.Item2.CustomName != null)
_meta.SetEntityName(loadout.Item1, loadout.Item2.CustomName);
Expand Down
Loading