Пример #1
0
        public static void ToggleTemporarySpawnPoint(CampingModPlayer modPlayer, int spawnX, int spawnY)
        {
            if (modPlayer.tentSpawn != new Point(spawnX, spawnY))
            {
                if (IsTemporarySpawnObstructed(spawnX, spawnY))
                {
                    Camping.PrintInfo("CampTent.SpawnBlocked");
                    return;
                }

                Camping.PrintInfo("CampTent.SpawnSet");
                modPlayer.tentSpawn = new Point(spawnX, spawnY);
                if (modPlayer.player == Main.LocalPlayer)
                {
                    CampingModPlayer.SpawnAtTent = true;
                }
            }
            else
            {
                if (modPlayer.player.SpawnX == -1 && modPlayer.player.SpawnY == -1)
                {
                    Camping.PrintInfo("CampTent.SpawnRemove");
                }
                else
                {
                    Camping.PrintInfo("CampTent.SpawnRemoveBed");
                }
                modPlayer.tentSpawn = default;
            }
        }
Пример #2
0
        public override bool NewRightClick(int tX, int tY)
        {
            Player           player    = Main.LocalPlayer;
            CampingModPlayer modPlayer = player.GetModPlayer <CampingModPlayer>();

            int logic = GetTileLogic(tX, tY);


            // https://github.com/tModLoader/tModLoader/blob/master/ExampleMod/Tiles/ExampleChest.cs

            switch (logic)
            {
            case ItemID.PiggyBank:
                TileUtils.TogglePiggyBank(tX, tY, player);
                break;

            case ItemID.Safe:
                TileUtils.ToggleSafe(tX, tY, player);
                break;

            case ItemID.GPS:
                TileUtils.DisplayTimeInChat();
                break;

            default:
                TileUtils.GetTentSpawnPosition(tX, tY, out int spawnX, out int spawnY, _FRAMEWIDTH, _FRAMEHEIGHT, 6, -2);
                TileUtils.ToggleTemporarySpawnPoint(modPlayer, spawnX, spawnY);
                break;
            }
            return(true);
        }
Пример #3
0
        public override bool NewRightClick(int tX, int tY)
        {
            Player           player    = Main.LocalPlayer;
            CampingModPlayer modPlayer = player.GetModPlayer <CampingModPlayer>();

            TileUtils.GetTentSpawnPosition(tX, tY, out int spawnX, out int spawnY, _FRAMEWIDTH, _FRAMEHEIGHT, 2);
            TileUtils.ToggleTemporarySpawnPoint(modPlayer, spawnX, spawnY);
            return(true);
        }