Example #1
0
        public static bool BedFurniture_draw_Prefix(BedFurniture __instance, SpriteBatch spriteBatch, int x, int y, float alpha, NetVector2 ___drawPosition)
        {
            if (!Config.EnableMod || __instance.isTemporarilyInvisible || __instance.bedType != BedFurniture.BedType.Double)
            {
                return(true);
            }

            if (!Config.CustomBed)
            {
                __instance.boundingBox.Width = 3 * 64;
                return(true);
            }


            Vector2 drawPosition = Furniture.isDrawingLocationFurniture ? ___drawPosition : new Vector2(x * 64, y * 64 - (__instance.sourceRect.Height * 4 - __instance.boundingBox.Height));

            int bedWidth = Misc.GetBedWidth(Utility.getHomeOfFarmer(Game1.getFarmer(__instance.owner)));

            __instance.boundingBox.Width = bedWidth * 64;

            Rectangle drawn_rect   = __instance.sourceRect.Value;
            int       third        = drawn_rect.Width / 3;
            Rectangle drawn_first  = new Rectangle(drawn_rect.X, drawn_rect.Y, third, drawn_rect.Height);
            Rectangle drawn_second = new Rectangle(drawn_rect.X + third, drawn_rect.Y, third, drawn_rect.Height);
            Rectangle drawn_third  = new Rectangle(drawn_rect.X + third + third, drawn_rect.Y, third, drawn_rect.Height);

            spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), new Rectangle?(drawn_first), Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Top + 1) / 10000f);
            for (int i = 1; i < bedWidth - 1; i++)
            {
                spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(third * i * 4, 0), new Rectangle?(drawn_second), Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Top + 1) / 10000f);
            }
            spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(third * (bedWidth - 1) * 4, 0), new Rectangle?(drawn_third), Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Top + 1) / 10000f);

            drawn_rect.X += drawn_rect.Width;
            drawn_first   = new Rectangle(drawn_rect.X, drawn_rect.Y, third, drawn_rect.Height);
            drawn_second  = new Rectangle(drawn_rect.X + third, drawn_rect.Y, third, drawn_rect.Height);
            drawn_third   = new Rectangle(drawn_rect.X + third + third, drawn_rect.Y, third, drawn_rect.Height);

            int solidHeight = 41;

            Rectangle drawn_first_t  = new Rectangle(drawn_rect.X, drawn_rect.Y + solidHeight, third, drawn_rect.Height - solidHeight);
            Rectangle drawn_second_t = new Rectangle(drawn_rect.X + third, drawn_rect.Y + solidHeight, third, drawn_rect.Height - solidHeight);
            Rectangle drawn_third_t  = new Rectangle(drawn_rect.X + third * 2, drawn_rect.Y + solidHeight, third, drawn_rect.Height - solidHeight);

            alpha = Config.SheetTransparency;

            spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), new Rectangle?(drawn_first), Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Bottom - 1) / 10000f);
            spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(0, solidHeight * 4), new Rectangle?(drawn_first_t), Color.White, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Bottom - 2) / 10000f);

            for (int i = 1; i < bedWidth - 1; i++)
            {
                spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(third * i * 4, 0), new Rectangle?(drawn_second), Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Bottom - 1) / 10000f);
                spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(0, solidHeight * 4) + new Vector2(third * i * 4, 0), new Rectangle?(drawn_second_t), Color.White, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Bottom - 1) / 10000f);
            }
            spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(third * (bedWidth - 1) * 4, 0), new Rectangle?(drawn_third), Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Bottom - 1) / 10000f);
            spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(0, solidHeight * 4) + new Vector2(third * (bedWidth - 1) * 4, 0), new Rectangle?(drawn_third_t), Color.White, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Bottom - 1) / 10000f);

            return(false);
        }
        public static bool Object_draw_Prefix(Object __instance, SpriteBatch spriteBatch, float alpha)
        {
            if (!Config.EnableMod || !Config.CustomBed || !(__instance is BedFurniture) || (__instance is BedFurniture && (__instance as BedFurniture)?.bedType != BedFurniture.BedType.Double))
            {
                return(true);
            }

            int        bedWidth     = Misc.GetBedWidth(Utility.getHomeOfFarmer(Game1.getFarmer(__instance.owner)));
            NetVector2 drawPosition = Helper.Reflection.GetField <NetVector2>(__instance as BedFurniture, "drawPosition").GetValue();

            __instance.boundingBox.Width = bedWidth * 64;

            Rectangle drawn_rect   = (__instance as BedFurniture).sourceRect.Value;
            int       third        = drawn_rect.Width / 3;
            Rectangle drawn_first  = new Rectangle(drawn_rect.X, drawn_rect.Y, third, drawn_rect.Height);
            Rectangle drawn_second = new Rectangle(drawn_rect.X + third, drawn_rect.Y, third, drawn_rect.Height);
            Rectangle drawn_third  = new Rectangle(drawn_rect.X + third + third, drawn_rect.Y, third, drawn_rect.Height);

            spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), new Rectangle?(drawn_first), Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Top + 1) / 10000f);
            for (int i = 1; i < bedWidth - 1; i++)
            {
                spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(third * i * 4, 0), new Rectangle?(drawn_second), Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Top + 1) / 10000f);
            }
            spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(third * (bedWidth - 1) * 4, 0), new Rectangle?(drawn_third), Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Top + 1) / 10000f);

            drawn_rect.X += drawn_rect.Width;
            drawn_first   = new Rectangle(drawn_rect.X, drawn_rect.Y, third, drawn_rect.Height);
            drawn_second  = new Rectangle(drawn_rect.X + third, drawn_rect.Y, third, drawn_rect.Height);
            drawn_third   = new Rectangle(drawn_rect.X + third + third, drawn_rect.Y, third, drawn_rect.Height);

            int solidHeight = 41;

            Rectangle drawn_first_t  = new Rectangle(drawn_rect.X, drawn_rect.Y + solidHeight, third, drawn_rect.Height - solidHeight);
            Rectangle drawn_second_t = new Rectangle(drawn_rect.X + third, drawn_rect.Y + solidHeight, third, drawn_rect.Height - solidHeight);
            Rectangle drawn_third_t  = new Rectangle(drawn_rect.X + third * 2, drawn_rect.Y + solidHeight, third, drawn_rect.Height - solidHeight);

            float sheetAlpha = alpha;

            sheetAlpha *= Config.SheetTransparency;

            spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), new Rectangle?(drawn_first), Color.White * sheetAlpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Bottom - 1) / 10000f);
            spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(0, solidHeight * 4), new Rectangle?(drawn_first_t), Color.White, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Bottom - 2) / 10000f);

            for (int i = 1; i < bedWidth - 1; i++)
            {
                spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(third * i * 4, 0), new Rectangle?(drawn_second), Color.White * sheetAlpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Bottom - 1) / 10000f);
                spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(0, solidHeight * 4) + new Vector2(third * i * 4, 0), new Rectangle?(drawn_second_t), Color.White, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Bottom - 1) / 10000f);
            }
            spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(third * (bedWidth - 1) * 4, 0), new Rectangle?(drawn_third), Color.White * sheetAlpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Bottom - 1) / 10000f);
            spriteBatch.Draw(Furniture.furnitureTexture, Game1.GlobalToLocal(Game1.viewport, drawPosition + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)) + new Vector2(0, solidHeight * 4) + new Vector2(third * (bedWidth - 1) * 4, 0), new Rectangle?(drawn_third_t), Color.White, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.boundingBox.Value.Bottom - 1) / 10000f);

            return(false);
        }
