Add entity prototype save test (#10274)
This commit is contained in:
@@ -14,7 +14,10 @@ namespace Content.Shared.Access.Components
|
||||
[Access(typeof(AccessSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
|
||||
public HashSet<string> Tags = new();
|
||||
|
||||
[DataField("groups", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<AccessGroupPrototype>))]
|
||||
public HashSet<string> Groups = new();
|
||||
/// <summary>
|
||||
/// Access Groups. These are added to the tags during map init. After map init this will have no effect.
|
||||
/// </summary>
|
||||
[DataField("groups", readOnly: true, customTypeSerializer: typeof(PrototypeIdHashSetSerializer<AccessGroupPrototype>))]
|
||||
public readonly HashSet<string> Groups = new();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace Content.Shared.Access.Components
|
||||
[Access(typeof(SharedIdCardSystem), typeof(SharedPDASystem), typeof(SharedAgentIdCardSystem))]
|
||||
public sealed class IdCardComponent : Component
|
||||
{
|
||||
[DataField("originalOwnerName")]
|
||||
public string OriginalOwnerName = default!;
|
||||
[DataField("originalEntityName")]
|
||||
public string OriginalEntityName = string.Empty;
|
||||
|
||||
[DataField("fullName")]
|
||||
[Access(typeof(SharedIdCardSystem), typeof(SharedPDASystem), typeof(SharedAgentIdCardSystem),
|
||||
|
||||
@@ -12,10 +12,10 @@ namespace Content.Shared.Access.Systems
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<AccessComponent, ComponentInit>(OnAccessInit);
|
||||
SubscribeLocalEvent<AccessComponent, MapInitEvent>(OnAccessInit);
|
||||
}
|
||||
|
||||
private void OnAccessInit(EntityUid uid, AccessComponent component, ComponentInit args)
|
||||
private void OnAccessInit(EntityUid uid, AccessComponent component, MapInitEvent args)
|
||||
{
|
||||
// Add all tags in groups to the list of tags.
|
||||
foreach (var group in component.Groups)
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace Content.Shared.Body.Components
|
||||
[NetworkedComponent()]
|
||||
public abstract class SharedBodyPartComponent : Component
|
||||
{
|
||||
public const string ContainerId = "bodypart";
|
||||
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
private SharedBodyComponent? _body;
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace Content.Shared.Disposal.Components
|
||||
[NetworkedComponent]
|
||||
public abstract class SharedDisposalUnitComponent : Component
|
||||
{
|
||||
public const string ContainerId = "disposal-unit";
|
||||
|
||||
// TODO: Could maybe turn the contact off instead far more cheaply as farseer (though not box2d) had support for it?
|
||||
// Need to suss it out.
|
||||
/// <summary>
|
||||
|
||||
@@ -16,6 +16,7 @@ public abstract partial class SharedGunSystem
|
||||
protected virtual void InitializeBallistic()
|
||||
{
|
||||
SubscribeLocalEvent<BallisticAmmoProviderComponent, ComponentInit>(OnBallisticInit);
|
||||
SubscribeLocalEvent<BallisticAmmoProviderComponent, MapInitEvent>(OnBallisticMapInit);
|
||||
SubscribeLocalEvent<BallisticAmmoProviderComponent, TakeAmmoEvent>(OnBallisticTakeAmmo);
|
||||
SubscribeLocalEvent<BallisticAmmoProviderComponent, GetAmmoCountEvent>(OnBallisticAmmoCount);
|
||||
SubscribeLocalEvent<BallisticAmmoProviderComponent, ComponentGetState>(OnBallisticGetState);
|
||||
@@ -122,16 +123,12 @@ public abstract partial class SharedGunSystem
|
||||
private void OnBallisticInit(EntityUid uid, BallisticAmmoProviderComponent component, ComponentInit args)
|
||||
{
|
||||
component.Container = Containers.EnsureContainer<Container>(uid, "ballistic-ammo");
|
||||
component.UnspawnedCount = component.Capacity;
|
||||
}
|
||||
|
||||
private void OnBallisticMapInit(EntityUid uid, BallisticAmmoProviderComponent component, MapInitEvent args)
|
||||
{
|
||||
if (component.FillProto != null)
|
||||
{
|
||||
component.UnspawnedCount -= Math.Min(component.UnspawnedCount, component.Container.ContainedEntities.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
component.UnspawnedCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected int GetBallisticShots(BallisticAmmoProviderComponent component)
|
||||
|
||||
Reference in New Issue
Block a user