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.

77 lines
1.8KB

  1. using System;
  2. using RobocraftX.Blocks;
  3. using RobocraftX.Common;
  4. using Svelto.ECS;
  5. using Unity.Mathematics;
  6. using GamecraftModdingAPI;
  7. using GamecraftModdingAPI.Utility;
  8. namespace GamecraftModdingAPI.Blocks
  9. {
  10. public class ConsoleBlock : Block
  11. {
  12. public ConsoleBlock(EGID id): base(id)
  13. {
  14. if (!BlockEngine.GetBlockInfoExists<ConsoleBlockEntityStruct>(this.Id))
  15. {
  16. throw new BlockTypeException($"Block is not a {this.GetType().Name} block");
  17. }
  18. }
  19. public ConsoleBlock(uint id): base(new EGID(id, CommonExclusiveGroups.BUILD_CONSOLE_BLOCK_GROUP))
  20. {
  21. if (!BlockEngine.GetBlockInfoExists<ConsoleBlockEntityStruct>(this.Id))
  22. {
  23. throw new BlockTypeException($"Block is not a {this.GetType().Name} block");
  24. }
  25. }
  26. // custom console block properties
  27. public string Command
  28. {
  29. get
  30. {
  31. return BlockEngine.GetBlockInfo<ConsoleBlockEntityStruct>(Id).commandName;
  32. }
  33. set
  34. {
  35. BlockEngine.GetBlockInfo<ConsoleBlockEntityStruct>(Id).commandName.Set(value);
  36. }
  37. }
  38. public string Arg1
  39. {
  40. get => BlockEngine.GetBlockInfo<ConsoleBlockEntityStruct>(Id).arg1;
  41. set
  42. {
  43. BlockEngine.GetBlockInfo<ConsoleBlockEntityStruct>(Id).arg1.Set(value);
  44. }
  45. }
  46. public string Arg2
  47. {
  48. get => BlockEngine.GetBlockInfo<ConsoleBlockEntityStruct>(Id).arg2;
  49. set
  50. {
  51. BlockEngine.GetBlockInfo<ConsoleBlockEntityStruct>(Id).arg2.Set(value);
  52. }
  53. }
  54. public string Arg3
  55. {
  56. get => BlockEngine.GetBlockInfo<ConsoleBlockEntityStruct>(Id).arg3;
  57. set
  58. {
  59. BlockEngine.GetBlockInfo<ConsoleBlockEntityStruct>(Id).arg3.Set(value);
  60. }
  61. }
  62. }
  63. }