Veilheim/Map/PortalList.cs
/// <summary>
///     Get the current list of <see cref="Portal" /> ZDOs
/// </summary>
/// <returns></returns>
Get the current list of  ZDOs
Get the current list of ZDOs
public static PortalList GetPortals()
        {
            Logger.LogDebug("Creating portal list from ZDOMan");
            var connected = new List<ZDO>();
            var unconnected = new Dictionary<string, ZDO>();
            foreach (var zdoarray in ZDOMan.instance.m_objectsBySector)
            {
                if (zdoarray != null)
                {
                    foreach (var zdo in zdoarray.Where(x => x.m_prefab == -661882940))
                    {
                        var tag = zdo.GetString("tag");
                        if (!unconnected.ContainsKey(tag))
                        {
                            unconnected.Add(tag, zdo);
                        }
                        else
                        {
                            connected.Add(zdo);
                            connected.Add(unconnected[tag]);
                            unconnected.Remove(tag);
                        }
                    }
                }
            }
            var ret = new PortalList();
            Portal portal;
            Logger.LogDebug("Connected Portals");
            foreach (var entry in connected.OrderBy(x => x.GetString("tag")))
            {
                portal = new Portal(entry.m_position, entry.GetString("tag"), true);
                Logger.LogDebug(portal);
                ret.Add(portal);
            }
            Logger.LogDebug("Unconnected Portals");
            foreach (var entry in unconnected.OrderBy(x => x.Value.GetString("tag")))
            {
                portal = new Portal(entry.Value.m_position, entry.Value.GetString("tag"), false);
                Logger.LogDebug(portal);
                ret.Add(portal);
            }
            return ret;
        }
public static PortalList GetPortals ( ) { Logger . LogDebug ( " " ) ; var connected = new List < ZDO > ( ) ; var unconnected = new Dictionary < string , ZDO > ( ) ; foreach ( var zdoarray in ZDOMan . instance . m_objectsBySector ) { if ( zdoarray != null ) { foreach ( var zdo in zdoarray . Where ( x => x . m_prefab == - 661882940 ) ) { var tag = zdo . GetString ( " " ) ; if ( ! unconnected . ContainsKey ( tag ) ) { unconnected . Add ( tag , zdo ) ; } else { connected . Add ( zdo ) ; connected . Add ( unconnected [ tag ] ) ; unconnected . Remove ( tag ) ; } } } } var ret = new PortalList ( ) ; Portal portal ; Logger . LogDebug ( " " ) ; foreach ( var entry in connected . OrderBy ( x => x . GetString ( " " ) ) ) { portal = new Portal ( entry . m_position , entry . GetString ( " " ) , true ) ; Logger . LogDebug ( portal ) ; ret . Add ( portal ) ; } Logger . LogDebug ( " " ) ; foreach ( var entry in unconnected . OrderBy ( x => x . Value . GetString ( " " ) ) ) { portal = new Portal ( entry . Value . m_position , entry . Value . GetString ( " " ) , false ) ; Logger . LogDebug ( portal ) ; ret . Add ( portal ) ; } return ret ; }
Get the current list of  ZDOs
Get the current list of ZDOs
// Collect all portal locations/names // Make a list of all Portals
None