random loadout support (#11027)
This commit is contained in:
@@ -2,6 +2,7 @@ using Content.Server.Clothing.Components;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Clothing
|
||||
{
|
||||
@@ -12,6 +13,7 @@ namespace Content.Server.Clothing
|
||||
{
|
||||
[Dependency] private readonly StationSpawningSystem _station = default!;
|
||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -22,10 +24,10 @@ namespace Content.Server.Clothing
|
||||
|
||||
private void OnStartup(EntityUid uid, LoadoutComponent component, ComponentStartup args)
|
||||
{
|
||||
if (component.Prototype == string.Empty)
|
||||
if (component.Prototypes == null)
|
||||
return;
|
||||
|
||||
var proto = _protoMan.Index<StartingGearPrototype>(component.Prototype);
|
||||
var proto = _protoMan.Index<StartingGearPrototype>(_random.Pick(component.Prototypes));
|
||||
_station.EquipStartingGear(uid, proto, null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user