public static ushort AutoAssignLineDepot(ushort lineID, out Vector3 stopPosition) { stopPosition = Singleton <NetManager> .instance.m_nodes.m_buffer[(int)TransportManager.instance.m_lines.m_buffer[(int)lineID].GetStop(0)] .m_position; ushort closestDepot = DepotUtil.GetClosestDepot(lineID, stopPosition); if ((int)closestDepot != 0) { CachedTransportLineData.SetDepot(lineID, closestDepot); UnityEngine.Debug.LogWarning($"IPT2: auto assigned depot {closestDepot} to line {lineID}"); } return(closestDepot); }
public static bool ValidateDepotAndFindNewIfNeeded(ushort lineID, ref ushort depotID, TransportInfo transportInfo) { if (transportInfo == null) { return(false); } if (depotID != 0 && DepotUtil.IsValidDepot(depotID, transportInfo)) { return(true); } depotID = AutoAssignLineDepot(lineID, out _); return(depotID != 0); }