Decouples starting gear from UtilityAI (#8512)
This commit is contained in:
@@ -39,10 +39,6 @@ namespace Content.Server.AI.Components
|
|||||||
[DataField("awake")]
|
[DataField("awake")]
|
||||||
private bool _awake = true;
|
private bool _awake = true;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
[DataField("startingGear")]
|
|
||||||
public string? StartingGearPrototype { get; set; }
|
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public float VisionRadius
|
public float VisionRadius
|
||||||
{
|
{
|
||||||
@@ -59,20 +55,6 @@ namespace Content.Server.AI.Components
|
|||||||
Owner.EnsureComponent<PhysicsComponent>();
|
Owner.EnsureComponent<PhysicsComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Startup()
|
|
||||||
{
|
|
||||||
base.Startup();
|
|
||||||
|
|
||||||
if (StartingGearPrototype != null)
|
|
||||||
{
|
|
||||||
var stationSpawning = EntitySystem.Get<StationSpawningSystem>();
|
|
||||||
var protoManager = IoCManager.Resolve<IPrototypeManager>();
|
|
||||||
|
|
||||||
var startingGear = protoManager.Index<StartingGearPrototype>(StartingGearPrototype);
|
|
||||||
stationSpawning.EquipStartingGear(Owner, startingGear, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Movement speed (m/s) that the entity walks, after modifiers
|
/// Movement speed (m/s) that the entity walks, after modifiers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
12
Content.Server/Clothing/Components/LoadoutComponent.cs
Normal file
12
Content.Server/Clothing/Components/LoadoutComponent.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Content.Shared.Roles;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
|
namespace Content.Server.Clothing.Components
|
||||||
|
{
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed class LoadoutComponent : Component
|
||||||
|
{
|
||||||
|
[DataField("prototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<StartingGearPrototype>))]
|
||||||
|
public string Prototype = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,8 @@
|
|||||||
- Hunger
|
- Hunger
|
||||||
- Thirst
|
- Thirst
|
||||||
- Idle
|
- Idle
|
||||||
startingGear: PassengerGear
|
- type: Loadout
|
||||||
|
prototype: PassengerGear
|
||||||
- type: AiFactionTag
|
- type: AiFactionTag
|
||||||
factions:
|
factions:
|
||||||
- NanoTrasen
|
- NanoTrasen
|
||||||
|
|||||||
@@ -49,6 +49,6 @@
|
|||||||
makeSentient: false
|
makeSentient: false
|
||||||
name: centcom official
|
name: centcom official
|
||||||
description: Inspect the station, jot down performance reviews for heads of staff, bug the Captain.
|
description: Inspect the station, jot down performance reviews for heads of staff, bug the Captain.
|
||||||
- type: UtilityAI
|
- type: Loadout
|
||||||
startingGear: CentcomGear
|
prototype: CentcomGear
|
||||||
- type: RandomHumanoidAppearance
|
- type: RandomHumanoidAppearance
|
||||||
|
|||||||
Reference in New Issue
Block a user