Signalboxes and signals recognition bugfix

*Fixed scp.py removing signal boxes with no name
*Fixed the parser skipping mechanical signals
*Improved loading speed of unoptimized .sc files by throwing less unknownObjectType warnings
This commit is contained in:
izawartka 2025-06-09 01:04:38 +02:00
parent 0aafbe6960
commit 18e3056c45
3 changed files with 8 additions and 2 deletions

View File

@ -102,6 +102,11 @@ export default class Scenery
return Scenery._parseMisc(text);
case 'Empty':
case 'EndRoute':
case 'MiscGroup':
case 'EndMiscGroup':
case 'Wires':
case 'Fence':
case 'TerrainPoint':
return null;
default:
SceneryParserLog.warn('unknownObjectType', `Unknown object type: ${type}`);

View File

@ -57,6 +57,7 @@ export default class Signal extends TrackObject {
if(values.length < 29) return false;
const prefabInfo = values[2].split(",");
if(/^sk\d+_[a-zA-Z]+$/.test(prefabInfo[0])) return true; // mechanical signals
if(prefabInfo.length < 2) return false;
return true;

View File

@ -4,7 +4,7 @@ import sys
#
# [ TD2 SCENERY PROCESSOR ]
# by masuo
# v1.3
# v1.4
#
BAD_WORDS = ['Empty,Empty', 'Forest Start,Forest Start', 'EndMiscGroup', 'Fence', 'TerrainPoint', 'Wires']
@ -16,7 +16,7 @@ def should_exclude(line: str) -> bool:
if line.startswith("Misc"):
values = line.split(';')
return len(values[9].strip()) == 0 or not values[2].startswith("SignalBox")
return not values[2].startswith("SignalBox")
def process_file(file_path: str):
if not file_path.endswith(".sc"):