private static void UnlockTechRecursive(int techId, GameHistoryData history) { TechState state = history.TechState(techId); TechProto proto = LDB.techs.Select(techId); foreach (var techReq in proto.PreTechs) { if (!history.TechState(techReq).unlocked) { UnlockTechRecursive(techReq, history); } } foreach (var techReq in proto.PreTechsImplicit) { if (!history.TechState(techReq).unlocked) { UnlockTechRecursive(techReq, history); } } foreach (var itemReq in proto.itemArray) { if (itemReq.preTech is not null && !history.TechState(itemReq.preTech.ID).unlocked) { UnlockTechRecursive(itemReq.preTech.ID, history); } } int current = state.curLevel; for (; current < state.maxLevel; current++) { for (int j = 0; j < proto.UnlockFunctions.Length; j++) { history.UnlockTechFunction(proto.UnlockFunctions[j], proto.UnlockValues[j], current); } } history.UnlockTech(techId); }
public static void EnqueueTech_Postfix(GameHistoryData __instance, int techId) { __instance.UnlockTech(techId); GameMain.mainPlayer.mecha.corePowerGen = 10000000; }