diff --git a/stardew-access/CustomCommands.cs b/stardew-access/CustomCommands.cs index b336cfd..3ee749d 100644 --- a/stardew-access/CustomCommands.cs +++ b/stardew-access/CustomCommands.cs @@ -399,7 +399,7 @@ namespace stardew_access else if (BuildingNAnimalMenuPatches.isDemolishing) { BuildingNAnimalMenuPatches.Demolish(BuildingNAnimalMenuPatches.availableBuildings[index]); } else if (BuildingNAnimalMenuPatches.isUpgrading) { BuildingNAnimalMenuPatches.Upgrade(BuildingNAnimalMenuPatches.availableBuildings[index]); } else if (BuildingNAnimalMenuPatches.isMoving) { } - else if (BuildingNAnimalMenuPatches.isPainting) { } + else if (BuildingNAnimalMenuPatches.isPainting) { BuildingNAnimalMenuPatches.Paint(BuildingNAnimalMenuPatches.availableBuildings[index]); } }); #endregion diff --git a/stardew-access/Patches/BuildingNAnimalMenuPatches.cs b/stardew-access/Patches/BuildingNAnimalMenuPatches.cs index 70552c9..04fe18c 100644 --- a/stardew-access/Patches/BuildingNAnimalMenuPatches.cs +++ b/stardew-access/Patches/BuildingNAnimalMenuPatches.cs @@ -317,7 +317,7 @@ namespace stardew_access.Patches } } - public static void Contstruct(Building toCunstruct) + public static void Contstruct(Building toCunstruct, Vector2 position) { } @@ -341,9 +341,40 @@ namespace stardew_access.Patches } } - public static void Paint(Building toPaint) + public static void Paint(Building? toPaint) { - + Farm farm_location = Game1.getFarm(); + if (toPaint != null) + { + if (!toPaint.CanBePainted()) + { + Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\UI:Carpenter_CannotPaint"), Color.Red, 3500f)); + return; + } + if (!carpenterMenu.HasPermissionsToPaint(toPaint)) + { + Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\UI:Carpenter_CannotPaint_Permission"), Color.Red, 3500f)); + return; + } + toPaint.color.Value = Color.White; + carpenterMenu.SetChildMenu(new BuildingPaintMenu(toPaint)); + } + /* TODO Add painting of farm house + else if (farm_location.GetHouseRect().Contains(Utility.Vector2ToPoint(new Vector2(toPaint.tileX, toPaint.tileY)))) + { + if (!carpenterMenu.CanPaintHouse()) + { + Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\UI:Carpenter_CannotPaint"), Color.Red, 3500f)); + } + else if (!carpenterMenu.HasPermissionsToPaint(null)) + { + Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\UI:Carpenter_CannotPaint_Permission"), Color.Red, 3500f)); + } + else + { + carpenterMenu.SetChildMenu(new BuildingPaintMenu("House", () => (farm_location.paintedHouseTexture != null) ? farm_location.paintedHouseTexture : Farm.houseTextures, farm_location.houseSource.Value, farm_location.housePaintColor.Value)); + } + }*/ } public static void Move(Building toMove, Vector2 position)