Skip to content

Commit

Permalink
allow for more than one component type to work for double heatsinks, …
Browse files Browse the repository at this point in the history
…version bump to 1.0, add license, add README, fixes #3
  • Loading branch information
janxious committed Jul 19, 2018
1 parent 396dbb5 commit 25e7e05
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 15 deletions.
8 changes: 4 additions & 4 deletions InternalHeaters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public static float DoubleHeatsinkEngineDissipation(MechDef mechDef, HeatConstan
var heatsinks = Array.FindAll(mechDef.Inventory,
componentRef => componentRef.ComponentDefType == ComponentType.HeatSink);
if (ModSettings.AllDoubleHeatSinksDoubleEngineHeatDissipation &&
heatsinks.Any(componentRef => componentRef.ComponentDefID == ModSettings.DoubleHeatSinksDoubleEngineHeatDissipationComponentId) &&
heatsinks.All(componentRef => componentRef.ComponentDefID == ModSettings.DoubleHeatSinksDoubleEngineHeatDissipationComponentId))
heatsinks.Any(componentRef => ModSettings.DoubleHeatSinksDoubleEngineHeatDissipationComponentIds.Contains(componentRef.ComponentDefID)) &&
heatsinks.All(componentRef => ModSettings.DoubleHeatSinksDoubleEngineHeatDissipationComponentIds.Contains(componentRef.ComponentDefID)))
{
var componentHeatRemoval = 0f;
if (ModSettings.DoNotCountFirstDoubleHeatSinksComponentDissipation)
{
var component = (HeatSinkDef)heatsinks.First(componentRef =>
componentRef.ComponentDefID ==
ModSettings.DoubleHeatSinksDoubleEngineHeatDissipationComponentId).Def;
ModSettings.DoubleHeatSinksDoubleEngineHeatDissipationComponentIds.Contains(componentRef.ComponentDefID)
).Def;
componentHeatRemoval = component.DissipationCapacity;
}
return (heatConstants.DefaultHeatSinkDissipationCapacity * heatConstants.InternalHeatSinkCount) - componentHeatRemoval;
Expand Down
2 changes: 2 additions & 0 deletions InternalHeaters.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
<Compile Include="Settings.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="LICENSE" />
<Content Include="mod.json" />
<Content Include="README.md" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2018 Joel Meador

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Battletech Game - Internal Heaters

This mod allows one to emulate engines with more internal heatsinks than the base game allows through a couple of methods.

1. Change the amount of internal single heatsinks a mech has.
2. Allow for certain items (the vanilla double heatsink by default) to make the engine have double heatsinks

This mod also changes calculations for heatsink stats in the mech bay display to be accurate for the new heat dissipation.

## Install
- [Install BTML and Modtek](https://github.com/Mpstark/ModTek/wiki/The-Drop-Dead-Simple-Guide-to-Installing-BTML-&-ModTek-&-ModTek-mods).
- Put the InternalHeaters folder containing the `InternalHeaters.dll` and `mod.json` files into your `\BATTLETECH\Mods` folder.
- If you want to change any settings described below do so in the mod.json.
- Start the game.

## Settings
Setting | Type | Default | Description
--- | --- | --- | ---
`useChassisHeatSinks` | `bool` | false | change the size of mechs using the format `"chassis string" : multiplier`. A big locust would be like `"chassisdef_locust_LCT-1V": 15`
`allDoubleHeatSinksDoubleEngineHeatDissipation` | `bool`| true | if the only heatsink components found in the mech are those specified in `doubleHeatSinksDoubleEngineHeatDissipationComponentIds`, the base heat dissipation of the mech is doubled
`doubleHeatSinksDoubleEngineHeatDissipationComponentIds` | `array` of string component ids | `["Gear_Heatsink_Generic_Double"]` | array of component ids for items that are allowed to be used for double heatsink'ing
`doNotCountFirstDoubleHeatSinksComponentDissipation` | `bool` | false | ignore the first heatsink'ing of the first detected item of type specified in `doubleHeatSinksDoubleEngineHeatDissipationComponentIds`. this is useful if you want to use a component like the vanilla double heatsink as a placeholder for double engine and get 60 heat dissipation instead of 66.
`debug` | `bool` | false | enable debug logging
`doubleHeatSinksDoubleEngineHeatDissipationComponentId` | `string` | `"Gear_Heatsink_Generic_Double"` | **DEPRECATED** set the heatsink component that when exclusively installed causes double heatsink'ing.

*Note: `doubleHeatSinksDoubleEngineHeatDissipationComponentId` is still usable to allow for transition from version 0.0.10 to 1.0.0. It will be removed in the next version.*

## Requirements

* [Battletech Game](http://battletechgame.com/)
* [BTML](https://github.com/Mpstark/BattleTechModLoader)
* [ModTek](https://github.com/Mpstark/ModTek))

## Special Thanks

Thanks HBS for the great game and thanks mpstark for the mod framework.

## License

[MIT](LICENSE)
16 changes: 12 additions & 4 deletions Settings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace InternalHeaters
using System.Collections.Generic;

namespace InternalHeaters
{
public class Settings
{
Expand All @@ -16,10 +18,16 @@ public class Settings
public bool allDoubleHeatSinksDoubleEngineHeatDissipation = true;
public bool AllDoubleHeatSinksDoubleEngineHeatDissipation => allDoubleHeatSinksDoubleEngineHeatDissipation;

// the component id for the item that makes double heat sinking happen
// the component id(s) for the item(s) that makes double heat sinking happen
// default is the vanilla DHS
public string doubleHeatSinksDoubleEngineHeatDissipationComponentId = "Gear_HeatSink_Generic_Double";
public string DoubleHeatSinksDoubleEngineHeatDissipationComponentId => doubleHeatSinksDoubleEngineHeatDissipationComponentId;
// The singular version is the pre-1.0 version of this.
public string doubleHeatSinksDoubleEngineHeatDissipationComponentId
{
set => doubleHeatSinksDoubleEngineHeatDissipationComponentIds.Add(value);
}
public List<string> doubleHeatSinksDoubleEngineHeatDissipationComponentIds = new List<string> {"Gear_Heatsink_Generic_Double"};
public List<string> DoubleHeatSinksDoubleEngineHeatDissipationComponentIds =>
doubleHeatSinksDoubleEngineHeatDissipationComponentIds;

// enable this to remove the Heatsinking properties of the first heatsink item used to
// create double heatsinking of the engine. e.g. if one DHS is installed, then the mech dissipates 60 heat insteat of 66
Expand Down
11 changes: 4 additions & 7 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Name": "InternalHeaters",
"Enabled": true,

"Version": "0.0.10",
"Version": "1.0.0",

"Author": "janxious",
"Website": "https://github.com/janxious/InternalHeaters",
Expand All @@ -13,14 +13,11 @@
"ConflictsWith": [],

"Settings": {
"debug": false,

"useChassisHeatSinks": false,

"allDoubleHeatSinksDoubleEngineHeatDissipation": true,
"doubleHeatSinksDoubleEngineHeatDissipationComponentIds": ["Gear_HeatSink_Generic_Double"],
"doNotCountFirstDoubleHeatSinksComponentDissipation": false,

"doubleHeatSinksDoubleEngineHeatDissipationComponentId": "Gear_HeatSink_Generic_Double",

"doNotCountFirstDoubleHeatSinksComponentDissipation": false
"debug": false
}
}

0 comments on commit 25e7e05

Please sign in to comment.