private static int GetSpeed(Vector2 tile, List <CropTrait> traits, bool greenhouse) { int level = 0; if (greenhouse || Composting.AffectedByCompost(tile)) { level += 1; } if (traits.Contains(CropTrait.SpeedI)) { level += 1; } if (traits.Contains(CropTrait.SpeedII)) { level += 1; } return(level); }
public static int GetPestRes(Vector2 tile, List <CropTrait> traits, bool greenhouse) { int level = 0; if (greenhouse || Composting.AffectedByCompost(tile)) { level += 1; } if (greenhouse || traits.Contains(CropTrait.PestResistanceI)) { level += 1; } if (traits.Contains(CropTrait.PestResistanceII) && level <= 1) { level += 1; } return(level); }
/* * private static void AddToTempDic(string s, Vector2 vec, Dictionary<string, List<Vector2>> dic) * { * dic[s].Add(vec); * } * * private static List<Vector2> GetFromTempDic(string s, Dictionary<string, List<Vector2>> dic) => * dic[s]; * * private static void ClearTempDic(string s, Dictionary<string, List<Vector2>> dic) * { * dic[s].Clear(); * } */ private static int GetQuality(Vector2 tile, List <CropTrait> traits, bool greenhouse) { int level = 0; if (!greenhouse && Composting.AffectedByCompost(tile)) { level += 1; } if (traits.Contains(CropTrait.QualityI)) { level += 1; } if (traits.Contains(CropTrait.QualityII) && level <= 1) { level += 1; } return(level); }
private static int GetWater(Vector2 tile, List <CropTrait> traits) { int level = 0; if (Composting.AffectedByCompost(tile)) { level += 1; } if (traits.Contains(CropTrait.WaterI)) { level += 1; } if (traits.Contains(CropTrait.WaterII)) { level += 1; } return(level); }
public override void receiveLeftClick(int x, int y, bool playSound = true) { Vector2 vec = new Vector2((Game1.viewport.X + x) / 64, (Game1.viewport.Y + y) / 64); if (!applyMode) { compostInventoryMenu.receiveLeftClick(x, y, playSound); playerInventoryMenu.receiveLeftClick(x, y, playSound); if (state == State.ready && applyButton.containsPoint(x, y)) { applyMode = true; } else if (state == State.fill && nutritionsComponent.GoodDistribution() && activateButton.containsPoint(x, y)) { MakeActive(); } base.receiveLeftClick(x, y, playSound); } else if (Game1.currentLocation is Farm farm && !Composting.AffectedByCompost(vec) && farm.terrainFeatures.ContainsKey(vec) && farm.terrainFeatures[vec] is HoeDirt) { Composting.CompostApplied.Add(vec); }
public override void receiveLeftClick(int x, int y, bool playSound = true) { Game1.player.Halt(); Vector2 vec = new Vector2((Game1.viewport.X + x) / 64, (Game1.viewport.Y + y) / 64); if (!applyMode) { compostInventoryMenu.receiveLeftClick(x, y, playSound); playerInventoryMenu.receiveLeftClick(x, y, playSound); if (applyButton.containsPoint(x, y)) { ApplyMode(true); } else if (state == State.fill && nutritionsComponent.GoodDistribution() && activateButton.containsPoint(x, y)) { MakeActive(); } base.receiveLeftClick(x, y, playSound); } else if (applyMode && Game1.currentLocation is Farm farm) { if (cancelButton.bounds.Contains(x, y)) { ApplyMode(false); } else if (!Composting.AffectedByCompost(vec) && farm.terrainFeatures.ContainsKey(vec) && farm.terrainFeatures[vec] is HoeDirt && Composting.ComposterCompostLeft[BinPos] > 0) { void apply() { Composting.ComposterCompostLeft[BinPos]--; if (Composting.ComposterCompostLeft[BinPos] <= 0) { MakeInactive(); } UpdateGreenTiles(); Game1.playSound("grassyStep"); //greenTiles.Add(vec); //greenTiles.AddRange(ModComponent.GetAdjacentTiles(vec)); } if (Composting.CompostAppliedDays.ContainsKey(vec)) { if (Composting.CompostAppliedDays[vec] <= 0) { Composting.CompostAppliedDays[vec] = Composting.config.compost_last_for_days; apply(); } else { ShowError("composter.msg.error_already_affected"); } } else { Composting.CompostAppliedDays.Add(vec, Composting.config.compost_last_for_days); apply(); } } else if (Composting.ComposterCompostLeft[BinPos] <= 0) { ShowError("composter.msg.error_no_compost_left"); } else if (!farm.terrainFeatures.ContainsKey(vec) || !(farm.terrainFeatures[vec] is HoeDirt)) { ShowError("composter.msg.error_no_tilled_dirt"); } else if (Composting.AffectedByCompost(vec)) { ShowError("composter.msg.error_already_affected"); } } }