mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-04 05:17:28 +00:00
* Initial port of goobstation factorio, missing disposals integration and faxing. Also ports impstations modification for robotic arms to have static power draw. Also adds automation slots to silos and advanced microwave. * Ports goobstation factorio fax automation, adds to the guidebook entry info about gas canisters. * Ported Goob Disposals. Removed part about taking mats out of storage silo cuz it ain't implemented yet. Seems to work. * Adds constructor circuitboard to research cuz I forgor
62 lines
1.8 KiB
C#
62 lines
1.8 KiB
C#
using System.Threading.Tasks;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Shared.DoAfter;
|
|
|
|
[RegisterComponent, NetworkedComponent]
|
|
[Access(typeof(SharedDoAfterSystem))]
|
|
public sealed partial class DoAfterComponent : Component
|
|
{
|
|
[DataField("nextId")]
|
|
public ushort NextId;
|
|
|
|
[DataField("doAfters")]
|
|
public Dictionary<ushort, DoAfter> DoAfters = new();
|
|
|
|
/// <summary>
|
|
/// Goobstation - Whether to raise <c>DoAfterEndedEvent</c> on the user after it ends.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool RaiseEndedEvent;
|
|
|
|
// Used by obsolete async do afters
|
|
public readonly Dictionary<ushort, TaskCompletionSource<DoAfterStatus>> AwaitedDoAfters = new();
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public sealed class DoAfterComponentState : ComponentState
|
|
{
|
|
public readonly ushort NextId;
|
|
public readonly Dictionary<ushort, DoAfter> DoAfters;
|
|
|
|
public DoAfterComponentState(IEntityManager entManager, DoAfterComponent component)
|
|
{
|
|
NextId = component.NextId;
|
|
|
|
// Cursed test bugs - See CraftingTests.CancelCraft
|
|
// The following is wrapped in an if DEBUG. This is tests don't (de)serialize net messages and just copy objects
|
|
// by reference. This means that the server will directly modify cached server states on the client's end.
|
|
// Crude fix at the moment is to used modified state handling while in debug mode Otherwise, this test cannot work.
|
|
#if !DEBUG
|
|
DoAfters = component.DoAfters;
|
|
#else
|
|
DoAfters = new();
|
|
foreach (var (id, doAfter) in component.DoAfters)
|
|
{
|
|
var newDoAfter = new DoAfter(entManager, doAfter);
|
|
DoAfters.Add(id, newDoAfter);
|
|
}
|
|
#endif
|
|
}
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public enum DoAfterStatus : byte
|
|
{
|
|
Invalid,
|
|
Running,
|
|
Cancelled,
|
|
Finished,
|
|
}
|