internal void fixSpousePosition(FarmHouse house) { if (!Game1.player.isMarried() || Game1.player.getSpouse().currentLocation != house) { return; } NPC spouse = Game1.player.getSpouse(); if (spouse.getTileLocationPoint() == house.getKitchenStandingSpot()) { //Spouse was placed at the kitchen standing spot, move them to modded one. Logger.Log("Spouse was in kitchen standing spot..."); Point kitchenLocation = FarmHouseStates.getKitchenSpot(house); spouse.setTilePosition(kitchenLocation); Logger.Log(spouse.name + " was moved to " + kitchenLocation.ToString()); } else if (isSpouseInSpouseRoom(spouse, house)) { Logger.Log(spouse.name + " began the day in the spouse room..."); FarmHouseState state = FarmHouseStates.getState(house); if (state.spouseRoomData == null) { FarmHouseStates.updateFromMapPath(house, house.mapPath); } if (state.spouseRoomData != "") { Logger.Log("Map defined spouse room location..."); string[] spouseRoomPoint = state.spouseRoomData.Split(' '); Vector2 spouseRoomLocation = new Vector2(Convert.ToInt32(spouseRoomPoint[0]) + 3, Convert.ToInt32(spouseRoomPoint[1]) + 4); spouse.setTileLocation(spouseRoomLocation); Logger.Log(spouse.name + " was moved to " + spouseRoomLocation.ToString()); } else { Logger.Log("Map did not define spouse room location."); } } else if (!house.isTileLocationOpen(new xTile.Dimensions.Location(spouse.getTileX(), spouse.getTileY()))) { Logger.Log(spouse.name + " was in the void or was stuck, relocating..."); spouse.setTilePosition(house.getRandomOpenPointInHouse(Game1.random)); } }
public static Point getBedSpot(StardewValley.Locations.FarmHouse house, bool spouse = false) { Logger.Log("Getting bed location..."); if (bedData == null) { FarmHouseStates.updateFromMapPath(house.mapPath); } if (FarmHouseStates.bedData != "") { Logger.Log("Map defined bed location..."); string[] bedPoint = FarmHouseStates.bedData.Split(' '); return(new Point(Convert.ToInt32(bedPoint[0]) + (spouse ? 2 : 0), Convert.ToInt32(bedPoint[1]))); } else { Logger.Log("Map did not define a bed location, using vanilla."); if (spouse) { return(house.getSpouseBedSpot()); } return(house.getBedSpot()); } }