static void Postfix(ref Job __result, Pawn p, Thing t, IntVec3 storeCell) { Comp_StorageInput comp = storeCell.GetStorageComponent <Comp_StorageInput>(p.Map); if (comp != null) { __result.count = comp.CanAccept(t); } }
static bool Prefix(ref bool __result, IntVec3 c, Map map, Thing storable) { Comp_StorageInput comp = c.GetStorageComponent <Comp_StorageInput>(map); if (comp != null) { __result = comp.GetSlotGroup().Settings.AllowedToAccept(storable); return(false); } return(true); }
static bool TryPlaceThing(Thing thing, IntVec3 dropCell, Map map, ThingPlaceMode mode, out Thing resultingThing, Action <Thing, int> placedAction = null) { Comp_StorageInput comp = dropCell.GetStorageComponent <Comp_StorageInput>(map); if (comp != null) { return(comp.Store(thing, out resultingThing, placedAction)); } return(GenPlace.TryPlaceThing(thing, dropCell, map, mode, out resultingThing, placedAction)); }
static bool Prefix(ref bool __result, IntVec3 c, Map map, Thing t, Pawn carrier, Faction faction) { Comp_StorageInput comp = c.GetStorageComponent <Comp_StorageInput>(map); if (comp != null) { __result = comp.CanAccept(t) > 0 && (carrier == null || (carrier.Map.reachability.CanReach( (!t.SpawnedOrAnyParentSpawned) ? carrier.PositionHeld : t.PositionHeld, c, PathEndMode.ClosestTouch, TraverseParms.For(carrier, Danger.Deadly, TraverseMode.ByPawn, false)))); return(false); } return(true); }
public IntVec3 FindClosestOutputCell(Thing thing, IntVec3 rootCell) { if (rootCell != previousRootCell || previousStorageCell != thing.Position) { previousRootCell = rootCell; previousStorageCell = thing.Position; var comp = previousStorageCell.GetStorageComponent <Comp_StorageAbstract>(map); if (comp != null) { Thing closestThing = comp.FindClosestOutputParent(previousRootCell); if (closestThing != null) { cachedOutputCell = closestThing.Position; } } else { cachedOutputCell = IntVec3.Invalid; } } return(cachedOutputCell); }