public virtual bool IsObjectPermitted(WorldItem potentialOccupant, ReceptacleSettings settings) { if (State.Locked) { return(false); } if (potentialOccupant == null) { return(false); } if (((int)potentialOccupant.Size) > ((int)settings.MaxSize)) { //TODO use Stacks size comparison, this is error prone Debug.Log("Too big"); return(false); } if (settings.PermittedScripts.Count > 0) { if (!potentialOccupant.HasAtLeastOne(settings.PermittedScripts)) { return(false); } } if (settings.PermittedSubcats.Count > 0) { if (!settings.PermittedSubcats.Contains(potentialOccupant.Subcategory)) { return(false); } } if (settings.PermittedMaterials != WIMaterialType.None) { if (!Flags.Check((uint)settings.PermittedMaterials, (uint)potentialOccupant.Props.Global.MaterialType, Flags.CheckType.MatchAny)) { return(false); } } if (settings.PermittedItems.Count > 0) { foreach (string permittedItemName in settings.PermittedItems) { if (!Stacks.Can.Stack(potentialOccupant, permittedItemName)) { return(false); } } } return(true); }