Refactor body component to use slots instead of an army of dictionaries (#3749)
* Refactor body component to use slots instead of an army of dictionaries * Update vox * Replace static method call with extension * Add setpart method, replace dispose with shutdown * Fix tests, fix not listening to slot events when setting a part
This commit is contained in:
@@ -15,6 +15,11 @@ namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
/// </summary>
|
||||
IBody? Body { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The string to show when displaying this part's name to players.
|
||||
/// </summary>
|
||||
string DisplayName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="BodyPartType"/> that this <see cref="IBodyPart"/> is considered
|
||||
/// to be.
|
||||
|
||||
@@ -20,20 +20,20 @@ namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
|
||||
public class BodyPartAddedEventArgs : EventArgs
|
||||
{
|
||||
public BodyPartAddedEventArgs(IBodyPart part, string slot)
|
||||
public BodyPartAddedEventArgs(string slot, IBodyPart part)
|
||||
{
|
||||
Part = part;
|
||||
Slot = slot;
|
||||
Part = part;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The part that was added.
|
||||
/// </summary>
|
||||
public IBodyPart Part { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The slot that <see cref="Part"/> was added to.
|
||||
/// </summary>
|
||||
public string Slot { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The part that was added.
|
||||
/// </summary>
|
||||
public IBodyPart Part { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,20 +19,20 @@ namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
|
||||
public class BodyPartRemovedEventArgs : EventArgs
|
||||
{
|
||||
public BodyPartRemovedEventArgs(IBodyPart part, string slot)
|
||||
public BodyPartRemovedEventArgs(string slot, IBodyPart part)
|
||||
{
|
||||
Part = part;
|
||||
Slot = slot;
|
||||
Part = part;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The part that was removed.
|
||||
/// </summary>
|
||||
public IBodyPart Part { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The slot that <see cref="Part"/> was removed from.
|
||||
/// </summary>
|
||||
public string Slot { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The part that was removed.
|
||||
/// </summary>
|
||||
public IBodyPart Part { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,9 @@ namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
}
|
||||
}
|
||||
|
||||
[ViewVariables]
|
||||
public string DisplayName => Name;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("partType")]
|
||||
public BodyPartType PartType { get; private set; } = BodyPartType.Other;
|
||||
|
||||
Reference in New Issue
Block a user