FlatpackCreatorComponent.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using Content.Shared.Materials;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Prototypes;
  4. using Robust.Shared.Serialization;
  5. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  6. namespace Content.Shared.Construction.Components;
  7. /// <summary>
  8. /// This is used for a machine that creates flatpacks at the cost of materials
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent]
  11. [Access(typeof(SharedFlatpackSystem))]
  12. [AutoGenerateComponentState, AutoGenerateComponentPause]
  13. public sealed partial class FlatpackCreatorComponent : Component
  14. {
  15. /// <summary>
  16. /// Whether or not packing is occuring
  17. /// </summary>
  18. [DataField, ViewVariables(VVAccess.ReadWrite)]
  19. [AutoNetworkedField]
  20. public bool Packing;
  21. /// <summary>
  22. /// The time at which packing ends
  23. /// </summary>
  24. [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
  25. [AutoNetworkedField]
  26. [AutoPausedField]
  27. public TimeSpan PackEndTime;
  28. /// <summary>
  29. /// How long packing lasts.
  30. /// </summary>
  31. [DataField, ViewVariables(VVAccess.ReadWrite)]
  32. public TimeSpan PackDuration = TimeSpan.FromSeconds(3);
  33. /// <summary>
  34. /// The prototype used when spawning a flatpack.
  35. /// </summary>
  36. [DataField, ViewVariables(VVAccess.ReadWrite)]
  37. public EntProtoId BaseFlatpackPrototype = "BaseFlatpack";
  38. /// <summary>
  39. /// A default cost applied to all flatpacks outside of the cost of constructing the machine.
  40. /// This one is applied to machines specifically.
  41. /// </summary>
  42. [DataField]
  43. public Dictionary<ProtoId<MaterialPrototype>, int> BaseMachineCost = new();
  44. /// <summary>
  45. /// A default cost applied to all flatpacks outside of the cost of constructing the machine.
  46. /// This one is applied to computers specifically.
  47. /// </summary>
  48. [DataField]
  49. public Dictionary<ProtoId<MaterialPrototype>, int> BaseComputerCost = new();
  50. [DataField, ViewVariables(VVAccess.ReadWrite)]
  51. public string SlotId = "board_slot";
  52. }
  53. [Serializable, NetSerializable]
  54. public enum FlatpackCreatorUIKey : byte
  55. {
  56. Key
  57. }
  58. [Serializable, NetSerializable]
  59. public enum FlatpackCreatorVisuals : byte
  60. {
  61. Packing
  62. }
  63. [Serializable, NetSerializable]
  64. public sealed class FlatpackCreatorStartPackBuiMessage : BoundUserInterfaceMessage
  65. {
  66. }