diff --git a/Items/Placeables/Furniture/AuricToilet.cs b/Items/Placeables/Furniture/AuricToilet.cs index 089a95d95d..24843682b9 100644 --- a/Items/Placeables/Furniture/AuricToilet.cs +++ b/Items/Placeables/Furniture/AuricToilet.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.FurnitureBotanic; using CalamityMod.Items.Placeables.FurnitureCosmilite; using CalamityMod.Items.Placeables.FurnitureSilva; @@ -15,7 +15,8 @@ namespace CalamityMod.Items.Placeables.Furniture { CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1; DisplayName.SetDefault("Auric Toilet"); - Tooltip.SetDefault("This was used by the gods"); + Tooltip.SetDefault("This was used by the gods \n" + + "Sitting on such a throne would be a disgrace to all"); } public override void SetDefaults() diff --git a/Items/Placeables/Walls/BlueBrickWallUnsafe.cs b/Items/Placeables/Walls/BlueBrickWallUnsafe.cs index 930752cedd..7004b256a0 100644 --- a/Items/Placeables/Walls/BlueBrickWallUnsafe.cs +++ b/Items/Placeables/Walls/BlueBrickWallUnsafe.cs @@ -1,10 +1,15 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using Terraria.GameContent.Creative; namespace CalamityMod.Items.Placeables.Walls { public class BlueBrickWallUnsafe : ModItem { + public override void SetStaticDefaults() + { + CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 400; + } + public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/Walls/BlueSlabWallUnsafe.cs b/Items/Placeables/Walls/BlueSlabWallUnsafe.cs index bd425181d0..e5bb9ffa3d 100644 --- a/Items/Placeables/Walls/BlueSlabWallUnsafe.cs +++ b/Items/Placeables/Walls/BlueSlabWallUnsafe.cs @@ -1,10 +1,15 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using Terraria.GameContent.Creative; namespace CalamityMod.Items.Placeables.Walls { public class BlueSlabWallUnsafe : ModItem { + public override void SetStaticDefaults() + { + CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 400; + } + public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/Walls/BlueTiledWallUnsafe.cs b/Items/Placeables/Walls/BlueTiledWallUnsafe.cs index 773b53744d..e950f58aea 100644 --- a/Items/Placeables/Walls/BlueTiledWallUnsafe.cs +++ b/Items/Placeables/Walls/BlueTiledWallUnsafe.cs @@ -1,10 +1,15 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using Terraria.GameContent.Creative; namespace CalamityMod.Items.Placeables.Walls { public class BlueTiledWallUnsafe : ModItem { + public override void SetStaticDefaults() + { + CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 400; + } + public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/Walls/GreenBrickWallUnsafe.cs b/Items/Placeables/Walls/GreenBrickWallUnsafe.cs index 9e989d3784..751b3a4884 100644 --- a/Items/Placeables/Walls/GreenBrickWallUnsafe.cs +++ b/Items/Placeables/Walls/GreenBrickWallUnsafe.cs @@ -1,10 +1,15 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using Terraria.GameContent.Creative; namespace CalamityMod.Items.Placeables.Walls { public class GreenBrickWallUnsafe : ModItem { + public override void SetStaticDefaults() + { + CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 400; + } + public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/Walls/GreenSlabWallUnsafe.cs b/Items/Placeables/Walls/GreenSlabWallUnsafe.cs index ea83ff2446..b5362c78b2 100644 --- a/Items/Placeables/Walls/GreenSlabWallUnsafe.cs +++ b/Items/Placeables/Walls/GreenSlabWallUnsafe.cs @@ -1,10 +1,15 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using Terraria.GameContent.Creative; namespace CalamityMod.Items.Placeables.Walls { public class GreenSlabWallUnsafe : ModItem { + public override void SetStaticDefaults() + { + CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 400; + } + public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/Walls/GreenTiledWallUnsafe.cs b/Items/Placeables/Walls/GreenTiledWallUnsafe.cs index ec248316c7..b8d7096784 100644 --- a/Items/Placeables/Walls/GreenTiledWallUnsafe.cs +++ b/Items/Placeables/Walls/GreenTiledWallUnsafe.cs @@ -1,10 +1,15 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using Terraria.GameContent.Creative; namespace CalamityMod.Items.Placeables.Walls { public class GreenTiledWallUnsafe : ModItem { + public override void SetStaticDefaults() + { + CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 400; + } + public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/Walls/PinkBrickWallUnsafe.cs b/Items/Placeables/Walls/PinkBrickWallUnsafe.cs index a5093d30dd..1c271052c5 100644 --- a/Items/Placeables/Walls/PinkBrickWallUnsafe.cs +++ b/Items/Placeables/Walls/PinkBrickWallUnsafe.cs @@ -1,10 +1,15 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using Terraria.GameContent.Creative; namespace CalamityMod.Items.Placeables.Walls { public class PinkBrickWallUnsafe : ModItem { + public override void SetStaticDefaults() + { + CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 400; + } + public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/Walls/PinkSlabWallUnsafe.cs b/Items/Placeables/Walls/PinkSlabWallUnsafe.cs index f46f892beb..3cc6812b3b 100644 --- a/Items/Placeables/Walls/PinkSlabWallUnsafe.cs +++ b/Items/Placeables/Walls/PinkSlabWallUnsafe.cs @@ -1,10 +1,15 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using Terraria.GameContent.Creative; namespace CalamityMod.Items.Placeables.Walls { public class PinkSlabWallUnsafe : ModItem { + public override void SetStaticDefaults() + { + CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 400; + } + public override void SetDefaults() { Item.width = 12; diff --git a/Items/Placeables/Walls/PinkTiledWallUnsafe.cs b/Items/Placeables/Walls/PinkTiledWallUnsafe.cs index 4649cac328..765e74cf4e 100644 --- a/Items/Placeables/Walls/PinkTiledWallUnsafe.cs +++ b/Items/Placeables/Walls/PinkTiledWallUnsafe.cs @@ -1,10 +1,14 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using Terraria.GameContent.Creative; namespace CalamityMod.Items.Placeables.Walls { public class PinkTiledWallUnsafe : ModItem { + public override void SetStaticDefaults() + { + CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 400; + } public override void SetDefaults() { Item.width = 12; diff --git a/Tiles/Furniture/AuricToiletTile.cs b/Tiles/Furniture/AuricToiletTile.cs index e7087e5928..9193284b7f 100644 --- a/Tiles/Furniture/AuricToiletTile.cs +++ b/Tiles/Furniture/AuricToiletTile.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Tiles.Furniture ModTranslation name = CreateMapEntryName(); name.SetDefault("Auric Toilet"); - AddMapEntry(new Color(191, 142, 111), name); TileID.Sets.DisableSmartCursor[Type] = true; + AddMapEntry(new Color(191, 142, 111), name); AdjTiles = new int[] { TileID.Chairs }; } diff --git a/Tiles/FurnitureAncient/AncientBed.cs b/Tiles/FurnitureAncient/AncientBed.cs index 88db57fe6b..c39f27be28 100644 --- a/Tiles/FurnitureAncient/AncientBed.cs +++ b/Tiles/FurnitureAncient/AncientBed.cs @@ -1,8 +1,10 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.GameContent.ObjectInteractions; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureAncient @@ -15,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAncient ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(191, 142, 111), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } @@ -40,9 +41,41 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool RightClick(int i, int j) { - return CalamityUtils.BedRightClick(i, j); - } + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i , j]; + int spawnX = i - tile.TileFrameX / 18 + (tile.TileFrameX >= 72 ? 5 : 2); + int spawnY = j + 2; + if (tile.TileFrameY % 38 != 0) + { + spawnY--; + } + if (!Player.IsHoveringOverABottomSideOfABed(i, j)) + { + if (player.IsWithinSnappngRangeToTile(i, j, PlayerSleepingHelper.BedSleepingMaxDistance)) + { + player.GamepadEnableGrappleCooldown(); + player.sleeping.StartSleeping(player, i, j - 1); + } + } + else + { + player.FindSpawn(); + + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText(Language.GetTextValue("Game.SpawnPointRemoved"), byte.MaxValue, 240, 20); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText(Language.GetTextValue("Game.SpawnPointSet"), byte.MaxValue, 240, 20); + } + } + + return true; + } public override void MouseOver(int i, int j) { Player player = Main.LocalPlayer; diff --git a/Tiles/FurnitureAshen/AshenBed.cs b/Tiles/FurnitureAshen/AshenBed.cs index d688424f0e..e4eeaa1d92 100644 --- a/Tiles/FurnitureAshen/AshenBed.cs +++ b/Tiles/FurnitureAshen/AshenBed.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Tiles.FurnitureAshen ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(191, 142, 111), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } diff --git a/Tiles/FurnitureAstral/MonolithBed.cs b/Tiles/FurnitureAstral/MonolithBed.cs index bfaa48fe13..66f7ba4ae1 100644 --- a/Tiles/FurnitureAstral/MonolithBed.cs +++ b/Tiles/FurnitureAstral/MonolithBed.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureAstral ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(191, 142, 111), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } diff --git a/Tiles/FurnitureBotanic/BotanicBed.cs b/Tiles/FurnitureBotanic/BotanicBed.cs index d42ef68a74..751a0557c3 100644 --- a/Tiles/FurnitureBotanic/BotanicBed.cs +++ b/Tiles/FurnitureBotanic/BotanicBed.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(191, 142, 111), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBed.cs b/Tiles/FurnitureCosmilite/CosmiliteBed.cs index b6f554c31e..70d170905e 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBed.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(191, 142, 111), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } diff --git a/Tiles/FurnitureEutrophic/EutrophicBed.cs b/Tiles/FurnitureEutrophic/EutrophicBed.cs index 25a03c95b0..d857e825db 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBed.cs +++ b/Tiles/FurnitureEutrophic/EutrophicBed.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(191, 142, 111), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } diff --git a/Tiles/FurnitureExo/ExoBedTile.cs b/Tiles/FurnitureExo/ExoBedTile.cs index d970f763ab..467db41a76 100644 --- a/Tiles/FurnitureExo/ExoBedTile.cs +++ b/Tiles/FurnitureExo/ExoBedTile.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureExo ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(71, 95, 114), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } diff --git a/Tiles/FurnitureExo/ExoToiletTile.cs b/Tiles/FurnitureExo/ExoToiletTile.cs index 972c10cc4b..802eafbfdc 100644 --- a/Tiles/FurnitureExo/ExoToiletTile.cs +++ b/Tiles/FurnitureExo/ExoToiletTile.cs @@ -4,6 +4,8 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -12,6 +14,7 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoToiletTile : ModTile { + public const int NextStyleHeight = 40; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -39,6 +42,8 @@ namespace CalamityMod.Tiles.FurnitureExo ModTranslation name = CreateMapEntryName(); name.SetDefault("Exo Toilet"); AddMapEntry(new Color(71, 95, 114), name); + TileID.Sets.CanBeSatOnForNPCs[Type] = true; + TileID.Sets.CanBeSatOnForPlayers[Type] = true; TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Chairs }; } @@ -75,5 +80,75 @@ namespace CalamityMod.Tiles.FurnitureExo else if (trackTile.IsHalfBlock) spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) + { + Tile tile = Framing.GetTileSafely(i, j); + + info.TargetDirection = -1; + if (tile.TileFrameX != 0) + { + info.TargetDirection = 1; + } + + info.AnchorTilePosition.X = i; + info.AnchorTilePosition.Y = j; + + if (tile.TileFrameY % NextStyleHeight == 0) + { + info.AnchorTilePosition.Y++; + } + } + + public override bool RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + + if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) + { + player.GamepadEnableGrappleCooldown(); + player.sitting.SitDown(player, i, j); + } + return true; + } + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + + if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) + { + return; + } + + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + + if (Main.tile[i, j].TileFrameX / 18 < 1) + { + player.cursorItemIconReversed = true; + } + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + + public override void HitWire(int i, int j) // I hate this please make it stop. - Merkalto + { + Tile tile = Main.tile[i, j]; + + int spawnX = i; + int spawnY = j - (tile.TileFrameY % NextStyleHeight) / 18; + + Wiring.SkipWire(spawnX, spawnY); + Wiring.SkipWire(spawnX, spawnY + 1); + + if (Wiring.CheckMech(spawnX, spawnY, 60)) + { + Projectile.NewProjectile(Wiring.GetProjectileSource(spawnX, spawnY), spawnX * 16 + 8, spawnY * 16 + 12, 0f, 0f, ProjectileID.ToiletEffect, 0, 0f, Main.myPlayer); + } + } } } diff --git a/Tiles/FurnitureOccult/OccultBed.cs b/Tiles/FurnitureOccult/OccultBed.cs index 33abab1785..222f1b5596 100644 --- a/Tiles/FurnitureOccult/OccultBed.cs +++ b/Tiles/FurnitureOccult/OccultBed.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureOccult ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(191, 142, 111), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } diff --git a/Tiles/FurnitureProfaned/ProfanedBed.cs b/Tiles/FurnitureProfaned/ProfanedBed.cs index 23fc79151a..fb9e7c3f6c 100644 --- a/Tiles/FurnitureProfaned/ProfanedBed.cs +++ b/Tiles/FurnitureProfaned/ProfanedBed.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(191, 142, 111), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } diff --git a/Tiles/FurnitureSilva/SilvaBed.cs b/Tiles/FurnitureSilva/SilvaBed.cs index e692966e87..fee7a8b199 100644 --- a/Tiles/FurnitureSilva/SilvaBed.cs +++ b/Tiles/FurnitureSilva/SilvaBed.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Tiles.FurnitureSilva ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(191, 142, 111), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } diff --git a/Tiles/FurnitureStatigel/StatigelBed.cs b/Tiles/FurnitureStatigel/StatigelBed.cs index dee6198311..d786759cc1 100644 --- a/Tiles/FurnitureStatigel/StatigelBed.cs +++ b/Tiles/FurnitureStatigel/StatigelBed.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(191, 142, 111), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } diff --git a/Tiles/FurnitureStratus/StratusBed.cs b/Tiles/FurnitureStratus/StratusBed.cs index ee062a690d..74a3044499 100644 --- a/Tiles/FurnitureStratus/StratusBed.cs +++ b/Tiles/FurnitureStratus/StratusBed.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Tiles.FurnitureStratus ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(191, 142, 111), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } diff --git a/Tiles/FurnitureVoid/VoidBed.cs b/Tiles/FurnitureVoid/VoidBed.cs index 18522fe05a..06acc713cf 100644 --- a/Tiles/FurnitureVoid/VoidBed.cs +++ b/Tiles/FurnitureVoid/VoidBed.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Tiles.FurnitureVoid ModTranslation name = CreateMapEntryName(); name.SetDefault("Bed"); AddMapEntry(new Color(191, 142, 111), name); - TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Beds }; } diff --git a/Utilities/FurnitureSetupUtils.cs b/Utilities/FurnitureSetupUtils.cs index b8c80c332d..229f395895 100644 --- a/Utilities/FurnitureSetupUtils.cs +++ b/Utilities/FurnitureSetupUtils.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; using Terraria.ObjectData; using static Terraria.ModLoader.ModContent; using Terraria.Audio; +using Terraria.GameContent; namespace CalamityMod { @@ -30,24 +31,37 @@ namespace CalamityMod { Player player = Main.LocalPlayer; Tile tile = Main.tile[i, j]; - int spawnX = i - tile.TileFrameX / 18; + int spawnX = i - tile.TileFrameX / 18 + (tile.TileFrameX >= 72 ? 5 : 2); int spawnY = j + 2; - spawnX += tile.TileFrameX >= 72 ? 5 : 2; if (tile.TileFrameY % 38 != 0) { spawnY--; } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) + + if (!Player.IsHoveringOverABottomSideOfABed(i, j)) { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20); + if (player.IsWithinSnappngRangeToTile(i, j, PlayerSleepingHelper.BedSleepingMaxDistance)) + { + player.GamepadEnableGrappleCooldown(); + player.sleeping.StartSleeping(player, i, j); + } } - else if (Player.CheckSpawn(spawnX, spawnY)) + else { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20); + player.FindSpawn(); + + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText(Language.GetTextValue("Game.SpawnPointRemoved"), byte.MaxValue, 240, 20); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText(Language.GetTextValue("Game.SpawnPointSet"), byte.MaxValue, 240, 20); + } } + return true; } @@ -581,6 +595,10 @@ namespace CalamityMod Main.tileLavaDeath[mt.Type] = !lavaImmune; Main.tileWaterDeath[mt.Type] = false; TileID.Sets.HasOutlines[mt.Type] = true; + TileID.Sets.CanBeSleptIn[mt.Type] = true; + TileID.Sets.InteractibleByNPCs[mt.Type] = true; + TileID.Sets.IsValidSpawnPoint[mt.Type] = true; + TileID.Sets.DisableSmartCursor[mt.Type] = true; TileObjectData.newTile.Width = 4; TileObjectData.newTile.Height = 2; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 };