示例#1
0
        public bool Allow(Common.IStatGenerator stats, Lot lot, ICollection <SimDescription> sims, FindLotFlags flags, bool allowRentable)
        {
            LotOptions lotData = Options.GetLotOptions(lot);

            if (UnchartedIslandMarker.IsUnchartedIsland(lot))
            {
                stats.IncStat("Find Lot: Uncharted");
                return(false);
            }
            else if (!lotData.GetValue <AllowLotUseOption, bool>())
            {
                stats.IncStat("Find Lot: Lot Allow Denied");
                return(false);
            }
            else if (!PassesHomeInspection(stats, lot, sims, flags))
            {
                stats.IncStat("Find Lot: Home Inspection");
                return(false);
            }

            if (!allowRentable)
            {
                if (Money.GetDeedOwner(lot) != null)
                {
                    return(false);
                }
            }

            return(lotData.AllowCastes(stats, sims));
        }
示例#2
0
        protected static void DropNonMatchingStudents(ManagerCareer manager, Common.IStatGenerator stats, Lot lot)
        {
            LotOptions lotOptions = manager.GetLotOptions(lot);

            foreach (RabbitHole hole in lot.GetObjects <RabbitHole>())
            {
                if (hole.CareerLocations == null)
                {
                    continue;
                }

                foreach (CareerLocation location in hole.CareerLocations.Values)
                {
                    if (location == null)
                    {
                        continue;
                    }

                    if (location.Career is School)
                    {
                        if (location.Workers == null)
                        {
                            continue;
                        }

                        foreach (SimDescription sim in new List <SimDescription>(location.Workers))
                        {
                            try
                            {
                                if (!lotOptions.AllowCastes(stats, sim))
                                {
                                    if (sim.CareerManager != null)
                                    {
                                        if (sim.CareerManager.School != null)
                                        {
                                            sim.CareerManager.School.LeaveJobNow(Career.LeaveJobReason.kJobBecameInvalid);
                                        }

                                        sim.CareerManager.School = null;
                                    }

                                    manager.Scenarios.Post(new ScheduledAssignSchoolScenario(sim));
                                }
                            }
                            catch (Exception e)
                            {
                                Common.Exception(sim, e);
                            }
                        }
                    }
                }
            }
        }
示例#3
0
        public bool AllowSim(Common.IStatGenerator stats, Sim sim, Lot lot)
        {
            if (sim == null)
            {
                return(false);
            }

            if (!lot.IsOpenVenue())
            {
                stats.IncStat("Not Open Venue");
                return(false);
            }
            else if (UnchartedIslandMarker.IsUnchartedIsland(lot))
            {
                stats.IncStat("Uncharted");
                return(false);
            }

            LotOptions lotOptions = GetLotOptions(lot);

            if (!lotOptions.GetValue <AllowLotPushOption, bool>())
            {
                stats.IncStat("Lot Push Denied");
                return(false);
            }

            if (!lotOptions.AllowCastes(stats, sim.SimDescription))
            {
                return(false);
            }

            switch (lot.CommercialLotSubType)
            {
            case CommercialLotSubType.kEP2_JunkyardNoVisitors:
            case CommercialLotSubType.kMisc_NoVisitors:
                stats.IncStat("No Visitors");
                return(false);

            case CommercialLotSubType.kArtGallery:
            case CommercialLotSubType.kTheatre:
                if (sim.TraitManager.HasElement(TraitNames.CantStandArt))
                {
                    stats.IncStat("CantStandArt");
                    return(false);
                }
                break;

            case CommercialLotSubType.kBeach:
            case CommercialLotSubType.kEP3_DanceClubPool:
            case CommercialLotSubType.kPool:
            case CommercialLotSubType.kFishingSpot:
                if (sim.TraitManager.HasElement(TraitNames.CantStandArt))
                {
                    stats.IncStat("CantStandArt");
                    return(false);
                }
                break;

            case CommercialLotSubType.kGym:
                if (sim.TraitManager.HasElement(TraitNames.CouchPotato))
                {
                    stats.IncStat("CouchPotato");
                    return(false);
                }
                break;

            case CommercialLotSubType.kGraveyard:
                if (sim.TraitManager.HasElement(TraitNames.Coward))
                {
                    stats.IncStat("Coward");
                    return(false);
                }
                break;
            }

            CarryingChildPosture posture = sim.CarryingChildPosture;

            if (posture != null)
            {
                if (!AllowSim(stats, posture.Child, lot))
                {
                    stats.IncStat("Child Fail");
                    return(false);
                }
            }

            return(true);
        }