1
0

ContentTileDefinition.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. using Content.Shared.Atmos;
  2. using Content.Shared.Light.Components;
  3. using Content.Shared.Movement.Systems;
  4. using Content.Shared.Tools;
  5. using Robust.Shared.Audio;
  6. using Robust.Shared.Map;
  7. using Robust.Shared.Prototypes;
  8. using Robust.Shared.Serialization;
  9. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  10. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
  11. using Robust.Shared.Utility;
  12. namespace Content.Shared.Maps
  13. {
  14. [Prototype("tile")]
  15. public sealed partial class ContentTileDefinition : IPrototype, IInheritingPrototype, ITileDefinition
  16. {
  17. [ValidatePrototypeId<ToolQualityPrototype>]
  18. public const string PryingToolQuality = "Prying";
  19. public const string SpaceID = "Space";
  20. [ParentDataFieldAttribute(typeof(AbstractPrototypeIdArraySerializer<ContentTileDefinition>))]
  21. public string[]? Parents { get; private set; }
  22. [NeverPushInheritance]
  23. [AbstractDataFieldAttribute]
  24. public bool Abstract { get; private set; }
  25. [IdDataField] public string ID { get; private set; } = string.Empty;
  26. public ushort TileId { get; private set; }
  27. [DataField("name")]
  28. public string Name { get; private set; } = "";
  29. [DataField("sprite")] public ResPath? Sprite { get; private set; }
  30. [DataField("edgeSprites")] public Dictionary<Direction, ResPath> EdgeSprites { get; private set; } = new();
  31. [DataField("edgeSpritePriority")] public int EdgeSpritePriority { get; private set; } = 0;
  32. [DataField("isSubfloor")] public bool IsSubFloor { get; private set; }
  33. [DataField("biome")] public string Biome { get; private set; } = "Temperate";
  34. [DataField("suffix")] public string Suffix { get; private set; } = "";
  35. [DataField("baseTurf")]
  36. public string BaseTurf { get; private set; } = string.Empty;
  37. [DataField]
  38. public PrototypeFlags<ToolQualityPrototype> DeconstructTools { get; set; } = new();
  39. /// <remarks>
  40. /// Legacy AF but nice to have.
  41. /// </remarks>
  42. public bool CanCrowbar => DeconstructTools.Contains(PryingToolQuality);
  43. /// <summary>
  44. /// These play when the mob has shoes on.
  45. /// </summary>
  46. [DataField("footstepSounds")] public SoundSpecifier? FootstepSounds { get; private set; }
  47. /// <summary>
  48. /// These play when the mob has no shoes on.
  49. /// </summary>
  50. [DataField("barestepSounds")] public SoundSpecifier? BarestepSounds { get; private set; } = new SoundCollectionSpecifier("BarestepHard");
  51. [DataField("friction")] public float Friction { get; set; } = 0.2f;
  52. [DataField("variants")] public byte Variants { get; set; } = 1;
  53. /// <summary>
  54. /// This controls what variants the `variantize` command is allowed to use.
  55. /// </summary>
  56. [DataField("placementVariants")] public float[] PlacementVariants { get; set; } = { 1f };
  57. [DataField("thermalConductivity")] public float ThermalConductivity = 0.04f;
  58. // Heat capacity is opt-in, not opt-out.
  59. [DataField("heatCapacity")] public float HeatCapacity = Atmospherics.MinimumHeatCapacity;
  60. [DataField("itemDrop", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
  61. public string ItemDropPrototypeName { get; private set; } = "FloorTileItemSteel";
  62. // TODO rename data-field in yaml
  63. /// <summary>
  64. /// Whether or not the tile is exposed to the map's atmosphere.
  65. /// </summary>
  66. [DataField("isSpace")] public bool MapAtmosphere { get; private set; }
  67. /// <summary>
  68. /// Friction override for mob mover in <see cref="SharedMoverController"/>
  69. /// </summary>
  70. [DataField("mobFriction")]
  71. public float? MobFriction { get; private set; }
  72. /// <summary>
  73. /// No-input friction override for mob mover in <see cref="SharedMoverController"/>
  74. /// </summary>
  75. [DataField("mobFrictionNoInput")]
  76. public float? MobFrictionNoInput { get; private set; }
  77. /// <summary>
  78. /// Accel override for mob mover in <see cref="SharedMoverController"/>
  79. /// </summary>
  80. [DataField("mobAcceleration")]
  81. public float? MobAcceleration { get; private set; }
  82. [DataField("sturdy")] public bool Sturdy { get; private set; } = true;
  83. /// <summary>
  84. /// Can weather affect this tile.
  85. /// </summary>
  86. [DataField("weather")] public bool Weather = false;
  87. /// <summary>
  88. /// Is this tile immune to RCD deconstruct.
  89. /// </summary>
  90. [DataField("indestructible")] public bool Indestructible = false;
  91. public void AssignTileId(ushort id)
  92. {
  93. TileId = id;
  94. }
  95. }
  96. }