Example #3
0
        public static void FarmHouse_performTenMinuteUpdate_Postfix(FarmHouse __instance, int timeOfDay)
        {
            try
            {
                if (__instance.owner == null)
                {
                    return;
                }

                List <string> mySpouses = Misc.GetSpouses(__instance.owner, 1).Keys.ToList();
                if (Game1.IsMasterGame && Game1.timeOfDay >= 2200 && Game1.IsMasterGame)
                {
                    int           upgradeLevel = __instance.upgradeLevel;
                    List <string> roomSpouses  = mySpouses.FindAll((s) => Maps.roomIndexes.ContainsKey(s) || Maps.tmxSpouseRooms.ContainsKey(s));
                    List <string> bedSpouses   = mySpouses.FindAll((s) => ModEntry.config.RoommateRomance || !__instance.owner.friendshipData[s].RoommateMarriage);
                    foreach (NPC c in __instance.characters)
                    {
                        if (c.isMarried())
                        {
                            string spouseName = c.Name;

                            if (Misc.GetSpouses(Game1.player, 1).ContainsKey(spouseName))
                            {
                                c.checkForMarriageDialogue(timeOfDay, __instance);
                            }

                            Point bedSpot;
                            if (timeOfDay >= 2200)
                            {
                                if (!bedSpouses.Contains(c.Name))
                                {
                                    if (!roomSpouses.Exists((n) => n == spouseName))
                                    {
                                        bedSpot = __instance.getRandomOpenPointInHouse(ModEntry.myRand);
                                    }
                                    else
                                    {
                                        int     offset = roomSpouses.IndexOf(spouseName) * 7;
                                        Vector2 spot   = (upgradeLevel == 1) ? new Vector2(32f, 5f) : new Vector2(38f, 14f);
                                        bedSpot = new Point((int)spot.X + offset, (int)spot.Y);
                                    }
                                }
                                else
                                {
                                    int  bedWidth = Misc.GetBedWidth(__instance);
                                    bool up       = upgradeLevel > 1;

                                    Point bedStart = new Point(21 - (up ? (bedWidth / 2) - 1 : 0) + (up ? 6 : 0), 2 + (up ? 9 : 0));
                                    int   x        = 1 + (int)((bedSpouses.IndexOf(spouseName) + 1) / (float)(bedSpouses.Count + 1) * (bedWidth - 2));
                                    bedSpot = new Point(bedStart.X + x, bedStart.Y + 2);
                                }

                                c.controller = null;
                                if (c.Position != Misc.GetSpouseBedPosition(__instance, bedSpouses, c.Name) && (!Misc.IsInBed(__instance, c.GetBoundingBox()) || !Kissing.kissingSpouses.Contains(c.Name)))
                                {
                                    c.controller = new PathFindController(c, __instance, bedSpot, 0, new PathFindController.endBehavior(FarmHouse.spouseSleepEndFunction));
                                    if (c.controller.pathToEndPoint == null || !__instance.isTileOnMap(c.controller.pathToEndPoint.Last <Point>().X, c.controller.pathToEndPoint.Last <Point>().Y))
                                    {
                                        c.controller = null;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Monitor.Log($"Failed in {nameof(FarmHouse_performTenMinuteUpdate_Postfix)}:\n{ex}", LogLevel.Error);
            }
        }
Example #4
0
        public static void ReplaceBed(FarmHouse farmHouse)
        {
            try
            {
                Monitor.Log("Replacing bed");
                if (farmHouse == null || farmHouse.map == null)
                {
                    return;
                }

                // bed
                Map map;
                if (ModEntry.config.SleepOnCovers && !config.TransparentSheets)
                {
                    map = PHelper.Content.Load <Map>("assets/CustomBed.tmx");
                }
                else
                {
                    map = PHelper.Content.Load <Map>("Maps\\" + farmHouse.Name + ((farmHouse.upgradeLevel == 0) ? "" : (((farmHouse.upgradeLevel == 3) ? "2" : string.Concat(farmHouse.upgradeLevel)) + "_marriage")), ContentSource.GameContent);

                    if (!ModEntry.config.TransparentSheets && farmHouse.owner != null && !farmHouse.owner.activeDialogueEvents.ContainsKey("pennyRedecorating"))
                    {
                        int whichQuilt = -1;
                        if (farmHouse.owner.mailReceived.Contains("pennyQuilt0"))
                        {
                            whichQuilt = 0;
                        }
                        else if (farmHouse.owner.mailReceived.Contains("pennyQuilt1"))
                        {
                            whichQuilt = 1;
                        }
                        else if (farmHouse.owner.mailReceived.Contains("pennyQuilt2"))
                        {
                            whichQuilt = 2;
                        }
                        if (whichQuilt != -1)
                        {
                            Point startTile = Point.Zero;
                            if (farmHouse.upgradeLevel >= 2)
                            {
                                startTile = new Point(27, 12);
                            }
                            else if (farmHouse.upgradeLevel == 1)
                            {
                                startTile = new Point(21, 3);
                            }
                            if (!startTile.Equals(Point.Zero))
                            {
                                int startIndex = 61 + whichQuilt * 3;
                                setMapTileIndex(ref map, startTile.X, startTile.Y, startIndex, "Front", 1);
                                setMapTileIndex(ref map, startTile.X + 1, startTile.Y, startIndex + 1, "Front", 1);
                                setMapTileIndex(ref map, startTile.X + 2, startTile.Y, startIndex + 2, "Front", 1);
                                setMapTileIndex(ref map, startTile.X, startTile.Y + 1, startIndex + 12, "Front", 1);
                                setMapTileIndex(ref map, startTile.X + 1, startTile.Y + 1, startIndex + 13, "Front", 1);
                                setMapTileIndex(ref map, startTile.X + 2, startTile.Y + 1, startIndex + 14, "Front", 1);
                            }
                        }
                    }
                }
                int           untitled = 0;
                List <string> sheets   = new List <string>();
                for (int i = 0; i < farmHouse.map.TileSheets.Count; i++)
                {
                    sheets.Add(farmHouse.map.TileSheets[i].Id);
                    Monitor.Log($"bed sheet {farmHouse.map.TileSheets[i].Id} index: {i}");
                }
                untitled = sheets.IndexOf("untitled tile sheet");


                int ox = ModEntry.config.ExistingBedOffsetX;
                int oy = ModEntry.config.ExistingBedOffsetY;
                if (farmHouse.upgradeLevel > 1)
                {
                    ox += 6;
                    oy += 9;
                }

                int bedWidth = Misc.GetBedWidth(farmHouse);
                int width    = bedWidth - 1;
                int start    = 21 - (farmHouse.upgradeLevel > 1 ? (bedWidth / 2) - 1 : 0);

                List <int> backIndexes  = new List <int>();
                List <int> frontIndexes = new List <int>();
                List <int> buildIndexes = new List <int>();
                List <int> backSheets   = new List <int>();
                List <int> frontSheets  = new List <int>();
                List <int> buildSheets  = new List <int>();

                int sheetx = 0;
                int sheety = 0;
                if (!ModEntry.config.SleepOnCovers || config.TransparentSheets)
                {
                    sheetx = ox + 21;
                    sheety = oy + 2;
                }

                for (int i = 0; i < 12; i++)
                {
                    farmHouse.removeTile(ox + 21 + (i % 3), oy + 2 + (i / 3), "Front");
                    if (i > 2 && i < 9)
                    {
                        //farmHouse.removeTile(ox + 21 + (i % 3), oy + 2 + (i / 3), "Buildings");
                    }
                    backIndexes.Add(getTileIndexAt(map, sheetx + (i % 3), sheety + (i / 3), "Back"));
                    frontIndexes.Add(getTileIndexAt(map, sheetx + (i % 3), sheety + (i / 3), "Front"));
                    buildIndexes.Add(getTileIndexAt(map, sheetx + (i % 3), sheety + (i / 3), "Buildings"));
                    if (ModEntry.config.SleepOnCovers && !config.TransparentSheets)
                    {
                        backSheets.Add(untitled);
                        frontSheets.Add(untitled);
                        buildSheets.Add(untitled);
                    }
                    else
                    {
                        backSheets.Add(sheets.IndexOf(getTileSheetIDAt(map, sheetx + (i % 3), sheety + (i / 3), "Back")));
                        frontSheets.Add(sheets.IndexOf(getTileSheetIDAt(map, sheetx + (i % 3), sheety + (i / 3), "Front")));
                        buildSheets.Add(sheets.IndexOf(getTileSheetIDAt(map, sheetx + (i % 3), sheety + (i / 3), "Buildings")));
                    }
                }


                setupTile(start + ox, 2 + oy, 0, 0, farmHouse, frontIndexes, frontSheets, 3, 0);
                setupTile(start + ox, 3 + oy, 0, 1, farmHouse, frontIndexes, frontSheets, 3, 0);
                setupTile(start + ox, 3 + oy, 0, 1, farmHouse, buildIndexes, buildSheets, 3, 1);
                setupTile(start + ox, 4 + oy, 0, 2, farmHouse, frontIndexes, frontSheets, 3, 0);
                setupTile(start + ox, 4 + oy, 0, 2, farmHouse, backIndexes, backSheets, 3, 2);
                setupTile(start + ox, 5 + oy, 0, 3, farmHouse, buildIndexes, buildSheets, 3, 1);

                if (ModEntry.config.TransparentSheets)
                {
                    farmHouse.removeTile(start + ox, 4 + oy, "Back");
                    farmHouse.setMapTileIndex(start + ox, 4 + oy, 212, "Back", untitled);
                }

                farmHouse.setTileProperty(start + ox, oy + 3, "Back", "Bed", "T");
                farmHouse.setTileProperty(start + ox, oy + 4, "Back", "Bed", "T");
                farmHouse.setTileProperty(start + ox, oy + 3, "Back", "NoFurniture", "T");
                farmHouse.setTileProperty(start + ox, oy + 4, "Back", "NoFurniture", "T");

                //farmHouse.removeTile(ox + start, oy + 3, "Buildings");
                for (int i = 1; i < width; i++)
                {
                    //farmHouse.removeTile(ox + start + i, oy + 3, "Buildings");

                    setupTile(i + start + ox, 2 + oy, 1, 0, farmHouse, frontIndexes, frontSheets, 3, 0);
                    setupTile(i + start + ox, 3 + oy, 1, 1, farmHouse, frontIndexes, frontSheets, 3, 0);
                    setupTile(i + start + ox, 3 + oy, 1, 1, farmHouse, buildIndexes, buildSheets, 3, 1);
                    setupTile(i + start + ox, 4 + oy, 1, 2, farmHouse, frontIndexes, frontSheets, 3, 0);
                    setupTile(i + start + ox, 4 + oy, 1, 2, farmHouse, backIndexes, backSheets, 3, 2);
                    setupTile(i + start + ox, 5 + oy, 1, 3, farmHouse, buildIndexes, buildSheets, 3, 1);

                    if (ModEntry.config.TransparentSheets)
                    {
                        farmHouse.removeTile(i + start + ox, 4 + oy, "Back");
                        farmHouse.setMapTileIndex(i + start + ox, 4 + oy, 213, "Back", untitled);
                    }

                    farmHouse.setTileProperty(i + start + ox, oy + 3, "Back", "Bed", "T");
                    farmHouse.setTileProperty(i + start + ox, oy + 4, "Back", "Bed", "T");
                    farmHouse.setTileProperty(i + start + ox, oy + 3, "Back", "NoFurniture", "T");
                    farmHouse.setTileProperty(i + start + ox, oy + 4, "Back", "NoFurniture", "T");
                }
                //farmHouse.removeTile(width + ox + start, oy + 3, "Buildings");

                setupTile(width + start + ox, 2 + oy, 2, 0, farmHouse, frontIndexes, frontSheets, 3, 0);
                setupTile(width + start + ox, 3 + oy, 2, 1, farmHouse, frontIndexes, frontSheets, 3, 0);
                setupTile(width + start + ox, 3 + oy, 2, 1, farmHouse, buildIndexes, buildSheets, 3, 1);
                setupTile(width + start + ox, 4 + oy, 2, 2, farmHouse, frontIndexes, frontSheets, 3, 0);
                setupTile(width + start + ox, 4 + oy, 2, 2, farmHouse, backIndexes, backSheets, 3, 2);
                setupTile(width + start + ox, 5 + oy, 2, 3, farmHouse, buildIndexes, buildSheets, 3, 1);

                if (ModEntry.config.TransparentSheets)
                {
                    farmHouse.removeTile(width + start + ox, 4 + oy, "Back");
                    farmHouse.setMapTileIndex(width + start + ox, 4 + oy, 214, "Back", untitled);
                }

                farmHouse.setTileProperty(width + start + ox, oy + 3, "Back", "Bed", "T");
                farmHouse.setTileProperty(width + start + ox, oy + 4, "Back", "Bed", "T");
                farmHouse.setTileProperty(width + start + ox, oy + 3, "Back", "NoFurniture", "T");
                farmHouse.setTileProperty(width + start + ox, oy + 4, "Back", "NoFurniture", "T");

                farmHouse.setTileProperty(21 + ox, oy + 4, "Back", "asdf", "asdf");
                farmHouse.setTileProperty(22 + ox, oy + 4, "Back", "TouchAction", "Sleep");
                farmHouse.setTileProperty(23 + ox, oy + 4, "Back", "TouchAction", "Sleep2");
            }
            catch (Exception ex)
            {
                Monitor.Log($"Failed in {nameof(ReplaceBed)}:\n{ex}", LogLevel.Error);
            }
        }