Files
tbd-station-14/Content.Shared/Construction/Components/FlatpackCreatorComponent.cs
SpeltIncorrectyl 082bde40ca The Flatpacker 1001 can now make flatpacks for computers. (#23471)
* moved ComputerBoardComponent to Content.Shared

* made flatpacker accept computer boards

* made flatpack system and ui function with computer boards

* fixed it so that flatpacks of computers are correctly coloured to fit their computer board colour

* unhardcoded the computer flatpack assembly cost

* Combined GetFlatpackCreationCost(...) with GetflatpackCreationCostForComputer(...)

* removed code duplication in SharedFlatpackSystem

* removed code duplication from FlatpackCreatorMenu.xaml.cs

* remove code duplication from FlatpackSystem (on the server)

* fixed indentation error
2024-01-03 23:23:47 -05:00

78 lines
2.3 KiB
C#

using Content.Shared.Materials;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Construction.Components;
/// <summary>
/// This is used for a machine that creates flatpacks at the cost of materials
/// </summary>
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedFlatpackSystem))]
[AutoGenerateComponentState]
public sealed partial class FlatpackCreatorComponent : Component
{
/// <summary>
/// Whether or not packing is occuring
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public bool Packing;
/// <summary>
/// The time at which packing ends
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public TimeSpan PackEndTime;
/// <summary>
/// How long packing lasts.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public TimeSpan PackDuration = TimeSpan.FromSeconds(3);
/// <summary>
/// The prototype used when spawning a flatpack.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public EntProtoId BaseFlatpackPrototype = "BaseFlatpack";
/// <summary>
/// A default cost applied to all flatpacks outside of the cost of constructing the machine.
/// This one is applied to machines specifically.
/// </summary>
[DataField]
public Dictionary<ProtoId<MaterialPrototype>, int> BaseMachineCost = new();
/// <summary>
/// A default cost applied to all flatpacks outside of the cost of constructing the machine.
/// This one is applied to computers specifically.
/// </summary>
[DataField]
public Dictionary<ProtoId<MaterialPrototype>, int> BaseComputerCost = new();
[DataField, ViewVariables(VVAccess.ReadWrite)]
public string SlotId = "board_slot";
}
[Serializable, NetSerializable]
public enum FlatpackCreatorUIKey : byte
{
Key
}
[Serializable, NetSerializable]
public enum FlatpackCreatorVisuals : byte
{
Packing
}
[Serializable, NetSerializable]
public sealed class FlatpackCreatorStartPackBuiMessage : BoundUserInterfaceMessage
{
}