Conveyor Belt optimization and prediction (#12929)
* belt multithreading * moves away from multithreading and changes setting awake directly to physics system method * prediction for conveyors * Fixes missing reference in FaxSystem * Fixes oddities * Adds networked to conveyor components * Some more cleanup. * reverts power change event * Removes the event, fixes a file * Should fix the rest of the weird additions * More cleanup to fix extra files * Fixes again * fix * fixes fax system * Adds component state, cleans up the dependencies * Checks for prediction * Merge conflicts * powa --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
12
Content.Shared/Conveyor/ActiveConveyorComponent.cs
Normal file
12
Content.Shared/Conveyor/ActiveConveyorComponent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Conveyor;
|
||||
|
||||
/// <summary>
|
||||
/// Used to track which conveyors are relevant in case there's a lot of them.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class ActiveConveyorComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
77
Content.Shared/Conveyor/ConveyorComponent.cs
Normal file
77
Content.Shared/Conveyor/ConveyorComponent.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using Content.Shared.MachineLinking;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Shared.Conveyor;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class ConveyorComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The angle to move entities by in relation to the owner's rotation.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("angle")]
|
||||
public Angle Angle = Angle.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of units to move the entity by per second.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("speed")]
|
||||
public float Speed = 2f;
|
||||
|
||||
/// <summary>
|
||||
/// The current state of this conveyor
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public ConveyorState State;
|
||||
|
||||
[ViewVariables]
|
||||
public bool Powered;
|
||||
|
||||
[DataField("forwardPort", customTypeSerializer: typeof(PrototypeIdSerializer<ReceiverPortPrototype>))]
|
||||
public string ForwardPort = "Forward";
|
||||
|
||||
[DataField("reversePort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
|
||||
public string ReversePort = "Reverse";
|
||||
|
||||
[DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer<TransmitterPortPrototype>))]
|
||||
public string OffPort = "Off";
|
||||
|
||||
[ViewVariables]
|
||||
public readonly HashSet<EntityUid> Intersecting = new();
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class ConveyorComponentState : ComponentState
|
||||
{
|
||||
public bool Powered;
|
||||
public Angle Angle;
|
||||
public float Speed;
|
||||
public ConveyorState State;
|
||||
|
||||
public ConveyorComponentState(Angle angle, float speed, ConveyorState state, bool powered)
|
||||
{
|
||||
Angle = angle;
|
||||
Speed = speed;
|
||||
State = state;
|
||||
Powered = powered;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum ConveyorVisuals : byte
|
||||
{
|
||||
State
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum ConveyorState : byte
|
||||
{
|
||||
Off,
|
||||
Forward,
|
||||
Reverse
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Conveyor
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public enum ConveyorVisuals
|
||||
{
|
||||
State
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum ConveyorState
|
||||
{
|
||||
Off,
|
||||
Forward,
|
||||
Reverse
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user