Fix handlabeler/utility belt misprediction (#26660)

* Fix handlabeler/utility belt misprediction

* Partly moved HandLabelerSystem to shared
And cleaned up HandLabelerComponent

* WIP format the files so later commits look clearer
Doesn't change individual code lines, but may move
functions to another file

* WIP some more code movement

* Hand Labeler is now mostly predicted
Only the UI isn't

* WIP: Formatting and moved stuff

* Using componentstates for prediction correction

* review

* Update label on label change

* Don't overwrite label while editing

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
This commit is contained in:
osjarw
2024-04-28 07:19:30 +03:00
committed by GitHub
parent 1c78f60bc3
commit a4504e2fef
10 changed files with 250 additions and 190 deletions

View File

@@ -1,47 +1,27 @@
using Robust.Shared.Serialization;
namespace Content.Shared.Labels
namespace Content.Shared.Labels;
/// <summary>
/// Key representing which <see cref="PlayerBoundUserInterface"/> is currently open.
/// Useful when there are multiple UI for an object. Here it's future-proofing only.
/// </summary>
[Serializable, NetSerializable]
public enum HandLabelerUiKey
{
/// <summary>
/// Key representing which <see cref="PlayerBoundUserInterface"/> is currently open.
/// Useful when there are multiple UI for an object. Here it's future-proofing only.
/// </summary>
[Serializable, NetSerializable]
public enum HandLabelerUiKey
{
Key,
}
[Serializable, NetSerializable]
public enum PaperLabelVisuals : byte
{
Layer,
HasLabel,
LabelType
}
/// <summary>
/// Represents a <see cref="HandLabelerComponent"/> state that can be sent to the client
/// </summary>
[Serializable, NetSerializable]
public sealed class HandLabelerBoundUserInterfaceState : BoundUserInterfaceState
{
public string CurrentLabel { get; }
public HandLabelerBoundUserInterfaceState(string currentLabel)
{
CurrentLabel = currentLabel;
}
}
[Serializable, NetSerializable]
public sealed class HandLabelerLabelChangedMessage : BoundUserInterfaceMessage
{
public string Label { get; }
public HandLabelerLabelChangedMessage(string label)
{
Label = label;
}
}
Key,
}
[Serializable, NetSerializable]
public enum PaperLabelVisuals : byte
{
Layer,
HasLabel,
LabelType
}
[Serializable, NetSerializable]
public sealed class HandLabelerLabelChangedMessage(string label) : BoundUserInterfaceMessage
{
public string Label { get; } = label;
}