random loadout support (#11027)
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
|
||||
namespace Content.Server.Clothing.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class LoadoutComponent : Component
|
||||
{
|
||||
[DataField("prototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<StartingGearPrototype>))]
|
||||
public string Prototype = string.Empty;
|
||||
/// <summary>
|
||||
/// A list of starting gears, of which one will be given.
|
||||
/// All elements are weighted the same in the list.
|
||||
/// </summary>
|
||||
[DataField("prototypes", required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<StartingGearPrototype>))]
|
||||
public List<string>? Prototypes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@
|
||||
suffix: AI
|
||||
components:
|
||||
- type: InputMover
|
||||
- type: MobMover
|
||||
- type: MobMover
|
||||
@@ -7,7 +7,7 @@
|
||||
- type: InputMover
|
||||
- type: MobMover
|
||||
- type: Loadout
|
||||
prototype: PassengerGear
|
||||
prototypes: [PassengerGear]
|
||||
- type: Faction
|
||||
factions:
|
||||
- NanoTrasen
|
||||
@@ -34,7 +34,7 @@
|
||||
components:
|
||||
- type: RandomHumanoidAppearance
|
||||
- type: Loadout
|
||||
prototype: CBURNGear
|
||||
prototypes: [CBURNGear]
|
||||
- type: GhostTakeoverAvailable
|
||||
makeSentient: false
|
||||
name: CBURN Agent
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
name: CentCom official
|
||||
description: Inspect the station, jot down performance reviews for heads of staff, bug the Captain.
|
||||
- type: Loadout
|
||||
prototype: CentcomGear
|
||||
prototypes: [CentcomGear]
|
||||
- type: RandomHumanoidAppearance
|
||||
|
||||
# ERT Leader
|
||||
@@ -62,7 +62,7 @@
|
||||
name: ERT Leader
|
||||
description: Lead a team of specialists to resolve the stations issues.
|
||||
- type: Loadout
|
||||
prototype: ERTLeaderGear
|
||||
prototypes: [ERTLeaderGear]
|
||||
- type: RandomMetadata
|
||||
nameSegments: [NamesFirstMilitaryLeader]
|
||||
- type: RandomHumanoidAppearance
|
||||
@@ -78,7 +78,7 @@
|
||||
sprite: Markers/jobs.rsi
|
||||
state: ertleadereva
|
||||
- type: Loadout
|
||||
prototype: ERTLeaderGearEVA
|
||||
prototypes: [ERTLeaderGearEVA]
|
||||
|
||||
# ERT Engineer
|
||||
- type: entity
|
||||
@@ -93,7 +93,7 @@
|
||||
name: ERT Engineer
|
||||
description: Assist with engineering efforts to resolve the stations issues.
|
||||
- type: Loadout
|
||||
prototype: ERTEngineerGear
|
||||
prototypes: [ERTEngineerGear]
|
||||
|
||||
- type: entity
|
||||
name: ERT engineer
|
||||
@@ -105,7 +105,7 @@
|
||||
sprite: Markers/jobs.rsi
|
||||
state: ertengineereva
|
||||
- type: Loadout
|
||||
prototype: ERTEngineerGearEVA
|
||||
prototypes: [ERTEngineerGearEVA]
|
||||
|
||||
# ERT Security
|
||||
- type: entity
|
||||
@@ -120,7 +120,7 @@
|
||||
name: ERT Security
|
||||
description: Assist with security efforts to resolve the stations issues.
|
||||
- type: Loadout
|
||||
prototype: ERTSecurityGear
|
||||
prototypes: [ERTSecurityGear]
|
||||
|
||||
- type: entity
|
||||
name: ERT security
|
||||
@@ -132,7 +132,7 @@
|
||||
sprite: Markers/jobs.rsi
|
||||
state: ertsecurityeva
|
||||
- type: Loadout
|
||||
prototype: ERTSecurityGearEVA
|
||||
prototypes: [ERTSecurityGearEVA]
|
||||
|
||||
# ERT Medical
|
||||
- type: entity
|
||||
@@ -147,7 +147,7 @@
|
||||
name: ERT Medic
|
||||
description: Assist with medical efforts to resolve the stations issues.
|
||||
- type: Loadout
|
||||
prototype: ERTMedicalGear
|
||||
prototypes: [ERTMedicalGear]
|
||||
|
||||
- type: entity
|
||||
name: ERT medic
|
||||
@@ -159,7 +159,7 @@
|
||||
sprite: Markers/jobs.rsi
|
||||
state: ertmedicaleva
|
||||
- type: Loadout
|
||||
prototype: ERTMedicalGearEVA
|
||||
prototypes: [ERTMedicalGearEVA]
|
||||
|
||||
# ERT Janitor
|
||||
- type: entity
|
||||
@@ -174,7 +174,7 @@
|
||||
name: ERT Janitor
|
||||
description: Assist with custodial efforts to resolve the stations issues.
|
||||
- type: Loadout
|
||||
prototype: ERTJanitorGear
|
||||
prototypes: [ERTJanitorGear]
|
||||
|
||||
- type: entity
|
||||
name: ERT janitor
|
||||
@@ -186,7 +186,7 @@
|
||||
sprite: Markers/jobs.rsi
|
||||
state: ertjanitoreva
|
||||
- type: Loadout
|
||||
prototype: ERTJanitorGearEVA
|
||||
prototypes: [ERTJanitorGearEVA]
|
||||
|
||||
#Syndie
|
||||
- type: entity
|
||||
@@ -195,7 +195,7 @@
|
||||
name: Syndicate Agent
|
||||
components:
|
||||
- type: Loadout
|
||||
prototype: SyndicateOperativeGearExtremelyBasic
|
||||
prototypes: [SyndicateOperativeGearExtremelyBasic]
|
||||
- type: RandomMetadata
|
||||
nameSegments: [names_death_commando]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user