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.

SpawnPoint.cs 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System;
  2. using RobocraftX.Blocks;
  3. using RobocraftX.Common;
  4. using Gamecraft.CharacterVulnerability;
  5. using Svelto.ECS;
  6. using Unity.Mathematics;
  7. using GamecraftModdingAPI;
  8. using GamecraftModdingAPI.Utility;
  9. namespace GamecraftModdingAPI.Blocks
  10. {
  11. public class SpawnPoint : Block
  12. {
  13. public SpawnPoint(EGID id) : base(id)
  14. {
  15. }
  16. public SpawnPoint(uint id) : base(new EGID(id, CommonExclusiveGroups.BUILD_SPAWNPOINT_BLOCK_GROUP))
  17. {
  18. }
  19. // custom spawn point properties
  20. /// <summary>
  21. /// The lives the player spawns in with.
  22. /// </summary>
  23. public uint Lives
  24. {
  25. get => BlockEngine.GetBlockInfo(this, (SpawnPointStatsEntityStruct st) => st.lives);
  26. set
  27. {
  28. BlockEngine.SetBlockInfo(this, (ref SpawnPointStatsEntityStruct st, uint val) => st.lives = val, value);
  29. }
  30. }
  31. /// <summary>
  32. /// Whether the spawned player can take damage.
  33. /// </summary>
  34. public bool Damageable
  35. {
  36. get => BlockEngine.GetBlockInfo(this, (SpawnPointStatsEntityStruct st) => st.canTakeDamage);
  37. set
  38. {
  39. BlockEngine.SetBlockInfo(this, (ref SpawnPointStatsEntityStruct st, bool val) => st.canTakeDamage = val, value);
  40. }
  41. }
  42. /// <summary>
  43. /// Whether the game over screen will be displayed
  44. /// </summary>
  45. public bool GameOverEnabled
  46. {
  47. get => BlockEngine.GetBlockInfo(this, (SpawnPointStatsEntityStruct st) => st.gameOverScreen);
  48. set
  49. {
  50. BlockEngine.SetBlockInfo(this, (ref SpawnPointStatsEntityStruct st, bool val) => st.gameOverScreen = val, value);
  51. }
  52. }
  53. /// <summary>
  54. /// The team id for players who spawn here.
  55. /// </summary>
  56. public byte Team
  57. {
  58. get => BlockEngine.GetBlockInfo(this, (SpawnPointIdsEntityStruct st) => st.teamId);
  59. set
  60. {
  61. BlockEngine.SetBlockInfo(this, (ref SpawnPointIdsEntityStruct st, byte val) => st.teamId = val, value);
  62. }
  63. }
  64. }
  65. }