@@ -472,7 +472,7 @@ orderby ass.GetName().Version descending, a.path ascending
472472 errors += errorFiles [ file ] + " error" + ( errorFiles [ file ] > 1 ? "s" : "" ) + " in GameData/" + file + "\n " ;
473473
474474
475- status = "ModuleManager applied " + patchCount + " patches and found " + errorCount + " error" + ( errorCount > 1 ? "s" : "" ) ;
475+ status = "ModuleManager applied " + patchCount + " patches and found " + errorCount + " error" + ( errorCount != 1 ? "s" : "" ) ;
476476
477477 print ( "[ModuleManager] " + status + "\n " + errors ) ;
478478
@@ -511,13 +511,21 @@ public void ApplyPatch(List<String> excludePaths, string Stage)
511511 print ( "[ModuleManager] " + Stage + ( Stage == ":FIRST" ? " (default) pass" : " pass" ) ) ;
512512 foreach ( UrlDir . UrlConfig mod in GameDatabase . Instance . root . AllConfigs . ToArray ( ) )
513513 {
514- string name = RemoveWS ( mod . name ) ;
515-
516- if ( mod . type [ 0 ] == '@' || ( mod . type [ 0 ] == '$' ) || ( mod . type [ 0 ] == '!' ) )
514+ if ( ! IsBraquetBalanced ( mod . type ) )
517515 {
518- int lastErrorCount = errorCount ;
516+ print ( "[ModuleManager] Skipping a patch with unbalanced square brackets or a space (replace them with a '?') :\n " + mod . name + "\n " ) ;
517+ addErrorFiles ( mod . parent ) ;
518+ errorCount ++ ;
519+ continue ;
520+ }
519521
520- try
522+ string name = RemoveWS ( mod . type ) ;
523+
524+ int lastErrorCount = errorCount ;
525+
526+ try
527+ {
528+ if ( name [ 0 ] == '@' || ( name [ 0 ] == '$' ) || ( name [ 0 ] == '!' ) )
521529 {
522530 // Ensure the stage is correct
523531 int stageIdx = name . IndexOf ( Stage ) ;
@@ -534,9 +542,11 @@ public void ApplyPatch(List<String> excludePaths, string Stage)
534542 continue ;
535543 }
536544
545+ // TODO: do we want to ensure there's only one phase specifier?
546+
537547 if ( ! CheckNeeds ( ref name ) )
538548 {
539- print ( "[ModuleManager] node " + mod . url + " - unable to satisfy the list of things that it NEEDS! " ) ;
549+ print ( "[ModuleManager] Not applying patch " + mod . url + " - unable to satisfy NEEDS" ) ;
540550 continue ;
541551 }
542552
@@ -554,14 +564,6 @@ public void ApplyPatch(List<String> excludePaths, string Stage)
554564 string pattern = splits . Length > 1 ? splits [ 1 ] : null ;
555565 string type = splits [ 0 ] . Substring ( 1 ) ;
556566
557- if ( ! IsBraquetBalanced ( mod . name ) )
558- {
559- print ( "[ModuleManager] Skipping a patch with unbalanced square brackets or a space (replace them with a '?') :\n " + mod . name + "\n " ) ;
560- addErrorFiles ( mod . parent ) ;
561- errorCount ++ ;
562- continue ;
563- }
564-
565567 foreach ( UrlDir . UrlConfig url in GameDatabase . Instance . root . AllConfigs . ToArray ( ) )
566568 {
567569 if ( url . type == type
@@ -598,35 +600,35 @@ public void ApplyPatch(List<String> excludePaths, string Stage)
598600 }
599601 }
600602 }
601- catch ( Exception e )
602- {
603- print ( "[ModuleManager] Exception while processing node : " + mod . url + "\n " + e . ToString ( ) ) ;
604- addErrorFiles ( mod . parent ) ;
605- }
606- finally
603+ else if ( Stage == ":FIRST" && mod . type . Contains ( ":NEEDS[" ) )
607604 {
608- if ( lastErrorCount < errorCount )
609- addErrorFiles ( mod . parent , errorCount - lastErrorCount ) ;
610- }
611- }
612- else if ( Stage == ":FIRST" && mod . type . Contains ( ":NEEDS[" ) )
613- {
614- mod . parent . configs . Remove ( mod ) ;
615- string type = mod . type ;
605+ mod . parent . configs . Remove ( mod ) ;
606+ string type = mod . type ;
616607
617- // NEEDS for ordinary nodes
618- if ( ! CheckNeeds ( ref type ) )
619- {
620- print ( "[ModuleManager] Deleting Node " + mod . url + " as it can't satisfy its NEEDS" ) ;
621- continue ;
622- }
623- Debug . LogWarning ( type ) ;
608+ // NEEDS for ordinary nodes
609+ if ( ! CheckNeeds ( ref type ) )
610+ {
611+ print ( "[ModuleManager] Deleting Node " + mod . url + " as it can't satisfy its NEEDS" ) ;
612+ continue ;
613+ }
614+ Debug . LogWarning ( type ) ;
624615
625- ConfigNode copy = new ConfigNode ( type ) ;
626- mod . config . CopyTo ( copy ) ;
616+ ConfigNode copy = new ConfigNode ( type ) ;
617+ mod . config . CopyTo ( copy ) ;
627618
628- mod . parent . configs . Add ( new UrlDir . UrlConfig ( mod . parent , copy ) ) ;
619+ mod . parent . configs . Add ( new UrlDir . UrlConfig ( mod . parent , copy ) ) ;
629620
621+ }
622+ }
623+ catch ( Exception e )
624+ {
625+ print ( "[ModuleManager] Exception while processing node : " + mod . url + "\n " + e . ToString ( ) ) ;
626+ addErrorFiles ( mod . parent ) ;
627+ }
628+ finally
629+ {
630+ if ( lastErrorCount < errorCount )
631+ addErrorFiles ( mod . parent , errorCount - lastErrorCount ) ;
630632 }
631633 }
632634 }
0 commit comments