A stable modding interface between Techblox and mods https://mod.exmods.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
3.3KB

  1. using System;
  2. using DataLoader;
  3. namespace GamecraftModdingAPI.Blocks
  4. {
  5. [AttributeUsage(AttributeTargets.Class)]
  6. public class CustomBlockAttribute : Attribute
  7. {
  8. /// <summary>
  9. /// Custom block attribute necessary for configuration.
  10. /// </summary>
  11. /// <param name="catalog">File path to the catalog.json that holds asset references for the custom block</param>
  12. /// <param name="assetPath">The path/address to the block's prefab specified in Unity</param>
  13. /// <param name="nameKey">The translation key for the block's name</param>
  14. /// <param name="spriteName">The path to the inventory sprite for the block, console block by default</param>
  15. /// <param name="descKey">The translation key for the block's description</param>
  16. public CustomBlockAttribute(string catalog, string assetPath, string nameKey,
  17. string spriteName = "CTR_CommandBlock", string descKey = "")
  18. {
  19. Catalog = catalog;
  20. AssetPath = assetPath;
  21. SpriteName = spriteName;
  22. NameKey = nameKey;
  23. DescKey = descKey;
  24. }
  25. /// <summary>
  26. /// The location of the catalog.json file used to find assets for this block.
  27. /// </summary>
  28. public string Catalog { get; }
  29. /// <summary>
  30. /// The asset path/address for the block's prefab.
  31. /// </summary>
  32. public string AssetPath { get; }
  33. /// <summary>
  34. /// The name of the sprite used in the inventory.
  35. /// </summary>
  36. public string SpriteName { get; }
  37. /// <summary>
  38. /// The translation key for the block's name.
  39. /// </summary>
  40. public string NameKey { get; }
  41. /// <summary>
  42. /// The translation key for the block's description.
  43. /// </summary>
  44. public string DescKey { get; }
  45. /// <summary>
  46. /// The block's type - block, joint, light.
  47. /// </summary>
  48. public CubeType Type { get; set; } = CubeType.Block;
  49. /// <summary>
  50. /// The block's category, so it's treated as a pre-existing functional block.
  51. /// </summary>
  52. public CubeCategory Category { get; set; } = CubeCategory.General;
  53. /// <summary>
  54. /// The block's inventory category.
  55. /// </summary>
  56. public InventoryCategory InventoryCategory { get; set; } = InventoryCategory.Shapes;
  57. /// <summary>
  58. /// The block's mass.
  59. /// </summary>
  60. public float Mass { get; set; } = 1f;
  61. /// <summary>
  62. /// The key of the material properties this block should use.
  63. /// </summary>
  64. public string Material { get; set; } = "Aluminium";
  65. /// <summary>
  66. /// The scaling permission determining what scaling is allowed on this block.
  67. /// </summary>
  68. public ScalingPermission ScalingPermission { get; set; }
  69. /// <summary>
  70. /// The sort index in the inventory.
  71. /// </summary>
  72. public int SortIndex { get; set; }
  73. /// <summary>
  74. /// The default color of the block when placed.
  75. /// </summary>
  76. public BlockColor DefaultColor { get; set; }
  77. /// <summary>
  78. /// The volume of the block.
  79. /// </summary>
  80. public float Volume { get; set; } = 1f;
  81. }
  82. }