Пример #1
0
        public static bool Res_Sector_IsWall(RoomSector ws, RoomSector ns)
        {
            if(ws.PortalToRoom < 0 && ns.PortalToRoom < 0 && ws.FloorPenetrationConfig == TR_PENETRATION_CONFIG.Wall)
            {
                return true;
            }

            if(ns.PortalToRoom < 0 && ns.FloorPenetrationConfig != TR_PENETRATION_CONFIG.Wall && ws.PortalToRoom >= 0)
            {
                ws = ws.CheckPortalPointer();
                if(ws.FloorPenetrationConfig == TR_PENETRATION_CONFIG.Wall || !ns.IsTwoSidePortal(ws))
                {
                    return true;
                }
            }

            return false;
        }
Пример #2
0
        public bool IsTwoSidePortal(RoomSector s2)
        {
            var s1 = CheckPortalPointer();
            s2 = s2.CheckPortalPointer();

            if (OwnerRoom == s2.OwnerRoom) return false;

            var s1p = s2.OwnerRoom.GetSectorRaw(Position);
            var s2p = s1.OwnerRoom.GetSectorRaw(s2.Position);

            if (s1p.PortalToRoom < 0)
            {
                s1p = s1p.CheckAlternateRoom();
                if (s1p.PortalToRoom < 0) return false;
            }

            if (s2p.PortalToRoom < 0)
            {
                s2p = s2p.CheckAlternateRoom();
                if (s2p.PortalToRoom < 0) return false;
            }

            return s1p.CheckPortalPointer() == s1.CheckBaseRoom() &&
                   s2p.CheckPortalPointer() == s2.CheckBaseRoom()
                   ||
                   s1p.CheckPortalPointer() == s1.CheckAlternateRoom() &&
                   s2p.CheckPortalPointer() == s2.CheckAlternateRoom();
        }