Class Main
The main manager of PolyMod. It registers and loads the mods, and it patches game logic.
public static class Main
- Inheritance
-
Main
- Inherited Members
Methods
TechView_CreateNode(TechView, TechData, TechItem, float)
Patches TechView.CreateNode as a prefix.
Replaces the original method with a version that calculates the angle between branches of the tech tree.
[HarmonyPrefix]
[HarmonyPatch(typeof(TechView), "CreateNode")]
public static bool TechView_CreateNode(TechView __instance, TechData data, TechItem parentItem, float angle)
Parameters
__instanceTechViewThe tech view that makes the tree.
dataTechDataThe tech whose unlocked techs become the new nodes.
parentItemTechItemThe tech item of
data, or null for the root of the tree.anglefloatThe angle of the parent item, in degrees.
Returns
- bool
Always false, so the original method does not run.
Remarks
The original method uses a fixed angle of 72 degrees between branches.
This method divides 360 by the number of techs that the Basic tech unlocks for the tribe of the local player.
The division uses integers, so the angle has no decimal part.
For each tech that data unlocks, the method makes a tech item with the tribe override of the tech.
It calls CreateNode again for each tech that unlocks more techs.
At the end, it calls OnItemsRefreshed if it is set.