Only apply booleans if they're true

This commit is contained in:
2025-02-24 11:30:58 +01:00
parent c460a65234
commit c23be11e4b

View File

@@ -240,10 +240,15 @@ namespace TerraTech {
public void Apply() {
try {
if (_value.Value) {
if (Main.debug.Value)
Console.WriteLine("Applying to {0}: setting to {1}", _fieldName, _value.Value);
Console.WriteLine("Applying to {0}: forcing to true", _fieldName);
SetValue(_value.Value);
SetValue(true);
} else {
if (Main.debug.Value)
Console.WriteLine("Applying to {0}: leaving as {1} (config is false)", _fieldName, GetValue());
}
} catch (Exception e) {
throw new InvalidOperationException(string.Format("Failed to apply value to {0}", _fieldName), e);
}
@@ -259,7 +264,7 @@ namespace TerraTech {
if (!Main.debug.Value)
return;
var currentValue = GetValue();
Console.WriteLine("{0} {1}; {2}: {3} (original: {4}, value: {5})", prefix, _parentTraverse, _fieldName,
Console.WriteLine("{0} {1}; {2}: {3} (original: {4}, config: {5})", prefix, _parentTraverse, _fieldName,
currentValue, _originalValue, _value.Value);
}
}