internal static bool UpdatePrefix(ShippingBin __instance, TemporaryAnimatedSprite ___shippingBinLid, Rectangle ___shippingBinLidOpenArea, Vector2 ____lidGenerationPosition, GameTime time) { if (___shippingBinLid != null && __instance.modData.ContainsKey("AlternativeTextureName")) { var textureModel = AlternativeTextures.textureManager.GetSpecificTextureModel(__instance.modData["AlternativeTextureName"]); if (textureModel is null) { return(true); } var textureVariation = Int32.Parse(__instance.modData["AlternativeTextureVariation"]); if (textureVariation == -1 || AlternativeTextures.modConfig.IsTextureVariationDisabled(textureModel.GetId(), textureVariation)) { return(true); } var textureOffset = textureModel.GetTextureOffset(textureVariation); if (textureModel.GetTexture(textureVariation) != ___shippingBinLid.texture || ___shippingBinLid.sourceRectStartingPos != new Vector2(32, textureOffset)) { InitLidPostfix(__instance, ___shippingBinLid, ___shippingBinLidOpenArea, ____lidGenerationPosition); } return(true); } return(true); }
internal static void InitLidPostfix(ShippingBin __instance, TemporaryAnimatedSprite ___shippingBinLid, Rectangle ___shippingBinLidOpenArea, Vector2 ____lidGenerationPosition) { if (___shippingBinLid != null && __instance.modData.ContainsKey("AlternativeTextureName")) { var textureModel = AlternativeTextures.textureManager.GetSpecificTextureModel(__instance.modData["AlternativeTextureName"]); if (textureModel is null) { return; } var textureVariation = Int32.Parse(__instance.modData["AlternativeTextureVariation"]); if (textureVariation == -1 || AlternativeTextures.modConfig.IsTextureVariationDisabled(textureModel.GetId(), textureVariation)) { return; } var textureOffset = textureModel.GetTextureOffset(textureVariation); ___shippingBinLid.texture = textureModel.GetTexture(textureVariation); ___shippingBinLid.currentParentTileIndex = 0; ___shippingBinLid.sourceRect = new Rectangle(32, textureOffset, 30, 25); ___shippingBinLid.sourceRectStartingPos = new Vector2(32, textureOffset); } return; }
public static bool Prefix(Farm ___farm, ShippingBin __instance) { if (___farm != null && Game1.player.ActiveObject != null && Game1.player.ActiveObject.canBeShipped() && Vector2.Distance(Game1.player.getTileLocation(), new Vector2((float)(int)__instance.tileX.Value + 0.5f, (float)(int)__instance.tileY.Value + 0.5f)) <= 2.25f) { //Console.WriteLine("ShippingBin.leftClicked"); MainBinListener.OnShipItem(Game1.player.ActiveObject, Game1.player); } return(true); }
public bool ShipItem(Item item) { bool shipped = false; if (item != null && item is StardewValley.Object && Farm != null) { Farm.getShippingBin(Game1.MasterPlayer).Add(item); ShippingBin.showShipment(item as StardewValley.Object, playThrowSound: false); Farm.lastItemShipped = item; shipped = true; } return(shipped); }
public static CompostingBin FromShippingBin(ShippingBin bin) => new CompostingBin(Composting.GetComposterBlueprint(), new Vector2(bin.tileX, bin.tileY));
public bool buildStructure(BluePrint structureForPlacement, Vector2 tileLocation, Farmer who, bool magicalConstruction = false, bool skipSafetyChecks = false) { if (!skipSafetyChecks) { for (int y2 = 0; y2 < structureForPlacement.tilesHeight; y2++) { for (int x2 = 0; x2 < structureForPlacement.tilesWidth; x2++) { pokeTileForConstruction(new Vector2(tileLocation.X + (float)x2, tileLocation.Y + (float)y2)); } } for (int y3 = 0; y3 < structureForPlacement.tilesHeight; y3++) { for (int x3 = 0; x3 < structureForPlacement.tilesWidth; x3++) { Vector2 currentGlobalTilePosition2 = new Vector2(tileLocation.X + (float)x3, tileLocation.Y + (float)y3); if (!isBuildable(currentGlobalTilePosition2)) { return(false); } foreach (Farmer farmer in farmers) { if (farmer.GetBoundingBox().Intersects(new Microsoft.Xna.Framework.Rectangle(x3 * 64, y3 * 64, 64, 64))) { return(false); } } } } if (structureForPlacement.humanDoor != new Point(-1, -1)) { Vector2 doorPos = tileLocation + new Vector2(structureForPlacement.humanDoor.X, structureForPlacement.humanDoor.Y + 1); if (!isBuildable(doorPos) && !isPath(doorPos)) { return(false); } } } Building b; switch (structureForPlacement.name) { case "Stable": b = new Stable(StardewValley.Util.GuidHelper.NewGuid(), structureForPlacement, tileLocation); break; case "Coop": case "Big Coop": case "Deluxe Coop": b = new Coop(structureForPlacement, tileLocation); break; case "Barn": case "Big Barn": case "Deluxe Barn": b = new Barn(structureForPlacement, tileLocation); break; case "Mill": b = new Mill(structureForPlacement, tileLocation); break; case "Junimo Hut": b = new JunimoHut(structureForPlacement, tileLocation); break; case "Shipping Bin": b = new ShippingBin(structureForPlacement, tileLocation); break; case "Fish Pond": b = new FishPond(structureForPlacement, tileLocation); break; default: b = new Building(structureForPlacement, tileLocation); break; } b.owner.Value = who.UniqueMultiplayerID; if (!skipSafetyChecks) { string finalCheckResult = b.isThereAnythingtoPreventConstruction(this); if (finalCheckResult != null) { Game1.addHUDMessage(new HUDMessage(finalCheckResult, Color.Red, 3500f)); return(false); } } for (int y = 0; y < structureForPlacement.tilesHeight; y++) { for (int x = 0; x < structureForPlacement.tilesWidth; x++) { Vector2 currentGlobalTilePosition = new Vector2(tileLocation.X + (float)x, tileLocation.Y + (float)y); terrainFeatures.Remove(currentGlobalTilePosition); } } buildings.Add(b); b.performActionOnConstruction(this); return(true); }
/// <summary>Construct an instance.</summary> /// <param name="bin">The constructed shipping bin.</param> /// <param name="location">The location which contains the machine.</param> public ShippingBinMachine(ShippingBin bin, GameLocation location) : base(location, BaseMachine.GetTileAreaFor(bin), ShippingBinMachine.ShippingBinId) { this.Bin = bin; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="location">The machine's in-game location.</param> /// <param name="tileArea">The tile area covered by the machine.</param> public ShippingBinMachine(GameLocation location, Rectangle tileArea) : base(location, tileArea, ShippingBinMachine.ShippingBinId) { this.Bin = null; }
/// <summary>Construct an instance.</summary> /// <param name="bin">The constructed shipping bin.</param> /// <param name="location">The location which contains the machine.</param> /// <param name="farm">The farm which has the shipping bin data.</param> public ShippingBinMachine(ShippingBin bin, GameLocation location, Farm farm) : base(location, BaseMachine.GetTileAreaFor(bin)) { this.Farm = farm; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="farm">The farm containing the shipping bin.</param> /// <param name="tileArea">The tile area covered by the machine.</param> public ShippingBinMachine(Farm farm, Rectangle tileArea) : base(farm, tileArea) { this.Farm = farm; this.Bin = null; }