Random spontaneous cleanup PR (#25131)
* Use new Subs.CVar helper Removes manual config OnValueChanged calls, removes need to remember to manually unsubscribe. This both reduces boilerplate and fixes many issues where subscriptions weren't removed on entity system shutdown. * Fix a bunch of warnings * More warning fixes * Use new DateTime serializer to get rid of ISerializationHooks in changelog code. * Get rid of some more ISerializationHooks for enums * And a little more * Apply suggestions from code review Co-authored-by: 0x6273 <0x40@keemail.me> --------- Co-authored-by: 0x6273 <0x40@keemail.me>
This commit is contained in:
committed by
GitHub
parent
d0c174388c
commit
68ce53ae17
@@ -1,5 +1,4 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Alert
|
||||
@@ -8,7 +7,7 @@ namespace Content.Shared.Alert
|
||||
/// An alert popup with associated icon, tooltip, and other data.
|
||||
/// </summary>
|
||||
[Prototype("alert")]
|
||||
public sealed partial class AlertPrototype : IPrototype, ISerializationHooks
|
||||
public sealed partial class AlertPrototype : IPrototype
|
||||
{
|
||||
[ViewVariables]
|
||||
string IPrototype.ID => AlertType.ToString();
|
||||
@@ -52,7 +51,7 @@ namespace Content.Shared.Alert
|
||||
/// Key which is unique w.r.t category semantics (alerts with same category have equal keys,
|
||||
/// alerts with no category have different keys).
|
||||
/// </summary>
|
||||
public AlertKey AlertKey { get; private set; }
|
||||
public AlertKey AlertKey => new(AlertType, Category);
|
||||
|
||||
/// <summary>
|
||||
/// -1 (no effect) unless MaxSeverity is specified. Defaults to 1. Minimum severity level supported by this state.
|
||||
@@ -80,16 +79,6 @@ namespace Content.Shared.Alert
|
||||
[DataField("onClick", serverOnly: true)]
|
||||
public IAlertClick? OnClick { get; private set; }
|
||||
|
||||
void ISerializationHooks.AfterDeserialization()
|
||||
{
|
||||
if (AlertType == AlertType.Error)
|
||||
{
|
||||
Logger.ErrorS("alert", "missing or invalid alertType for alert with name {0}", Name);
|
||||
}
|
||||
|
||||
AlertKey = new AlertKey(AlertType, Category);
|
||||
}
|
||||
|
||||
/// <param name="severity">severity level, if supported by this alert</param>
|
||||
/// <returns>the icon path to the texture for the provided severity level</returns>
|
||||
public SpriteSpecifier GetIcon(short? severity = null)
|
||||
|
||||
Reference in New Issue
Block a user