Ejemplo n.º 1
0
        public override bool OnApproachingPortalObject(Sim sim)
        {
            DoorSettings settings = GoHere.Settings.GetDoorSettings(this.OwnerDoor.ObjectId, false);
            bool         allowed  = true;

            if (settings != null)
            {
                allowed = settings.IsSimAllowedThrough(sim.SimDescription.SimDescriptionId);

                if (settings.mIsOneWayDoor)
                {
                    CommonDoor.tSide sideInRoom = CommonDoor.tSide.Front;
                    this.OwnerDoor.GetSideOfDoorInRoom(sim.RoomId, out sideInRoom);
                    if (sideInRoom != CommonDoor.tSide.Back)
                    {
                        return(false);
                    }
                }
            }

            return(!allowed ? allowed : base.OnApproachingPortalObject(sim));
        }
Ejemplo n.º 2
0
            public static bool TestPortalObject(Sim sim, int dest, CommonDoor obj)
            {
                if (obj == null || sim == null)
                {
                    return(true);
                }

                CommonDoor.tSide sideInRoom = CommonDoor.tSide.Front;
                obj.GetSideOfDoorInRoom(dest, out sideInRoom);

                DoorSettings settings = GoHere.Settings.GetDoorSettings(obj.ObjectId, false);

                if (settings != null)
                {
                    if (settings.mIsOneWayDoor && sideInRoom != CommonDoor.tSide.Front)
                    {
                        return(false);
                    }

                    return(settings.IsSimAllowedThrough(sim.SimDescription.SimDescriptionId));
                }

                return(true);
            }
Ejemplo n.º 3
0
            public static bool OnAllowedInRoomCheck(int srcRoom, Sim sim)
            {
                if (sim != null && sim.LotCurrent != null)
                {
                    if (sim.RoomId == srcRoom)
                    {
                        return(true);
                    }

                    bool allowed          = false;
                    bool adjoiningAllowed = false;
                    bool allNull          = true;
                    foreach (CommonDoor obj in sim.LotCurrent.GetObjectsInRoom <CommonDoor>(srcRoom))
                    {
                        if (sim.SimDescription.Gender == Sims3.SimIFace.CAS.CASAgeGenderFlags.Male)
                        {
                            //Common.Notify("Testing " + obj.CatalogName + " in " + srcRoom);
                        }

                        CommonDoor.tSide sideInRoom = CommonDoor.tSide.Front;
                        obj.GetSideOfDoorInRoom(srcRoom, out sideInRoom);

                        DoorSettings settings = GoHere.Settings.GetDoorSettings(obj.ObjectId, false);

                        if (settings != null && settings.mIsOneWayDoor)
                        {
                            // if it's a one way door, you can only pass through the front so a back isn't in room anywhere, you're not allowed in
                            if (sideInRoom != CommonDoor.tSide.Front)
                            {
                                allNull = false;
                                continue;
                            }
                        }

                        // if front of door isn't in room, we don't care about it's filters
                        if (sideInRoom != CommonDoor.tSide.Front)
                        {
                            //Common.Notify("Skipping " + obj.CatalogName + " because front tile is in other room");
                            continue;
                        }

                        if (settings != null)
                        {
                            allNull = false;
                            allowed = settings.IsSimAllowedThrough(sim.SimDescription.SimDescriptionId);
                            if (allowed)
                            {
                                if (sim.SimDescription.Gender == Sims3.SimIFace.CAS.CASAgeGenderFlags.Male)
                                {
                                    //Common.Notify(sim.FullName + " initially allowed in " + srcRoom);
                                }
                            }
                            else
                            {
                                if (sim.SimDescription.Gender == Sims3.SimIFace.CAS.CASAgeGenderFlags.Male)
                                {
                                    //Common.Notify(sim.FullName + " NOT initially allowed in " + srcRoom);
                                }
                            }
                        }

                        if (allowed && !adjoiningAllowed)
                        {
                            //Common.Notify("Testing adjoining");
                            // eh...
                            int adjoining = obj.GetAdjoiningRoom(srcRoom);
                            //Common.Notify("Testing adjoining... adjoining to " + srcRoom + " is " + adjoining);
                            foreach (CommonDoor obj2 in obj.LotCurrent.GetObjectsInRoom <CommonDoor>(adjoining))
                            {
                                if (sim.SimDescription.Gender == Sims3.SimIFace.CAS.CASAgeGenderFlags.Male)
                                {
                                    //Common.Notify("Testing adjoining " + obj2.CatalogName + " in " + adjoining);
                                }

                                sideInRoom = CommonDoor.tSide.Front;
                                obj2.GetSideOfDoorInRoom(adjoining, out sideInRoom);
                                if (sideInRoom != CommonDoor.tSide.Front)
                                {
                                    //Common.Notify("Skipping " + obj2.CatalogName + " because front tile is in other room");
                                    continue;
                                }

                                DoorSettings settings2 = GoHere.Settings.GetDoorSettings(obj.ObjectId, false);
                                if (settings != null)
                                {
                                    allNull          = false;
                                    adjoiningAllowed = settings2.IsSimAllowedThrough(sim.SimDescription.SimDescriptionId);
                                    if (adjoiningAllowed)
                                    {
                                        if (sim.SimDescription.Gender == Sims3.SimIFace.CAS.CASAgeGenderFlags.Male)
                                        {
                                            //Common.Notify(sim.FullName + " allowed in adjoining " + adjoining);
                                        }
                                        break;
                                    }
                                }
                            }
                        }

                        if (allowed && adjoiningAllowed)
                        {
                            break;
                        }
                    }

                    if (allNull)
                    {
                        allowed = true;
                    }

                    if (sim.SimDescription.Gender == Sims3.SimIFace.CAS.CASAgeGenderFlags.Male)
                    {
                        //Common.Notify(sim.FullName + " is in " + sim.RoomId + " allowed: " + allowed.ToString() + " to room " + srcRoom);
                    }

                    return(allowed);
                }
                return(true);
            }