|
- using System;
- using DataLoader;
-
- namespace GamecraftModdingAPI.Blocks
- {
- [AttributeUsage(AttributeTargets.Class)]
- public class CustomBlockAttribute : Attribute
- {
- /// <summary>
- /// Custom block attribute necessary for configuration.
- /// </summary>
- /// <param name="catalog">File path to the catalog.json that holds asset references for the custom block</param>
- /// <param name="assetPath">The path/address to the block's prefab specified in Unity</param>
- /// <param name="nameKey">The translation key for the block's name</param>
- /// <param name="spriteName">The path to the inventory sprite for the block, console block by default</param>
- /// <param name="descKey">The translation key for the block's description</param>
- public CustomBlockAttribute(string catalog, string assetPath, string nameKey,
- string spriteName = "CTR_CommandBlock", string descKey = "")
- {
- Catalog = catalog;
- AssetPath = assetPath;
- SpriteName = spriteName;
- NameKey = nameKey;
- DescKey = descKey;
- }
-
- /// <summary>
- /// The location of the catalog.json file used to find assets for this block.
- /// </summary>
- public string Catalog { get; }
- /// <summary>
- /// The asset path/address for the block's prefab.
- /// </summary>
- public string AssetPath { get; }
- /// <summary>
- /// The name of the sprite used in the inventory.
- /// </summary>
- public string SpriteName { get; }
- /// <summary>
- /// The translation key for the block's name.
- /// </summary>
- public string NameKey { get; }
- /// <summary>
- /// The translation key for the block's description.
- /// </summary>
- public string DescKey { get; }
-
- /// <summary>
- /// The block's type - block, joint, light.
- /// </summary>
- public CubeType Type { get; set; } = CubeType.Block;
- /// <summary>
- /// The block's category, so it's treated as a pre-existing functional block.
- /// </summary>
- public CubeCategory Category { get; set; } = CubeCategory.General;
- /// <summary>
- /// The block's inventory category.
- /// </summary>
- public InventoryCategory InventoryCategory { get; set; } = InventoryCategory.Shapes;
- /// <summary>
- /// The block's mass.
- /// </summary>
- public float Mass { get; set; } = 1f;
- /// <summary>
- /// The key of the material properties this block should use.
- /// </summary>
- public string Material { get; set; } = "Aluminium";
- /// <summary>
- /// The scaling permission determining what scaling is allowed on this block.
- /// </summary>
- public ScalingPermission ScalingPermission { get; set; }
- /// <summary>
- /// The sort index in the inventory.
- /// </summary>
- public int SortIndex { get; set; }
- /// <summary>
- /// The default color of the block when placed.
- /// </summary>
- public BlockColor DefaultColor { get; set; }
- /// <summary>
- /// The volume of the block.
- /// </summary>
- public float Volume { get; set; } = 1f;
- }
- }
|