Ejemplo n.º 1
0
 public override bool Accepts(Thing thing)
 {
     if (!base.Accepts(thing))
     {
         return(false);
     }
     if (HasCorpse)
     {
         return(false);
     }
     if (AssignedPawn != null)
     {
         Corpse corpse = thing as Corpse;
         if (corpse == null)
         {
             return(false);
         }
         if (corpse.InnerPawn != AssignedPawn)
         {
             return(false);
         }
     }
     else if (!storageSettings.AllowedToAccept(thing))
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 2
0
 public bool AllowedToAccept(Thing t)
 {
     if (!this.filter.Allows(t))
     {
         return(false);
     }
     if (this.owner != null)
     {
         StorageSettings parentStoreSettings = this.owner.GetParentStoreSettings();
         if (parentStoreSettings != null && !parentStoreSettings.AllowedToAccept(t))
         {
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 3
0
        public static Thing FindAmmoForTurret(Pawn pawn, Building_TurretGun gun)
        {
            StorageSettings   allowedShellsSettings = pawn.IsColonist ? gun.gun.TryGetComp <CompChangeableProjectile>().allowedShellsSettings : null;
            Predicate <Thing> validator             = delegate(Thing t)
            {
                if (t.IsForbidden(pawn))
                {
                    return(false);
                }
                if (!pawn.CanReserve(t, 10, 1))
                {
                    return(false);
                }
                return((allowedShellsSettings == null || allowedShellsSettings.AllowedToAccept(t)) ? true : false);
            };

            return(GenClosest.ClosestThingReachable(gun.Position, gun.Map, ThingRequest.ForGroup(ThingRequestGroup.Shell), PathEndMode.OnCell, TraverseParms.For(pawn), 40f, validator));
        }
Ejemplo n.º 4
0
        public static Thing FindAmmoForTurret(Pawn pawn, Building_TurretGun gun)
        {
            StorageSettings   allowedShellsSettings = (!pawn.IsColonist) ? null : gun.gun.TryGetComp <CompChangeableProjectile>().allowedShellsSettings;
            Predicate <Thing> validator             = delegate(Thing t)
            {
                if (t.IsForbidden(pawn))
                {
                    return(false);
                }
                if (!pawn.CanReserve(t, 10, 1, null, false))
                {
                    return(false);
                }
                if (allowedShellsSettings != null && !allowedShellsSettings.AllowedToAccept(t))
                {
                    return(false);
                }
                return(true);
            };

            return(GenClosest.ClosestThingReachable(gun.Position, gun.Map, ThingRequest.ForGroup(ThingRequestGroup.Shell), PathEndMode.OnCell, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), 40f, validator, null, 0, -1, false, RegionType.Set_Passable, false));
        }
        public bool AllowedToAccept(ThingDef t)
        {
            bool result;

            if (!this.filter.Allows(t))
            {
                result = false;
            }
            else
            {
                if (this.owner != null)
                {
                    StorageSettings parentStoreSettings = this.owner.GetParentStoreSettings();
                    if (parentStoreSettings != null && !parentStoreSettings.AllowedToAccept(t))
                    {
                        return(false);
                    }
                }
                result = true;
            }
            return(result);
        }
Ejemplo n.º 6
0
 public bool Accepts(Thing t)
 {
     return(settings.AllowedToAccept(t));
 }