Decouples starting gear from UtilityAI (#8512)
This commit is contained in:
32
Content.Server/Clothing/LoadoutSystem.cs
Normal file
32
Content.Server/Clothing/LoadoutSystem.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user