
Theory of Toolbox - Compatibility Guide
Welcome to the guide for implementation compatibility patches for Theory of Toolbox. Here I will list potential breaking stuff.
Each guide will start with following having specific meaning:
- Player/Modder - can be implement by either player or mod author
- Modder Only - can only be implemented by mod author via dedicated patch (as soft dependency, cause you will need to compile ToT jar)
So as player or modder you will first need to do following thing. Create special csv file in data/campaign path of mod, that adds new commodity. Name of this file is : aotd_econ_sheet.csv
If entry is not present, commodity econ data will be created with default mults of 1, and internal cut = 0.05 and external = 0.15, with econUnitMult = 1
Below image example of proper csv file.

aotd_econ_sheet.csv
Explanation of all rows and what they do:
- commodityId - id of commodity you wanna implement
- supplyEconUnitMult - multiplier used to translate production units to actual cargo
- demandEconUnitMult - multiplier used to translate demand units to actual cargo
- calculationScript - can be ignored, leftover of no longer used impl
- internalCut - percentage of how much you earn per one unit of commodity sold inside your faction
- externalCut - percentage of how much you earn per one unit of commodity sold outside your faction
- econUnitMult - mult that changes existing econ unit, useful if you want to have commodity in higher numbers appear in markets.
That is all, now you have means to implement modded commodities
If you add custom submarket, that also sells commodities, like food, fuel etc, will need compatibility patch. While it won't cause crashes, there is some VERY weird behavior occurring, that markets spawn suddenly 1M ores for example to sell. I was not able to pinpoint issue to solve it, without overriding SubmarketAPI
Here in that case you need to only modify one method with inclusion if Theory of Toolbox is enabled.
Note, you will need to compile your mod with Theory of Toolbox jar included. This is soft dependency so your mod will be working fine without Toolbox, but you will need it to compile it.
Code: java
@Override
public int getStockpileLimit(CommodityOnMarketAPI com) {
float limit = 0;
if(Global.getSettings().getModManager().isModEnabled("aotd_theory_of_toolbox")){
limit = AoTDOpenMarketPlugin.getStockPileToolbox(com);
}
else{
limit = OpenMarketPlugin.getBaseStockpileLimit(com);
}
Random random = new Random(market.getId().hashCode() + submarket.getSpecId().hashCode() + Global.getSector().getClock().getMonth() * 170000);
limit *= 0.9f + 0.2f * random.nextFloat();
float sm = market.getStabilityValue() / 10f;
limit *= (0.25f + 0.75f * sm);
if (limit < 0) limit = 0;
return (int) limit;
}Congratulations, that is all.
If your mod introduces custom instance of Population and Infrastructure, you will need to do following.
Same as with submarket issue, you need to compile your mod with AoTDTheoryToolbox.jar, and after that two things.
- Create copy of your class that instead of extending from PopulationAndInfrastructure it extends from AoTDToolboxPopAndInfra
- Replace class in onAboutToGenerateCodex only when Theory of Toolbox is enabled.
Have example bellow. I do the same to replace vanilla class, without need of having CSV that overrides it.
Code: java
if(Global.getSettings().getModManager().isModEnabled("aotd_theory_of_toolbox")){
Global.getSettings().getIndustrySpec(Industries.POPULATION).setPluginClass(AoTDToolboxPopAndInfra.class.getName());
}That is all for this issue.
If you still have issue and solution was not posted here? Contact me on discord, Kaysaar. I am present on my own dedicated server, link present on website. I will guide you and help you with problem, and then make guide for it for others.
