Exemplo n.º 1
0
        public void AddOrUpdateDoorSettings(ObjectGuid door, DoorPortalComponentEx.DoorSettings settings, bool doSimValidation)
        {
            if (mDoorSettings.ContainsKey(door))
            {
                mDoorSettings[door] = settings;
            }
            else
            {
                mDoorSettings.Add(door, settings);
            }

            if (doSimValidation)
            {
                Door door2 = GameObject.GetObject(door) as Door;

                if (door2 != null && door2.LotCurrent != null)
                {
                    foreach (Sim sim in door2.LotCurrent.mSims)
                    {
                        if (sim != null && sim.SimDescription != null && sim.RoomId == door2.GetAdjoiningRoom(door2.RoomId) && !LotManager.RoomIdIsOutside(sim.RoomId))
                        {
                            if (!settings.IsSimAllowedThrough(sim.SimDescription.SimDescriptionId))
                            {
                                StyledNotification.Format format = new StyledNotification.Format(Common.Localize("DoorFilter:WarningTrappedSims"), door2.ObjectId, ObjectGuid.InvalidObjectGuid, StyledNotification.NotificationStyle.kSystemMessage);
                                format.mTNSCategory = NotificationManager.TNSCategory.Lessons;
                                StyledNotification.Show(format);
                            }
                        }
                    }

                    foreach (Sim sim in LotManager.Actors)
                    {
                        if (sim == null || sim.mAllowedRooms == null)
                        {
                            continue;
                        }

                        sim.mAllowedRooms.Remove(door2.LotCurrent.LotId);
                    }
                }
            }
        }