ConstructionComponent.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Content.Shared.Construction.Prototypes;
  2. using Content.Shared.DoAfter;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  4. namespace Content.Server.Construction.Components
  5. {
  6. [RegisterComponent, Access(typeof(ConstructionSystem))]
  7. public sealed partial class ConstructionComponent : Component
  8. {
  9. [DataField("graph", required:true, customTypeSerializer:typeof(PrototypeIdSerializer<ConstructionGraphPrototype>))]
  10. public string Graph { get; set; } = string.Empty;
  11. [DataField("node", required:true)]
  12. public string Node { get; set; } = default!;
  13. [DataField("edge")]
  14. public int? EdgeIndex { get; set; } = null;
  15. [DataField("step")]
  16. public int StepIndex { get; set; } = 0;
  17. [DataField("containers")]
  18. public HashSet<string> Containers { get; set; } = new();
  19. [DataField("defaultTarget")]
  20. public string? TargetNode { get; set; } = null;
  21. [ViewVariables]
  22. public int? TargetEdgeIndex { get; set; } = null;
  23. [ViewVariables]
  24. public Queue<string>? NodePathfinding { get; set; } = null;
  25. [DataField("deconstructionTarget")]
  26. public string? DeconstructionNode { get; set; } = "start";
  27. [DataField("cost")]
  28. public int BuildCost { get; set; } = 0;
  29. [DataField("time")]
  30. public int BuildTime { get; set; } = 0;
  31. [DataField("material")]
  32. public string BuildMaterial { get; set; } = "WooodPlank";
  33. [DataField("agemax")]
  34. public int AgeMax { get; set; } = 8;
  35. [DataField("agemin")]
  36. public int AgeMin { get; set; } = 0;
  37. [ViewVariables]
  38. // TODO Force flush interaction queue before serializing to YAML.
  39. // Otherwise you can end up with entities stuck in invalid states (e.g., waiting for DoAfters).
  40. public readonly Queue<object> InteractionQueue = new();
  41. }
  42. }