Skip to content

Commit

Permalink
Added a compatibility fix when running mods that use the extender
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauge committed Dec 7, 2024
1 parent 3561462 commit 1d9f8c1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
30 changes: 22 additions & 8 deletions ThermalDynamics/Data/CubeBlocks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</Id>
<ModExtensions>
<Group Name="ThermalBlockProperties">
<Bool Name="Ignore" Value="false" />
<Bool Name="IgnoreThermals" Value="false" />
<Decimal Name="Conductivity" Value="0.70" />
<Decimal Name="SpecificHeat" Value="1" />
<Decimal Name="SpecificHeat" Value="1.0" />
<Decimal Name="Emissivity" Value="0.125" />
<Decimal Name="ProducerWasteEnergy" Value="0.05" />
<Decimal Name="ConsumerWasteEnergy" Value="0.05" />
Expand All @@ -21,29 +21,43 @@
</ModExtensions>
</Definition>

<!-- Hydrogen Thrusts Large -->

<Definition>
<Id>
<TypeId>Thrust</TypeId>
<SubtypeId>DefaultThermodynamics</SubtypeId>
</Id>
<ModExtensions>
<Group Name="ThermalBlockProperties">
<Bool Name="Ignore" Value="false" />
<Bool Name="IgnoreThermals" Value="false" />
<Decimal Name="Conductivity" Value="1" />
<Decimal Name="SpecificHeat" Value="2" />
<Decimal Name="Emissivity" Value="0.25" />
<Decimal Name="ProducerWasteEnergy" Value="0" />
<Decimal Name="ConsumerWasteEnergy" Value="0.25" />
<Decimal Name="CriticalTemperature" Value="1500" />
<Decimal Name="CriticalTemperature" Value="1200" />
<Decimal Name="CriticalTemperatureScaler" Value="0.25"/>
</Group>
</ModExtensions>
</Definition>



<Definition>
<Id>
<TypeId>Reactor</TypeId>
<SubtypeId>DefaultThermodynamics</SubtypeId>
</Id>
<ModExtensions>
<Group Name="ThermalBlockProperties">
<Bool Name="IgnoreThermals" Value="true" />
<Decimal Name="Conductivity" Value="1" />
<Decimal Name="SpecificHeat" Value="20" />
<Decimal Name="Emissivity" Value="0.25" />
<Decimal Name="ProducerWasteEnergy" Value="0" />
<Decimal Name="ConsumerWasteEnergy" Value="0.25" />
<Decimal Name="CriticalTemperature" Value="1500" />
<Decimal Name="CriticalTemperatureScaler" Value="0.25"/>
</Group>
</ModExtensions>
</Definition>

</CubeBlocks>
</Definitions>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Thermodynamics
public class ThermalCellDefinition
{
private static readonly MyStringId GroupId = MyStringId.GetOrCompute("ThermalBlockProperties");
private static readonly MyStringId IgnoreId = MyStringId.GetOrCompute("Ignore");
private static readonly MyStringId IgnoreId = MyStringId.GetOrCompute("IgnoreThermals");
private static readonly MyStringId ConductivityId = MyStringId.GetOrCompute("Conductivity");
private static readonly MyStringId SpecificHeatId = MyStringId.GetOrCompute("SpecificHeat");
private static readonly MyStringId EmissivityId = MyStringId.GetOrCompute("Emissivity");
Expand All @@ -27,7 +27,7 @@ public class ThermalCellDefinition
/// The block type should be ignored
/// </summary>
[ProtoMember(1)]
public bool Ignore;
public bool IgnoreThermals;

/// <summary>
/// Conductivity equation: watt / ( meter * Temp)
Expand Down Expand Up @@ -74,19 +74,19 @@ public static ThermalCellDefinition GetDefinition(MyDefinitionId defId)
ThermalCellDefinition def = new ThermalCellDefinition();
DefinitionExtensionsAPI lookup = Session.Definitions;

if (!lookup.DefinitionIdExists(defId))
bool isTrue;
if (!lookup.DefinitionIdExists(defId) || !lookup.TryGetBool(defId, GroupId, IgnoreId, out isTrue))
{
defId = new MyDefinitionId(defId.TypeId, Settings.DefaultSubtypeId);
if (!lookup.DefinitionIdExists(defId))

if (!lookup.DefinitionIdExists(defId))
{
defId = DefaultCubeBlockDefinitionId;
}
}

bool isTrue;
if (lookup.TryGetBool(defId, GroupId, IgnoreId, out isTrue))
def.Ignore = isTrue;
def.IgnoreThermals = isTrue;

double dvalue;
if (lookup.TryGetDouble(defId, GroupId, ConductivityId, out dvalue))
Expand Down

0 comments on commit 1d9f8c1

Please sign in to comment.