@@ -62,12 +62,15 @@ void ReadColor(ConfigNode node, string key, RasterPropMonitorComputer rpmComp, r
6262
6363 public override bool Equals ( object obj )
6464 {
65+ // TODO: technically we don't need to differentiate labels by color even if they are connected to a variable, but we do need to store the colors per-label...
6566 return obj is TextBatchInfo info &&
6667 variableName == info . variableName &&
6768 font == info . font &&
68- EqualityComparer < Color32 > . Default . Equals ( zeroColor , info . zeroColor ) &&
69- EqualityComparer < Color32 > . Default . Equals ( positiveColor , info . positiveColor ) &&
70- EqualityComparer < Color32 > . Default . Equals ( negativeColor , info . negativeColor ) &&
69+ ( variableName == null ||
70+ ( EqualityComparer < Color32 > . Default . Equals ( zeroColor , info . zeroColor ) &&
71+ EqualityComparer < Color32 > . Default . Equals ( positiveColor , info . positiveColor ) &&
72+ EqualityComparer < Color32 > . Default . Equals ( negativeColor , info . negativeColor ) )
73+ ) &&
7174 flashRate == info . flashRate ;
7275 }
7376
@@ -76,9 +79,14 @@ public override int GetHashCode()
7679 var hashCode = - 1112470117 ;
7780 hashCode = hashCode * - 1521134295 + EqualityComparer < string > . Default . GetHashCode ( variableName ) ;
7881 hashCode = hashCode * - 1521134295 + font . GetHashCode ( ) ;
79- hashCode = hashCode * - 1521134295 + zeroColor . GetHashCode ( ) ;
80- hashCode = hashCode * - 1521134295 + positiveColor . GetHashCode ( ) ;
81- hashCode = hashCode * - 1521134295 + negativeColor . GetHashCode ( ) ;
82+
83+ if ( variableName != null )
84+ {
85+ hashCode = hashCode * - 1521134295 + zeroColor . GetHashCode ( ) ;
86+ hashCode = hashCode * - 1521134295 + positiveColor . GetHashCode ( ) ;
87+ hashCode = hashCode * - 1521134295 + negativeColor . GetHashCode ( ) ;
88+ }
89+
8290 hashCode = hashCode * - 1521134295 + flashRate . GetHashCode ( ) ;
8391 return hashCode ;
8492 }
@@ -132,6 +140,8 @@ public enum EmissiveMode
132140 public int refreshRate = 10 ;
133141 [ KSPField ]
134142 public bool oneshot ;
143+ [ KSPField ]
144+ public bool canBatch ;
135145
136146 private bool variablePositive = false ;
137147 private bool flashOn = true ;
@@ -214,10 +224,11 @@ public void Start()
214224
215225 if ( oneshot )
216226 {
227+ textObj . text = labels [ 0 ] . Get ( ) ;
228+
217229 var propBatcher = internalModel . GetComponentInChildren < PropBatcher > ( ) ;
218- if ( propBatcher != null )
230+ if ( propBatcher != null && canBatch )
219231 {
220- textObj . text = labels [ 0 ] . Get ( ) ;
221232 propBatcher . AddStaticLabel ( this ) ;
222233 return ;
223234 }
0 commit comments