Cleanups PolymorphSystem/Components/Prototypes (#23721)

* Cleanups PolymorphSystem

* forgot this

* Nah

* Fix test

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
AJCM-git
2024-02-01 08:17:02 -04:00
committed by GitHub
parent c0227bcb3b
commit b8f0ed3975
17 changed files with 714 additions and 724 deletions

View File

@@ -1,21 +1,24 @@
using Content.Server.Polymorph.Systems;
using Content.Shared.Polymorph;
using Content.Shared.Whitelist;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Prototypes;
namespace Content.Server.Polymorph.Components;
[RegisterComponent]
[Access(typeof(PolymorphSystem))]
public sealed partial class PolymorphOnCollideComponent : Component
{
[DataField("polymorph", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<PolymorphPrototype>))]
public string Polymorph = default!;
[DataField(required: true)]
public ProtoId<PolymorphPrototype> Polymorph;
[DataField("whitelist", required: true)]
[DataField(required: true)]
public EntityWhitelist Whitelist = default!;
[DataField("blacklist")]
[DataField]
public EntityWhitelist? Blacklist;
[DataField]
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Magic/forcewall.ogg");
}

View File

@@ -1,27 +1,28 @@
using Content.Server.Polymorph.Systems;
using Content.Shared.Polymorph;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Prototypes;
namespace Content.Server.Polymorph.Components
namespace Content.Server.Polymorph.Components;
[RegisterComponent]
[Access(typeof(PolymorphSystem))]
public sealed partial class PolymorphableComponent : Component
{
[RegisterComponent]
public sealed partial class PolymorphableComponent : Component
{
/// <summary>
/// A list of all the polymorphs that the entity has.
/// Used to manage them and remove them if needed.
/// </summary>
public Dictionary<string, EntityUid>? PolymorphActions = null;
/// <summary>
/// A list of all the polymorphs that the entity has.
/// Used to manage them and remove them if needed.
/// </summary>
public Dictionary<ProtoId<PolymorphPrototype>, EntityUid>? PolymorphActions = null;
/// <summary>
/// Timestamp for when the most recent polymorph ended.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public TimeSpan? LastPolymorphEnd = null;
/// <summary>
/// Timestamp for when the most recent polymorph ended.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public TimeSpan? LastPolymorphEnd = null;
/// <summary>
/// The polymorphs that the entity starts out being able to do.
/// </summary>
[DataField("innatePolymorphs", customTypeSerializer : typeof(PrototypeIdListSerializer<PolymorphPrototype>))]
public List<string>? InnatePolymorphs;
}
/// The polymorphs that the entity starts out being able to do.
/// </summary>
[DataField]
public List<ProtoId<PolymorphPrototype>>? InnatePolymorphs;
}

View File

@@ -1,31 +1,32 @@
using Content.Server.Polymorph.Systems;
using Content.Shared.Polymorph;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Polymorph.Components
namespace Content.Server.Polymorph.Components;
[RegisterComponent]
[Access(typeof(PolymorphSystem))]
public sealed partial class PolymorphedEntityComponent : Component
{
[RegisterComponent]
public sealed partial class PolymorphedEntityComponent : Component
{
/// <summary>
/// The polymorph prototype, used to track various information
/// about the polymorph
/// </summary>
[DataField("prototype", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<PolymorphPrototype>))]
public string Prototype = string.Empty;
/// <summary>
/// The polymorph prototype, used to track various information
/// about the polymorph
/// </summary>
[DataField(required: true)]
public PolymorphConfiguration Configuration = new();
/// <summary>
/// The original entity that the player will revert back into
/// </summary>
[DataField("parent", required: true)]
public EntityUid Parent;
/// <summary>
/// The original entity that the player will revert back into
/// </summary>
[DataField(required: true)]
public EntityUid Parent;
/// <summary>
/// The amount of time that has passed since the entity was created
/// used for tracking the duration
/// </summary>
[DataField("time")]
public float Time;
/// <summary>
/// The amount of time that has passed since the entity was created
/// used for tracking the duration
/// </summary>
[DataField]
public float Time;
[DataField] public EntityUid? Action;
}
[DataField]
public EntityUid? Action;
}