Added Platforms disable option

+Added an option to disable Platform objects parsing and rendering
This commit is contained in:
izawartka 2025-07-21 18:59:44 +02:00
parent 884652ac8f
commit f6ca38e0f9
4 changed files with 9 additions and 4 deletions

View File

@ -12,6 +12,7 @@ import ElectrificationStatusPopup from './additional-layer-components/Electrific
import SpawnPointRenderer from './object-renderers/SpawnPointRenderer';
import IsolationEndRenderer from './object-renderers/IsolationEndRenderer';
import PlatformRenderer from './object-renderers/PlatformRenderer';
import Constants from '../../helpers/constants';
const ObjectRendererQueue = [
{
@ -19,7 +20,7 @@ const ObjectRendererQueue = [
'category': 'misc',
'type': 'Platform',
'renderer': PlatformRenderer,
'cond': (layers) => layers['platforms'],
'cond': (layers) => layers['platforms'] && !Constants.parser.skipPlatforms
},
{
'name': 'tracks',

View File

@ -36,6 +36,8 @@ export default function LayersMenu(props) {
function LayersMenuItem(props) {
const { layer, isChecked, onToggle } = props;
if(layer.cond && !layer.cond()) return null;
return (
<li>
<label>

View File

@ -20,7 +20,8 @@ const Constants = {
attachSignsMaxDistanceX: 0.3,
attachSignsGridSize: 10,
logAttachedSigns: false,
skipBaseMisc: true
skipBaseMisc: true,
skipPlatforms: false
},
warnings: {
all: false, // enable all warnings
@ -67,6 +68,7 @@ const Constants = {
id: 'platforms',
name: 'Platforms (WIP)',
default: true,
cond: () => !Constants.parser.skipPlatforms,
},
{
id: 'tracks',

View File

@ -176,12 +176,12 @@ export default class SceneryParser {
const id = SceneryParser.nextMiscId++;
if (Platform.isPlatform(prefabName)) {
if(Constants.parser.skipPlatforms) return null;
return Platform.fromText(id, text, miscGroups);
} else if(SignalBox.isSignalBox(prefabName)) {
return SignalBox.fromText(id, text, miscGroups);
} else if(Constants.parser.skipBaseMisc) {
return null;
} else {
if(Constants.parser.skipBaseMisc) return null;
return Misc.fromText(id, text, miscGroups);
}
}