1
0

CivTDMFactionsComponent.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System.Collections.Generic;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Prototypes;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  5. using Robust.Shared.Serialization; // Added this line
  6. using System; // Added for [Serializable]
  7. namespace Content.Shared.Civ14.CivTDMFactions;
  8. [AutoGenerateComponentState]
  9. [RegisterComponent]
  10. [NetworkedComponent]
  11. public sealed partial class CivTDMFactionsComponent : Component
  12. {
  13. //TODO: Consider making FactionId a prototype for more structured data (color, sprite, etc.)
  14. /// <summary>
  15. /// The name of faction1
  16. /// </summary>
  17. [DataField("faction1Id", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>)), AutoNetworkedField]
  18. public string? Faction1Id { get; set; }
  19. /// <summary>
  20. /// The name of faction2
  21. /// </summary>
  22. [DataField("faction2Id", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>)), AutoNetworkedField]
  23. public string? Faction2Id { get; set; }
  24. /// <summary>
  25. /// Squads belonging to faction 1. Key is squad name (e.g., "Alpha").
  26. /// </summary>
  27. [DataField("faction1Squads"), AutoNetworkedField]
  28. public Dictionary<string, SquadData> Faction1Squads { get; set; } = new()
  29. {
  30. { "Alpha", new SquadData() },
  31. { "Bravo", new SquadData() },
  32. { "Charlie", new SquadData() }
  33. };
  34. /// <summary>
  35. /// Squads belonging to faction 2. Key is squad name (e.g., "Alpha").
  36. /// </summary>
  37. [DataField("faction2Squads"), AutoNetworkedField]
  38. public Dictionary<string, SquadData> Faction2Squads { get; set; } = new()
  39. {
  40. { "Alpha", new SquadData() },
  41. { "Bravo", new SquadData() },
  42. { "Charlie", new SquadData() }
  43. };
  44. }
  45. /// <summary>
  46. /// Holds data for a single squad, like member counts.
  47. /// </summary>
  48. [DataDefinition, NetSerializable, Serializable]
  49. public sealed partial class SquadData
  50. {
  51. [DataField("sergeantCount")] // Removed AutoNetworkedField
  52. public int SergeantCount { get; set; } = 0;
  53. [DataField("memberCount")] // Removed AutoNetworkedField
  54. public int MemberCount { get; set; } = 0;
  55. // You could add MaxSize here if it's per-squad rather than global from ShowFactionIconsSystem
  56. // [DataField("maxSize")]
  57. // public int MaxSize { get; set; } = 3;
  58. }