Unstable 0.16.1.0
This commit is contained in:
@@ -556,7 +556,14 @@ namespace Barotrauma
|
||||
switch (Name)
|
||||
{
|
||||
case nameof(Powered.Voltage):
|
||||
if (parentObject is Powered powered) { value = powered.Voltage; return true; }
|
||||
{
|
||||
if (parentObject is Powered powered) { value = powered.Voltage; return true; }
|
||||
}
|
||||
break;
|
||||
case nameof(Powered.CurrPowerConsumption):
|
||||
{
|
||||
if (parentObject is Powered powered) { value = powered.CurrPowerConsumption; return true; }
|
||||
}
|
||||
break;
|
||||
case nameof(PowerContainer.Charge):
|
||||
{
|
||||
@@ -568,6 +575,11 @@ namespace Barotrauma
|
||||
if (parentObject is PowerContainer powerContainer) { value = powerContainer.ChargePercentage; return true; }
|
||||
}
|
||||
break;
|
||||
case nameof(PowerContainer.RechargeRatio):
|
||||
{
|
||||
if (parentObject is PowerContainer powerContainer) { value = powerContainer.RechargeRatio; return true; }
|
||||
}
|
||||
break;
|
||||
case nameof(Reactor.AvailableFuel):
|
||||
{ if (parentObject is Reactor reactor) { value = reactor.AvailableFuel; return true; } }
|
||||
break;
|
||||
|
||||
@@ -262,6 +262,28 @@ namespace Barotrauma
|
||||
return val;
|
||||
}
|
||||
|
||||
public static double GetAttributeDouble(this XElement element, string name, double defaultValue)
|
||||
{
|
||||
if (element?.Attribute(name) == null) { return defaultValue; }
|
||||
|
||||
double val = defaultValue;
|
||||
try
|
||||
{
|
||||
string strVal = element.Attribute(name).Value;
|
||||
if (strVal.LastOrDefault() == 'f')
|
||||
{
|
||||
strVal = strVal.Substring(0, strVal.Length - 1);
|
||||
}
|
||||
val = double.Parse(strVal, CultureInfo.InvariantCulture);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in " + element + "!", e);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
public static float[] GetAttributeFloatArray(this XElement element, string name, float[] defaultValue)
|
||||
{
|
||||
if (element?.Attribute(name) == null) { return defaultValue; }
|
||||
|
||||
Reference in New Issue
Block a user