using System; using RobocraftX.Blocks; using RobocraftX.Common; using Gamecraft.CharacterVulnerability; using Svelto.ECS; using Unity.Mathematics; using GamecraftModdingAPI; using GamecraftModdingAPI.Utility; namespace GamecraftModdingAPI.Blocks { public class SpawnPoint : Block { public SpawnPoint(EGID id) : base(id) { if (!BlockEngine.GetBlockInfoExists(this.Id)) { throw new BlockTypeException($"Block is not a {this.GetType().Name} block"); } } public SpawnPoint(uint id) : base(new EGID(id, CommonExclusiveGroups.BUILD_SPAWNPOINT_BLOCK_GROUP)) { if (!BlockEngine.GetBlockInfoExists(this.Id)) { throw new BlockTypeException($"Block is not a {this.GetType().Name} block"); } } // custom spawn point properties /// /// The lives the player spawns in with. /// public uint Lives { get { return BlockEngine.GetBlockInfo(Id).lives; } set { ref SpawnPointStatsEntityStruct spses = ref BlockEngine.GetBlockInfo(Id); spses.lives = value; } } /// /// Whether the spawned player can take damage. /// public bool Damageable { get { return BlockEngine.GetBlockInfo(Id).canTakeDamage; } set { ref SpawnPointStatsEntityStruct spses = ref BlockEngine.GetBlockInfo(Id); spses.canTakeDamage = value; } } /// /// Whether the game over screen will be displayed /// public bool GameOverEnabled { get { return BlockEngine.GetBlockInfo(Id).gameOverScreen; } set { ref SpawnPointStatsEntityStruct spses = ref BlockEngine.GetBlockInfo(Id); spses.gameOverScreen = value; } } /// /// The team id for players who spawn here. /// public byte Team { get { return BlockEngine.GetBlockInfo(Id).teamId; } set { ref SpawnPointIdsEntityStruct spses = ref BlockEngine.GetBlockInfo(Id); spses.teamId = value; } } } }