public static bool ShouldHideCrossing(ushort nodeID, ushort segmentID)
        {
#if !DEBUG
            if (!Extensions.IsActiveFast)
            {
                // do not hide crossings in asset editor.
                return(false);
            }
#endif
            // TODO move to netnode.updateflags
            NetInfo info       = segmentID.ToSegment().Info;
            bool    isJunction = nodeID.ToNode().m_flags.IsFlagSet(NetNode.Flags.Junction);
            Extensions.Assert(isJunction, $"isJunction | segmentID:{segmentID} nodeID:{nodeID}");
            bool ret0 = NetInfoExt.GetCanHideMarkings(info);

#if DEBUG
            if (Extensions.InAssetEditor)
            {
                //Log._Debug($"Should hide crossings: {ret0} | stack:\n" + System.Environment.StackTrace);
                return(ret0); // always hide crossings in asset editor for quick testing.
            }
#endif
            bool ret1 = TMPEUTILS.HasCrossingBan(segmentID, nodeID) & NetInfoExt.GetCanHideCrossings(info);
            bool ret2 = ret0 & NS2Utils.HideJunctionMarkings(segmentID);
            bool ret  = ret1 | ret2;
            // Log._Debug($"ShouldHideCrossing segmentID={segmentID} nodeID={nodeID} ret0:{ret0} ret1:{ret1} ret2:{ret2} ret:{ret}");
            return(ret);
        }
Exemplo n.º 2
0
        public static bool ShouldHideCrossing(ushort nodeID, ushort segmentID) {
#if DEBUG
            if(Extensions.currentMode == AppMode.AssetEditor) {
                return true; // always hide crossings in asset editor for quick testing.
            }
#endif
            NetInfo info = segmentID.ToSegment().Info;
            bool ret1 = info.CanHideCrossings() && TMPEUTILS.HasCrossingBan(segmentID, nodeID);
            bool ret2 = info.CanHideMarkings() && NS2Utils.HideJunction(segmentID);

            //Texture cache is not broken.
            bool ret = PrefabUtils.MaterialCache != null;
            ret &= ret1 || ret2;
            return ret;
        }
        public static bool ShouldHideCrossing(ushort nodeID, ushort segmentID)
        {
            // TODO move to netnode.updateflags or something
            NetInfo info = segmentID.ToSegment().Info;

            // this assertion can fail due to race condition (when node controller post chanes node).
            // therefore i am commenting this out.
            // it would be nice to move as much of this code in simulation thread (eg netnode.updateflags)
            //bool isJunction = nodeID.ToNode().m_flags.IsFlagSet(NetNode.Flags.Junction);
            //Assertion.Assert(isJunction, $"isJunction | segmentID:{segmentID} nodeID:{nodeID}");

            bool ret0 = NetInfoExt.GetCanHideMarkings(info);
            bool ret1 = TMPEUTILS.HasCrossingBan(segmentID, nodeID) & NetInfoExt.GetCanHideCrossings(info);
            bool ret2 = ret0 & NS2Utils.HideJunctionMarkings(segmentID);
            bool ret  = ret1 | ret2;

            // Log.Debug($"ShouldHideCrossing segmentID={segmentID} nodeID={nodeID} ret0:{ret0} ret1:{ret1} ret2:{ret2} ret:{ret}");
            return(ret);
        }