mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-02-05 05:42:19 +08:00
work in progress
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
<TargetFramework>net472</TargetFramework>
|
<TargetFramework>net472</TargetFramework>
|
||||||
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
|
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
|
||||||
<Description>DSP MOD - CheatEnabler</Description>
|
<Description>DSP MOD - CheatEnabler</Description>
|
||||||
<Version>2.3.1</Version>
|
<Version>2.3.2</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<PackageId>CheatEnabler</PackageId>
|
<PackageId>CheatEnabler</PackageId>
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
#### 添加一些作弊功能,同时屏蔽异常检测
|
#### 添加一些作弊功能,同时屏蔽异常检测
|
||||||
|
|
||||||
## Changlog
|
## Changlog
|
||||||
|
* 2.3.2
|
||||||
|
+ Birth star options moved to [UniverseGenTweaks](https://dsp.thunderstore.io/package/soarqin/UniverseGenTweaks/)
|
||||||
|
+ Crash fix for some options
|
||||||
* 2.3.1
|
* 2.3.1
|
||||||
+ Add UXAssist to dependencies in manifest.
|
+ Add UXAssist to dependencies in manifest.
|
||||||
* 2.3.0
|
* 2.3.0
|
||||||
@@ -97,6 +100,9 @@
|
|||||||
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions
|
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions
|
||||||
|
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
* 2.3.2
|
||||||
|
+ 母星系的选项移动到了[UniverseGenTweaks](https://dsp.thunderstore.io/package/soarqin/UniverseGenTweaks/)
|
||||||
|
+ 修复了一些选项可能导致崩溃的问题
|
||||||
* 2.3.1
|
* 2.3.1
|
||||||
+ 在manifest中添加UXAssist到依赖
|
+ 在manifest中添加UXAssist到依赖
|
||||||
* 2.3.0
|
* 2.3.0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "CheatEnabler",
|
"name": "CheatEnabler",
|
||||||
"version_number": "2.3.1",
|
"version_number": "2.3.2",
|
||||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
|
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
|
||||||
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ public static class I18N
|
|||||||
private static readonly List<StringProto> StringsToAdd = new();
|
private static readonly List<StringProto> StringsToAdd = new();
|
||||||
public static void Add(string key, string enus, string zhcn = null, string frfr = null)
|
public static void Add(string key, string enus, string zhcn = null, string frfr = null)
|
||||||
{
|
{
|
||||||
var strings = LDB._strings;
|
|
||||||
var strProto = new StringProto
|
var strProto = new StringProto
|
||||||
{
|
{
|
||||||
Name = key,
|
Name = key,
|
||||||
|
|||||||
@@ -114,13 +114,15 @@ public static class DysonSpherePatch
|
|||||||
var data = GameMain.data;
|
var data = GameMain.data;
|
||||||
var galaxy = data?.galaxy;
|
var galaxy = data?.galaxy;
|
||||||
if (galaxy == null) return;
|
if (galaxy == null) return;
|
||||||
_nodeForAbsorb = new HashSet<int>[galaxy.starCount];
|
var galaxyStarCount = galaxy.starCount;
|
||||||
|
_nodeForAbsorb = new HashSet<int>[galaxyStarCount];
|
||||||
var spheres = data.dysonSpheres;
|
var spheres = data.dysonSpheres;
|
||||||
if (spheres == null) return;
|
if (spheres == null) return;
|
||||||
foreach (var sphere in spheres)
|
foreach (var sphere in spheres)
|
||||||
{
|
{
|
||||||
if (sphere?.layersSorted == null) continue;
|
if (sphere?.layersSorted == null) continue;
|
||||||
var starIndex = sphere.starData.index;
|
var starIndex = sphere.starData.index;
|
||||||
|
if (starIndex >= galaxyStarCount) continue;
|
||||||
foreach (var layer in sphere.layersSorted)
|
foreach (var layer in sphere.layersSorted)
|
||||||
{
|
{
|
||||||
if (layer == null) continue;
|
if (layer == null) continue;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
|
using BepInEx.Configuration;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@@ -8,10 +9,11 @@ namespace UniverseGenTweaks;
|
|||||||
|
|
||||||
public class MoreSettings
|
public class MoreSettings
|
||||||
{
|
{
|
||||||
private static float _minDist = 2f;
|
public static ConfigEntry<int> MaxStarCount;
|
||||||
private static float _minStep = 2f;
|
private static double _minDist = 2;
|
||||||
private static float _maxStep = 3.2f;
|
private static double _minStep = 2;
|
||||||
private static float _flatten = 0.18f;
|
private static double _maxStep = 3.2;
|
||||||
|
private static double _flatten = 0.18;
|
||||||
|
|
||||||
private static Text _minDistTitle;
|
private static Text _minDistTitle;
|
||||||
private static Text _minStepTitle;
|
private static Text _minStepTitle;
|
||||||
@@ -53,9 +55,9 @@ public class MoreSettings
|
|||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnInit))]
|
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnInit))]
|
||||||
private static void PatchGalaxyUI_OnInit(UIGalaxySelect __instance)
|
private static void UIGalaxySelect__OnInit_Postfix(UIGalaxySelect __instance)
|
||||||
{
|
{
|
||||||
__instance.starCountSlider.maxValue = UniverseGenTweaks.MaxStarCount;
|
__instance.starCountSlider.maxValue = MaxStarCount.Value;
|
||||||
|
|
||||||
CreateSliderWithText(__instance.starCountSlider, out _minDistTitle, out _minDistSlider, out _minDistText);
|
CreateSliderWithText(__instance.starCountSlider, out _minDistTitle, out _minDistSlider, out _minDistText);
|
||||||
CreateSliderWithText(__instance.starCountSlider, out _minStepTitle, out _minStepSlider, out _minStepText);
|
CreateSliderWithText(__instance.starCountSlider, out _minStepTitle, out _minStepSlider, out _minStepText);
|
||||||
@@ -65,22 +67,22 @@ public class MoreSettings
|
|||||||
_minDistTitle.name = "min-dist";
|
_minDistTitle.name = "min-dist";
|
||||||
_minDistSlider.minValue = 10f;
|
_minDistSlider.minValue = 10f;
|
||||||
_minDistSlider.maxValue = 50f;
|
_minDistSlider.maxValue = 50f;
|
||||||
_minDistSlider.value = _minDist * 10f;
|
_minDistSlider.value = (float)(_minDist * 10.0);
|
||||||
|
|
||||||
_minStepTitle.name = "min-step";
|
_minStepTitle.name = "min-step";
|
||||||
_minStepSlider.minValue = 10f;
|
_minStepSlider.minValue = 10f;
|
||||||
_minStepSlider.maxValue = _maxStep * 10f - 1f;
|
_minStepSlider.maxValue = (float)(_maxStep * 10.0 - 1.0);
|
||||||
_minStepSlider.value = _minStep * 10f;
|
_minStepSlider.value = (float)(_minStep * 10.0);
|
||||||
|
|
||||||
_maxStepTitle.name = "max-step";
|
_maxStepTitle.name = "max-step";
|
||||||
_maxStepSlider.minValue = _minStep * 10f + 1f;
|
_maxStepSlider.minValue = (float)(_minStep * 10.0 + 1.0);
|
||||||
_maxStepSlider.maxValue = 100f;
|
_maxStepSlider.maxValue = 100f;
|
||||||
_maxStepSlider.value = _maxStep * 10f;
|
_maxStepSlider.value = (float)(_maxStep * 10.0);
|
||||||
|
|
||||||
_flattenTitle.name = "flatten";
|
_flattenTitle.name = "flatten";
|
||||||
_flattenSlider.minValue = 1f;
|
_flattenSlider.minValue = 1f;
|
||||||
_flattenSlider.maxValue = 50f;
|
_flattenSlider.maxValue = 50f;
|
||||||
_flattenSlider.value = _flatten * 50f;
|
_flattenSlider.value = (float)(_flatten * 50.0);
|
||||||
|
|
||||||
TransformDeltaY(_minDistTitle.transform, -0.3573f);
|
TransformDeltaY(_minDistTitle.transform, -0.3573f);
|
||||||
TransformDeltaY(_minStepTitle.transform, -0.3573f * 2);
|
TransformDeltaY(_minStepTitle.transform, -0.3573f * 2);
|
||||||
@@ -94,7 +96,7 @@ public class MoreSettings
|
|||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnOpen))]
|
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnOpen))]
|
||||||
private static void PatchGalaxyUI_OnOpen(UIGalaxySelect __instance)
|
private static void UIGalaxySelect__OnOpen_Prefix()
|
||||||
{
|
{
|
||||||
_minDistTitle.text = "恒星最小距离".Translate();
|
_minDistTitle.text = "恒星最小距离".Translate();
|
||||||
_minStepTitle.text = "步进最小距离".Translate();
|
_minStepTitle.text = "步进最小距离".Translate();
|
||||||
@@ -108,24 +110,24 @@ public class MoreSettings
|
|||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnRegEvent))]
|
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnRegEvent))]
|
||||||
private static void PatchGalaxyUI_OnRegEvent(UIGalaxySelect __instance)
|
private static void UIGalaxySelect__OnRegEvent_Postfix(UIGalaxySelect __instance)
|
||||||
{
|
{
|
||||||
_minDistSlider.onValueChanged.RemoveAllListeners();
|
_minDistSlider.onValueChanged.RemoveAllListeners();
|
||||||
_minDistSlider.onValueChanged.AddListener(val =>
|
_minDistSlider.onValueChanged.AddListener(val =>
|
||||||
{
|
{
|
||||||
var newVal = Mathf.Round(val) / 10f;
|
var newVal = Mathf.Round(val) / 10.0;
|
||||||
if (newVal.Equals(_minDist)) return;
|
if (newVal.Equals(_minDist)) return;
|
||||||
_minDist = newVal;
|
_minDist = newVal;
|
||||||
_minDistText.text = _minDist.ToString();
|
_minDistText.text = _minDist.ToString();
|
||||||
if (_minStep < _minDist)
|
if (_minStep < _minDist)
|
||||||
{
|
{
|
||||||
_minStep = _minDist;
|
_minStep = _minDist;
|
||||||
_minStepSlider.value = _minStep * 10f;
|
_minStepSlider.value = (float)(_minStep * 10.0);
|
||||||
_minStepText.text = _minStep.ToString();
|
_minStepText.text = _minStep.ToString();
|
||||||
if (_maxStep < _minStep)
|
if (_maxStep < _minStep)
|
||||||
{
|
{
|
||||||
_maxStep = _minStep;
|
_maxStep = _minStep;
|
||||||
_maxStepSlider.value = _maxStep * 10f;
|
_maxStepSlider.value = (float)(_maxStep * 10.0);
|
||||||
_maxStepText.text = _maxStep.ToString();
|
_maxStepText.text = _maxStep.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,27 +136,27 @@ public class MoreSettings
|
|||||||
_minStepSlider.onValueChanged.RemoveAllListeners();
|
_minStepSlider.onValueChanged.RemoveAllListeners();
|
||||||
_minStepSlider.onValueChanged.AddListener(val =>
|
_minStepSlider.onValueChanged.AddListener(val =>
|
||||||
{
|
{
|
||||||
var newVal = Mathf.Round(val) / 10f;
|
var newVal = Mathf.Round(val) / 10.0;
|
||||||
if (newVal.Equals(_minStep)) return;
|
if (newVal.Equals(_minStep)) return;
|
||||||
_minStep = newVal;
|
_minStep = newVal;
|
||||||
_maxStepSlider.minValue = newVal * 10f;
|
_maxStepSlider.minValue = (float)(newVal * 10.0);
|
||||||
_minStepText.text = _minStep.ToString();
|
_minStepText.text = _minStep.ToString();
|
||||||
__instance.SetStarmapGalaxy();
|
__instance.SetStarmapGalaxy();
|
||||||
});
|
});
|
||||||
_maxStepSlider.onValueChanged.RemoveAllListeners();
|
_maxStepSlider.onValueChanged.RemoveAllListeners();
|
||||||
_maxStepSlider.onValueChanged.AddListener(val =>
|
_maxStepSlider.onValueChanged.AddListener(val =>
|
||||||
{
|
{
|
||||||
var newVal = Mathf.Round(val) / 10f;
|
var newVal = Mathf.Round(val) / 10.0;
|
||||||
if (newVal.Equals(_maxStep)) return;
|
if (newVal.Equals(_maxStep)) return;
|
||||||
_maxStep = newVal;
|
_maxStep = newVal;
|
||||||
_minStepSlider.maxValue = newVal * 10f;
|
_minStepSlider.maxValue = (float)(newVal * 10.0);
|
||||||
_maxStepText.text = _maxStep.ToString();
|
_maxStepText.text = _maxStep.ToString();
|
||||||
__instance.SetStarmapGalaxy();
|
__instance.SetStarmapGalaxy();
|
||||||
});
|
});
|
||||||
_flattenSlider.onValueChanged.RemoveAllListeners();
|
_flattenSlider.onValueChanged.RemoveAllListeners();
|
||||||
_flattenSlider.onValueChanged.AddListener(val =>
|
_flattenSlider.onValueChanged.AddListener(val =>
|
||||||
{
|
{
|
||||||
var newVal = Mathf.Round(val) / 50f;
|
var newVal = Mathf.Round(val) / 50.0;
|
||||||
if (newVal.Equals(_flatten)) return;
|
if (newVal.Equals(_flatten)) return;
|
||||||
_flatten = newVal;
|
_flatten = newVal;
|
||||||
_flattenText.text = _flatten.ToString();
|
_flattenText.text = _flatten.ToString();
|
||||||
@@ -164,7 +166,7 @@ public class MoreSettings
|
|||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnUnregEvent))]
|
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnUnregEvent))]
|
||||||
private static void PatchGalaxyUI_OnUnregEvent(UIGalaxySelect __instance)
|
private static void UIGalaxySelect__OnUnregEvent_Postfix()
|
||||||
{
|
{
|
||||||
_minDistSlider.onValueChanged.RemoveAllListeners();
|
_minDistSlider.onValueChanged.RemoveAllListeners();
|
||||||
_minStepSlider.onValueChanged.RemoveAllListeners();
|
_minStepSlider.onValueChanged.RemoveAllListeners();
|
||||||
@@ -174,70 +176,65 @@ public class MoreSettings
|
|||||||
|
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect.OnStarCountSliderValueChange))]
|
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect.OnStarCountSliderValueChange))]
|
||||||
static IEnumerable<CodeInstruction> PatchStarCountOnValueChange(IEnumerable<CodeInstruction> instructions)
|
private static IEnumerable<CodeInstruction> UIGalaxySelect_OnStarCountSliderValueChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
{
|
{
|
||||||
foreach (var instruction in instructions)
|
// Increase hard-coded maxium star count from 80 to MaxStarCount.Value
|
||||||
{
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
if (instruction.opcode == OpCodes.Ldc_I4_S && instruction.OperandIs(80))
|
matcher.MatchForward(false,
|
||||||
{
|
new CodeMatch(ci => ci.opcode == OpCodes.Ldc_I4_S && ci.OperandIs(80))
|
||||||
yield return new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(UniverseGenTweaks), nameof(UniverseGenTweaks.MaxStarCount)));
|
).Set(OpCodes.Ldsfld, AccessTools.Field(typeof(MoreSettings), nameof(MoreSettings.MaxStarCount))).Insert(
|
||||||
}
|
new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(ConfigEntry<int>), nameof(ConfigEntry<int>.Value)))
|
||||||
else
|
);
|
||||||
{
|
return matcher.InstructionEnumeration();
|
||||||
yield return instruction;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyTranspiler]
|
||||||
[HarmonyPatch(typeof(GalaxyData), MethodType.Constructor)]
|
[HarmonyPatch(typeof(GalaxyData), MethodType.Constructor)]
|
||||||
static bool PatchGalaxyData(GalaxyData __instance)
|
private static IEnumerable<CodeInstruction> GalaxyData_Constructor_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
{
|
{
|
||||||
__instance.astrosData = new AstroData[(UniverseGenTweaks.MaxStarCount + 1) * 100];
|
// 25600 -> (MaxStarCount.Value + 1) * 100
|
||||||
return false;
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
|
matcher.MatchForward(false,
|
||||||
|
new CodeMatch(ci => ci.opcode == OpCodes.Ldc_I4 && ci.OperandIs(25600))
|
||||||
|
).Set(OpCodes.Ldfld, AccessTools.Field(typeof(MoreSettings), nameof(MoreSettings.MaxStarCount))).Insert(
|
||||||
|
new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(ConfigEntry<int>), nameof(ConfigEntry<int>.Value))),
|
||||||
|
new CodeInstruction(OpCodes.Ldc_I4_1),
|
||||||
|
new CodeInstruction(OpCodes.Add),
|
||||||
|
new CodeInstruction(OpCodes.Ldc_I4_S, 100),
|
||||||
|
new CodeInstruction(OpCodes.Mul)
|
||||||
|
);
|
||||||
|
return matcher.InstructionEnumeration();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
[HarmonyPatch(typeof(UniverseGen), nameof(UniverseGen.CreateGalaxy))]
|
[HarmonyPatch(typeof(UniverseGen), nameof(UniverseGen.CreateGalaxy))]
|
||||||
static IEnumerable<CodeInstruction> PatchCreateGalaxy(IEnumerable<CodeInstruction> instructions)
|
private static IEnumerable<CodeInstruction> UniverseGen_CreateGalaxy_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
{
|
{
|
||||||
foreach (var instruction in instructions)
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
{
|
matcher.MatchForward(false,
|
||||||
if (instruction.opcode == OpCodes.Call &&
|
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(UniverseGen), nameof(UniverseGen.GenerateTempPoses)))
|
||||||
instruction.OperandIs(AccessTools.Method(typeof(UniverseGen), nameof(UniverseGen.GenerateTempPoses))))
|
).Advance(-4).RemoveInstructions(4).Insert(
|
||||||
{
|
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(MoreSettings), nameof(_minDist))),
|
||||||
var pop = new CodeInstruction(OpCodes.Pop);
|
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(MoreSettings), nameof(_minStep))),
|
||||||
yield return pop;
|
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(MoreSettings), nameof(_maxStep))),
|
||||||
yield return pop;
|
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(MoreSettings), nameof(_flatten)))
|
||||||
yield return pop;
|
);
|
||||||
yield return pop;
|
return matcher.InstructionEnumeration();
|
||||||
yield return new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(MoreSettings), nameof(_minDist)));
|
|
||||||
yield return new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(MoreSettings), nameof(_minStep)));
|
|
||||||
yield return new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(MoreSettings), nameof(_maxStep)));
|
|
||||||
yield return new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(MoreSettings), nameof(_flatten)));
|
|
||||||
}
|
|
||||||
yield return instruction;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Patch `rand() * (maxStepLen - minStepLen) + minDist` to `rand() * (maxStepLen - minStepLen) + minStepLen`,
|
/* Patch `rand() * (maxStepLen - minStepLen) + minDist` to `rand() * (maxStepLen - minStepLen) + minStepLen`,
|
||||||
this should be a bugged line in original game code. */
|
this should be a bugged line in original game code. */
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
[HarmonyPatch(typeof(UniverseGen), nameof(UniverseGen.RandomPoses))]
|
[HarmonyPatch(typeof(UniverseGen), nameof(UniverseGen.RandomPoses))]
|
||||||
static IEnumerable<CodeInstruction> PatchUniverGenRandomPoses(IEnumerable<CodeInstruction> instructions)
|
static IEnumerable<CodeInstruction> UniverseGen_RandomPoses_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
{
|
{
|
||||||
var lastIsMul = false;
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
foreach (var instruction in instructions)
|
matcher.MatchForward(false,
|
||||||
{
|
new CodeMatch(OpCodes.Mul),
|
||||||
if (lastIsMul && instruction.opcode == OpCodes.Ldarg_2)
|
new CodeMatch(OpCodes.Ldarg_2)
|
||||||
{
|
);
|
||||||
lastIsMul = false;
|
matcher.Repeat(m => m.Advance(1).SetInstructionAndAdvance(new CodeInstruction(OpCodes.Ldarg_3)));
|
||||||
yield return new CodeInstruction(OpCodes.Ldarg_3);
|
return matcher.InstructionEnumeration();
|
||||||
continue;
|
|
||||||
}
|
|
||||||
lastIsMul = instruction.opcode == OpCodes.Mul;
|
|
||||||
yield return instruction;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,17 +10,15 @@ public class UniverseGenTweaks : BaseUnityPlugin
|
|||||||
BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
|
BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
|
||||||
|
|
||||||
private bool _moreSettings = true;
|
private bool _moreSettings = true;
|
||||||
public static int MaxStarCount = 128;
|
|
||||||
private bool _epicDifficulty = true;
|
private bool _epicDifficulty = true;
|
||||||
public static float OilMultiplier = 0.5f;
|
public static float OilMultiplier = 0.5f;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_moreSettings = Config.Bind("MoreSettings", "Enabled", _moreSettings, "Enable more settings on Universe Generation").Value;
|
_moreSettings = Config.Bind("MoreSettings", "Enabled", _moreSettings, "Enable more settings on Universe Generation").Value;
|
||||||
MaxStarCount = Config.Bind("MoreSettings", "MaxStarCount", MaxStarCount,
|
MoreSettings.MaxStarCount = Config.Bind("MoreSettings", "MaxStarCount", 128,
|
||||||
new ConfigDescription("(32 ~ 1024)\nMaximum star count for Universe Generation, enable MoreSettings.Enabled to take effect",
|
new ConfigDescription("(32 ~ 1024)\nMaximum star count for Universe Generation, enable MoreSettings.Enabled to take effect",
|
||||||
new AcceptableValueRange<int>(32, 1024), new {}))
|
new AcceptableValueRange<int>(32, 1024), new {}));
|
||||||
.Value;
|
|
||||||
_epicDifficulty = Config.Bind("EpicDifficulty", "Enabled", _epicDifficulty, "Enable Epic difficulty").Value;
|
_epicDifficulty = Config.Bind("EpicDifficulty", "Enabled", _epicDifficulty, "Enable Epic difficulty").Value;
|
||||||
OilMultiplier = Config.Bind("EpicDifficulty", "OilMultiplier", OilMultiplier,
|
OilMultiplier = Config.Bind("EpicDifficulty", "OilMultiplier", OilMultiplier,
|
||||||
new ConfigDescription("Multiplier relative to the Very-Hard difficulty multiplier",
|
new ConfigDescription("Multiplier relative to the Very-Hard difficulty multiplier",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<AssemblyName>UniverseGenTweaks</AssemblyName>
|
<AssemblyName>UniverseGenTweaks</AssemblyName>
|
||||||
<BepInExPluginGuid>org.soardev.universegentweaks</BepInExPluginGuid>
|
<BepInExPluginGuid>org.soardev.universegentweaks</BepInExPluginGuid>
|
||||||
<Description>DSP MOD - UniverseGenTweaks</Description>
|
<Description>DSP MOD - UniverseGenTweaks</Description>
|
||||||
<Version>1.1.0</Version>
|
<Version>1.2.0</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "UniverseGenTweaks",
|
"name": "UniverseGenTweaks",
|
||||||
"version_number": "1.1.0",
|
"version_number": "1.2.0",
|
||||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UniverseGenTweaks",
|
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UniverseGenTweaks",
|
||||||
"description": "Universe Generation Tweaks / 宇宙生成参数调节",
|
"description": "Universe Generation Tweaks / 宇宙生成参数调节",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|||||||
Reference in New Issue
Block a user