コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: Patches_GenDrop.cs プロジェクト: Ratysz/RT_Storage
        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));
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 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);
 }