Predict EmitterSystem ExamineEvent and GetVerbsEvent (#39318)

* ididathing.exe

* commit

* cleanup

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
Kyle Tyo
2025-08-01 13:40:15 -04:00
committed by GitHub
parent a942ce2193
commit d805704a1f
4 changed files with 81 additions and 68 deletions

View File

@@ -3,12 +3,10 @@ using Content.Shared.DeviceLinking;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
namespace Content.Shared.Singularity.Components;
[RegisterComponent, NetworkedComponent]
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class EmitterComponent : Component
{
public CancellationTokenSource? TimerCancel;
@@ -27,8 +25,8 @@ public sealed partial class EmitterComponent : Component
/// <summary>
/// The entity that is spawned when the emitter fires.
/// </summary>
[DataField("boltType", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string BoltType = "EmitterBolt";
[DataField, AutoNetworkedField]
public EntProtoId BoltType = "EmitterBolt";
[DataField]
public List<EntProtoId> SelectableTypes = new();
@@ -36,68 +34,68 @@ public sealed partial class EmitterComponent : Component
/// <summary>
/// The current amount of power being used.
/// </summary>
[DataField("powerUseActive")]
[DataField]
public int PowerUseActive = 600;
/// <summary>
/// The amount of shots that are fired in a single "burst"
/// </summary>
[DataField("fireBurstSize")]
[DataField]
public int FireBurstSize = 3;
/// <summary>
/// The time between each shot during a burst.
/// </summary>
[DataField("fireInterval")]
[DataField]
public TimeSpan FireInterval = TimeSpan.FromSeconds(2);
/// <summary>
/// The current minimum delay between bursts.
/// </summary>
[DataField("fireBurstDelayMin")]
[DataField]
public TimeSpan FireBurstDelayMin = TimeSpan.FromSeconds(4);
/// <summary>
/// The current maximum delay between bursts.
/// </summary>
[DataField("fireBurstDelayMax")]
[DataField]
public TimeSpan FireBurstDelayMax = TimeSpan.FromSeconds(10);
/// <summary>
/// The visual state that is set when the emitter is turned on
/// </summary>
[DataField("onState")]
[DataField]
public string? OnState = "beam";
/// <summary>
/// The visual state that is set when the emitter doesn't have enough power.
/// </summary>
[DataField("underpoweredState")]
[DataField]
public string? UnderpoweredState = "underpowered";
/// <summary>
/// Signal port that turns on the emitter.
/// </summary>
[DataField("onPort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string OnPort = "On";
[DataField]
public ProtoId<SinkPortPrototype> OnPort = "On";
/// <summary>
/// Signal port that turns off the emitter.
/// </summary>
[DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string OffPort = "Off";
[DataField]
public ProtoId<SinkPortPrototype> OffPort = "Off";
/// <summary>
/// Signal port that toggles the emitter on or off.
/// </summary>
[DataField("togglePort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string TogglePort = "Toggle";
[DataField]
public ProtoId<SinkPortPrototype> TogglePort = "Toggle";
/// <summary>
/// Map of signal ports to entity prototype IDs of the entity that will be fired.
/// </summary>
[DataField("setTypePorts", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<string, SinkPortPrototype>))]
public Dictionary<string, string> SetTypePorts = new();
[DataField]
public Dictionary<ProtoId<SinkPortPrototype>, EntProtoId> SetTypePorts = new();
}
[NetSerializable, Serializable]