internal static bool minutesElapsedPrefix(Object __instance, ref int minutes, GameLocation environment, out bool __state) { __state = false; if (ProducerController.GetProducerConfig(__instance.Name) is ProducerConfig producerConfig) { if (!producerConfig.CheckWeatherCondition()) { return(false); } if (!producerConfig.CheckElapsedTimeCondition(ref minutes)) { return(false); } if (producerConfig.ProducerName == "Bee House" && producerConfig.WorkingOutdoors != true) { if (Game1.IsMasterGame) { __instance.minutesUntilReady.Value -= minutes; } if (__instance.minutesUntilReady.Value <= 0) { if (!__instance.readyForHarvest.Value) { environment.playSound("dwop", NetAudio.SoundContext.Default); } __instance.readyForHarvest.Value = true; __instance.minutesUntilReady.Value = 0; __instance.onReadyForHarvest(environment); __instance.showNextIndex.Value = true; if (__instance.lightSource != null) { environment.removeLightSource(__instance.lightSource.identifier.Value); __instance.lightSource = (LightSource)null; } } if (!__instance.readyForHarvest.Value && Game1.random.NextDouble() < 0.33) { __instance.addWorkingAnimation(environment); } return(false); } if (producerConfig.LightSource?.AlwaysOn == true && __instance.minutesUntilReady - minutes <= 0 && __instance.heldObject.Value != null && !__instance.readyForHarvest) { __state = true; } } return(true); }
/// <summary> /// Checks for right mouse button iteraction with the world. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void Input_CheckForObjectInteraction(object sender, StardewModdingAPI.Events.ButtonPressedEventArgs e) { if (e.Button == StardewModdingAPI.SButton.MouseRight) { SObject obj = GetItemAtMouseTile(); if (obj == null) { return; } if (ObjectUtilities.IsObjectFurnace(obj) && ObjectUtilities.IsObjectHoldingItem(obj) == false) { bool crafted = VanillaRecipeBook.VanillaRecipes.TryToCraftRecipe(obj); if (crafted == false) { return; } obj.initializeLightSource((Vector2)(obj.TileLocation), false); obj.showNextIndex.Value = true; /* * Game1.multiplayer.broadcastSprites(who.currentLocation, new TemporaryAnimatedSprite(30, this.tileLocation.Value * 64f + new Vector2(0.0f, -16f), Color.White, 4, false, 50f, 10, 64, (float)(((double)this.tileLocation.Y + 1.0) * 64.0 / 10000.0 + 9.99999974737875E-05), -1, 0) * { * alphaFade = 0.005f * }); */ (Game1.player.currentLocation).TemporarySprites.Add(new TemporaryAnimatedSprite(30, obj.TileLocation * 64f + new Vector2(0.0f, -16f), Color.White, 4, false, 50f, 10, 64, (float)(((double)obj.TileLocation.Y + 1.0) * 64.0 / 10000.0 + 9.99999974737875E-05), -1, 0)); obj.addWorkingAnimation(Game1.player.currentLocation); if (TrackedMachines.ContainsKey(Game1.player.currentLocation)) { TrackedMachines[Game1.player.currentLocation].Add(obj); } else { TrackedMachines.Add(Game1.player.currentLocation, new List <SObject>() { obj }); } } } }