protected override bool ExtraRequirements(IPlantToGrowSettable settable, Pawn pawn) { bool result; if (!settable.CanAcceptSowNow()) { result = false; } else { Zone_Growing zone_Growing = settable as Zone_Growing; IntVec3 c; if (zone_Growing != null) { if (!zone_Growing.allowSow) { return(false); } c = zone_Growing.Cells[0]; } else { c = ((Thing)settable).Position; } WorkGiver_Grower.wantedPlantDef = WorkGiver_Grower.CalculateWantedPlantDef(c, pawn.Map); result = (WorkGiver_Grower.wantedPlantDef != null); } return(result); }
public static bool CanPlantRightNow(this IPlantToGrowSettable planter) { return((!planter.CanAcceptSowNow()) ? false : (planter is Zone_Growing z) ? z.allowSow : (planter is Thing t) ? !t.IsForbidden(Faction.OfPlayer) : true); }
private static bool IsCellOpenForSowingPlantOfType(IntVec3 cell, Map map, ThingDef plantDef) { IPlantToGrowSettable playerSetPlantForCell = GetPlayerSetPlantForCell(cell, map); if (playerSetPlantForCell == null || !playerSetPlantForCell.CanAcceptSowNow()) { return(false); } ThingDef plantDefToGrow = playerSetPlantForCell.GetPlantDefToGrow(); if (plantDefToGrow == null || plantDefToGrow != plantDef) { return(false); } if (GridsUtility.GetPlant(cell, map) != null) { return(false); } if (GenPlant.AdjacentSowBlocker(plantDefToGrow, cell, map) != null) { return(false); } foreach (Thing current in map.thingGrid.ThingsListAt(cell)) { if (current.def.BlockPlanting) { return(false); } } return(GenPlant.CanEverPlantAt(plantDefToGrow, cell, map) && GenPlant.GrowthSeasonNow(cell, map)); }
private bool ExtraRequirements(IPlantToGrowSettable settable, Pawn pawn) { if (!settable.CanAcceptSowNow()) { return(false); } Zone_Orchard orchardZone = settable as Zone_Orchard; IntVec3 c; if (orchardZone != null) { if (!orchardZone.allowSow) { return(false); } c = orchardZone.Cells[0]; } else { c = ((Thing)settable).Position; } wantedPlantDef = CalculateWantedPlantDef(c, pawn.Map); return(wantedPlantDef != null); }