Decouples starting gear from UtilityAI (#8512)

This commit is contained in:
EmoGarbage404
2022-05-29 18:14:47 -04:00
committed by GitHub
parent cbf1f6322f
commit 86ee423449
5 changed files with 48 additions and 21 deletions

View File

@@ -0,0 +1,32 @@
using Content.Server.Clothing.Components;
using Content.Server.Station.Systems;
using Content.Shared.Roles;
using Robust.Shared.Prototypes;
namespace Content.Server.Clothing
{
/// <summary>
/// Assigns a loadout to an entity based on the startingGear prototype
/// </summary>
public sealed class LoadoutSystem : EntitySystem
{
[Dependency] private readonly StationSpawningSystem _station = default!;
[Dependency] private readonly IPrototypeManager _protoMan = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<LoadoutComponent, ComponentStartup>(OnStartup);
}
private void OnStartup(EntityUid uid, LoadoutComponent component, ComponentStartup args)
{
if (component.Prototype == string.Empty)
return;
var proto = _protoMan.Index<StartingGearPrototype>(component.Prototype);
_station.EquipStartingGear(uid, proto, null);
}
}
}