mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-08-07 23:40:25 +08:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f6fd0fe8c | ||
|
|
35d75646a0 | ||
|
|
48c83fedd5 | ||
|
|
d8cbbdc960 | ||
|
|
86a9010258 | ||
|
|
371fd3f0b0 | ||
|
|
380c07a4a5 | ||
|
|
23aa8c1f13 | ||
|
|
944a4d7948 | ||
|
|
f7e1a27be1 |
@@ -71,6 +71,8 @@ public class CheatEnabler : BaseUnityPlugin
|
|||||||
"Enable warp without warper");
|
"Enable warp without warper");
|
||||||
DysonSpherePatch.SkipBulletEnabled = Config.Bind("DysonSphere", "SkipBullet", false,
|
DysonSpherePatch.SkipBulletEnabled = Config.Bind("DysonSphere", "SkipBullet", false,
|
||||||
"Skip bullet");
|
"Skip bullet");
|
||||||
|
DysonSpherePatch.FireAllBulletsEnabled = Config.Bind("DysonSphere", "FireAllBullets", false,
|
||||||
|
"Fire all bullets at once");
|
||||||
DysonSpherePatch.SkipAbsorbEnabled = Config.Bind("DysonSphere", "SkipAbsorb", false,
|
DysonSpherePatch.SkipAbsorbEnabled = Config.Bind("DysonSphere", "SkipAbsorb", false,
|
||||||
"Skip absorption");
|
"Skip absorption");
|
||||||
DysonSpherePatch.QuickAbsorbEnabled = Config.Bind("DysonSphere", "QuickAbsorb", false,
|
DysonSpherePatch.QuickAbsorbEnabled = Config.Bind("DysonSphere", "QuickAbsorb", false,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace CheatEnabler.Patches;
|
|||||||
public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
|
public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
|
||||||
{
|
{
|
||||||
public static ConfigEntry<bool> SkipBulletEnabled;
|
public static ConfigEntry<bool> SkipBulletEnabled;
|
||||||
|
public static ConfigEntry<bool> FireAllBulletsEnabled;
|
||||||
public static ConfigEntry<bool> SkipAbsorbEnabled;
|
public static ConfigEntry<bool> SkipAbsorbEnabled;
|
||||||
public static ConfigEntry<bool> QuickAbsorbEnabled;
|
public static ConfigEntry<bool> QuickAbsorbEnabled;
|
||||||
public static ConfigEntry<bool> EjectAnywayEnabled;
|
public static ConfigEntry<bool> EjectAnywayEnabled;
|
||||||
@@ -28,6 +29,8 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
|
|||||||
OverclockEjectorEnabled.SettingChanged += (_, _) => OverclockEjector.Enable(OverclockEjectorEnabled.Value);
|
OverclockEjectorEnabled.SettingChanged += (_, _) => OverclockEjector.Enable(OverclockEjectorEnabled.Value);
|
||||||
OverclockSiloEnabled.SettingChanged += (_, _) => OverclockSilo.Enable(OverclockSiloEnabled.Value);
|
OverclockSiloEnabled.SettingChanged += (_, _) => OverclockSilo.Enable(OverclockSiloEnabled.Value);
|
||||||
UnlockMaxOrbitRadiusEnabled.SettingChanged += (_, _) => UnlockMaxOrbitRadius.Enable(UnlockMaxOrbitRadiusEnabled.Value);
|
UnlockMaxOrbitRadiusEnabled.SettingChanged += (_, _) => UnlockMaxOrbitRadius.Enable(UnlockMaxOrbitRadiusEnabled.Value);
|
||||||
|
|
||||||
|
FireAllBulletsEnabled.SettingChanged += (_, _) => SkipBulletPatch.SetFireAllBullets(FireAllBulletsEnabled.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Start()
|
public static void Start()
|
||||||
@@ -40,6 +43,7 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
|
|||||||
OverclockSilo.Enable(OverclockSiloEnabled.Value);
|
OverclockSilo.Enable(OverclockSiloEnabled.Value);
|
||||||
UnlockMaxOrbitRadius.Enable(UnlockMaxOrbitRadiusEnabled.Value);
|
UnlockMaxOrbitRadius.Enable(UnlockMaxOrbitRadiusEnabled.Value);
|
||||||
Enable(true);
|
Enable(true);
|
||||||
|
SkipBulletPatch.SetFireAllBullets(FireAllBulletsEnabled.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Uninit()
|
public static void Uninit()
|
||||||
@@ -93,6 +97,12 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
|
|||||||
private static long _sailLifeTime;
|
private static long _sailLifeTime;
|
||||||
private static DysonSailCache[][] _sailsCache;
|
private static DysonSailCache[][] _sailsCache;
|
||||||
private static int[] _sailsCacheLen, _sailsCacheCapacity;
|
private static int[] _sailsCacheLen, _sailsCacheCapacity;
|
||||||
|
private static bool _fireAllBullets;
|
||||||
|
|
||||||
|
public static void SetFireAllBullets(bool value)
|
||||||
|
{
|
||||||
|
_fireAllBullets = value;
|
||||||
|
}
|
||||||
|
|
||||||
private struct DysonSailCache
|
private struct DysonSailCache
|
||||||
{
|
{
|
||||||
@@ -180,25 +190,28 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
|
|||||||
).Advance(2);
|
).Advance(2);
|
||||||
var start = matcher.Pos;
|
var start = matcher.Pos;
|
||||||
matcher.MatchForward(false,
|
matcher.MatchForward(false,
|
||||||
new CodeMatch(OpCodes.Pop)
|
new CodeMatch(OpCodes.Ldc_I4_M1),
|
||||||
).Advance(1);
|
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.direction)))
|
||||||
|
).Advance(2);
|
||||||
var end = matcher.Pos;
|
var end = matcher.Pos;
|
||||||
matcher.Start().Advance(start).RemoveInstructions(end - start).Insert(
|
matcher.Start().Advance(start).RemoveInstructions(end - start).Insert(
|
||||||
new CodeInstruction(OpCodes.Ldarg_3),
|
|
||||||
new CodeInstruction(OpCodes.Ldarg_0),
|
new CodeInstruction(OpCodes.Ldarg_0),
|
||||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.orbitId))),
|
new CodeInstruction(OpCodes.Ldarg_3),
|
||||||
new CodeInstruction(OpCodes.Ldloc_S, 9),
|
new CodeInstruction(OpCodes.Ldloc_S, 9),
|
||||||
new CodeInstruction(OpCodes.Ldloc_S, 11),
|
new CodeInstruction(OpCodes.Ldloc_S, 11),
|
||||||
|
new CodeInstruction(OpCodes.Ldarg_S, 6),
|
||||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(SkipBulletPatch), nameof(SkipBulletPatch.AddDysonSail)))
|
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(SkipBulletPatch), nameof(SkipBulletPatch.AddDysonSail)))
|
||||||
);
|
);
|
||||||
return matcher.InstructionEnumeration();
|
return matcher.InstructionEnumeration();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddDysonSail(DysonSwarm swarm, int orbitId, VectorLF3 uPos, VectorLF3 endVec)
|
private static void AddDysonSail(ref EjectorComponent ejector, DysonSwarm swarm, VectorLF3 uPos, VectorLF3 endVec, int[] consumeRegister)
|
||||||
{
|
{
|
||||||
var index = swarm.starData.index;
|
var index = swarm.starData.index;
|
||||||
|
var orbitId = ejector.orbitId;
|
||||||
var delta1 = endVec - swarm.starData.uPosition;
|
var delta1 = endVec - swarm.starData.uPosition;
|
||||||
var delta2 = VectorLF3.Cross(endVec - uPos, swarm.orbits[orbitId].up).normalized * Math.Sqrt(swarm.dysonSphere.gravity / swarm.orbits[orbitId].radius);
|
var delta2 = VectorLF3.Cross(endVec - uPos, swarm.orbits[orbitId].up).normalized * Math.Sqrt(swarm.dysonSphere.gravity / swarm.orbits[orbitId].radius);
|
||||||
|
var bulletCount = ejector.bulletCount;
|
||||||
lock (swarm)
|
lock (swarm)
|
||||||
{
|
{
|
||||||
var cache = _sailsCache[index];
|
var cache = _sailsCache[index];
|
||||||
@@ -208,6 +221,24 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
|
|||||||
SetSailsCacheCapacity(index, 256);
|
SetSailsCacheCapacity(index, 256);
|
||||||
cache = _sailsCache[index];
|
cache = _sailsCache[index];
|
||||||
}
|
}
|
||||||
|
if (_fireAllBullets)
|
||||||
|
{
|
||||||
|
var capacity = _sailsCacheCapacity[index];
|
||||||
|
var leastCapacity = len + bulletCount;
|
||||||
|
if (leastCapacity > capacity)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
capacity *= 2;
|
||||||
|
} while (leastCapacity > capacity);
|
||||||
|
SetSailsCacheCapacity(index, capacity);
|
||||||
|
cache = _sailsCache[index];
|
||||||
|
}
|
||||||
|
_sailsCacheLen[index] = len + bulletCount;
|
||||||
|
var end = len + bulletCount;
|
||||||
|
for (var i = len; i < end; i++)
|
||||||
|
cache[i].FromData(delta1, delta2 + RandomTable.SphericNormal(ref swarm.randSeed, 0.5), orbitId);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var capacity = _sailsCacheCapacity[index];
|
var capacity = _sailsCacheCapacity[index];
|
||||||
@@ -216,12 +247,46 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
|
|||||||
SetSailsCacheCapacity(index, capacity * 2);
|
SetSailsCacheCapacity(index, capacity * 2);
|
||||||
cache = _sailsCache[index];
|
cache = _sailsCache[index];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_sailsCacheLen[index] = len + 1;
|
_sailsCacheLen[index] = len + 1;
|
||||||
cache[len].FromData(delta1, delta2 + RandomTable.SphericNormal(ref swarm.randSeed, 0.5), orbitId);
|
cache[len].FromData(delta1, delta2 + RandomTable.SphericNormal(ref swarm.randSeed, 0.5), orbitId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_fireAllBullets)
|
||||||
|
{
|
||||||
|
if (!ejector.incUsed)
|
||||||
|
{
|
||||||
|
ejector.incUsed = ejector.bulletInc >= bulletCount;
|
||||||
|
}
|
||||||
|
ejector.bulletInc = 0;
|
||||||
|
ejector.bulletCount = 0;
|
||||||
|
lock (consumeRegister)
|
||||||
|
{
|
||||||
|
consumeRegister[ejector.bulletId] += bulletCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var inc = ejector.bulletInc / bulletCount;
|
||||||
|
if (!ejector.incUsed)
|
||||||
|
{
|
||||||
|
ejector.incUsed = inc > 0;
|
||||||
|
}
|
||||||
|
ejector.bulletInc -= inc;
|
||||||
|
ejector.bulletCount = bulletCount - 1;
|
||||||
|
if (ejector.bulletCount == 0)
|
||||||
|
{
|
||||||
|
ejector.bulletInc = 0;
|
||||||
|
}
|
||||||
|
lock (consumeRegister)
|
||||||
|
{
|
||||||
|
consumeRegister[ejector.bulletId]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ejector.time = ejector.coldSpend;
|
||||||
|
ejector.direction = -1;
|
||||||
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(DysonSwarm), "GameTick")]
|
[HarmonyPatch(typeof(DysonSwarm), "GameTick")]
|
||||||
public static void DysonSwarm_GameTick_Prefix(DysonSwarm __instance, long time)
|
public static void DysonSwarm_GameTick_Prefix(DysonSwarm __instance, long time)
|
||||||
|
|||||||
@@ -418,6 +418,40 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
|||||||
return matcher.InstructionEnumeration();
|
return matcher.InstructionEnumeration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
[HarmonyTranspiler]
|
||||||
|
[HarmonyPatch(typeof(ConstructionSystem), nameof(ConstructionSystem.AddBuildTargetToModules))]
|
||||||
|
private static IEnumerable<CodeInstruction> ConstructionSystem_AddBuildTargetToModules_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
|
{
|
||||||
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
|
// 13 0035 ldarg.0
|
||||||
|
// 14 0036 ldfld class Player ConstructionSystem::player
|
||||||
|
// 15 003B callvirt instance class Mecha Player::get_mecha()
|
||||||
|
// 16 0040 ldfld float32 Mecha::buildArea
|
||||||
|
// 17 0045 stloc.0
|
||||||
|
matcher.MatchForward(false,
|
||||||
|
new CodeMatch(OpCodes.Ldarg_0),
|
||||||
|
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(ConstructionSystem), nameof(ConstructionSystem.player))),
|
||||||
|
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Player), nameof(Player.mecha))),
|
||||||
|
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(Mecha), nameof(Mecha.buildArea))),
|
||||||
|
new CodeMatch(ci => ci.IsStloc())
|
||||||
|
);
|
||||||
|
var labels = matcher.Labels;
|
||||||
|
matcher.Labels = [];
|
||||||
|
matcher.Insert(
|
||||||
|
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
|
||||||
|
new CodeInstruction(OpCodes.Ldarg_1),
|
||||||
|
Transpilers.EmitDelegate((ConstructionSystem constructionSystem, int objId) =>
|
||||||
|
{
|
||||||
|
var player = constructionSystem.player;
|
||||||
|
player.factory.BuildFinally(player, objId);
|
||||||
|
}),
|
||||||
|
new CodeInstruction(OpCodes.Ret)
|
||||||
|
);
|
||||||
|
return matcher.InstructionEnumeration();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(UXAssist.Functions.PlanetFunctions), nameof(UXAssist.Functions.PlanetFunctions.BuildOrbitalCollectors))]
|
[HarmonyPatch(typeof(UXAssist.Functions.PlanetFunctions), nameof(UXAssist.Functions.PlanetFunctions.BuildOrbitalCollectors))]
|
||||||
private static void UXAssist_PlanetFunctions_BuildOrbitalCollectors_Postfix()
|
private static void UXAssist_PlanetFunctions_BuildOrbitalCollectors_Postfix()
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public static class UIConfigWindow
|
|||||||
"传送带信号物品生成数量格式:\n 默认为AAAABC\n 勾选替换为BCAAAA\nAAAA=生成速度,B=增产点数,C=堆叠数量");
|
"传送带信号物品生成数量格式:\n 默认为AAAABC\n 勾选替换为BCAAAA\nAAAA=生成速度,B=增产点数,C=堆叠数量");
|
||||||
I18N.Add("Count generations as production in statistics", "Count generations as production in statistics", "统计信息里将生成计算为产物");
|
I18N.Add("Count generations as production in statistics", "Count generations as production in statistics", "统计信息里将生成计算为产物");
|
||||||
I18N.Add("Count removals as consumption in statistics", "Count removals as consumption in statistics", "统计信息里将移除计算为消耗");
|
I18N.Add("Count removals as consumption in statistics", "Count removals as consumption in statistics", "统计信息里将移除计算为消耗");
|
||||||
I18N.Add("Count all raws and intermediates in statistics","Count all raw materials in statistics", "统计信息里计算所有原料和中间产物");
|
I18N.Add("Count all raws and intermediates in statistics", "Count all raw materials in statistics", "统计信息里计算所有原料和中间产物");
|
||||||
I18N.Add("Remove power space limit", "Remove space limit for winds and geothermals", "移除风力发电和地热发电的间距限制");
|
I18N.Add("Remove power space limit", "Remove space limit for winds and geothermals", "移除风力发电和地热发电的间距限制");
|
||||||
I18N.Add("Boost wind power", "Boost wind power(x100,000)", "提升风力发电(x100,000)");
|
I18N.Add("Boost wind power", "Boost wind power(x100,000)", "提升风力发电(x100,000)");
|
||||||
I18N.Add("Boost solar power", "Boost solar power(x100,000)", "提升太阳能发电(x100,000)");
|
I18N.Add("Boost solar power", "Boost solar power(x100,000)", "提升太阳能发电(x100,000)");
|
||||||
@@ -53,12 +53,14 @@ public static class UIConfigWindow
|
|||||||
I18N.Add("Boost fuel power 2", "(x20,000 for deuteron, x10,000 for antimatter)", "(氘核燃料棒x20,000,反物质燃料棒x10,000)");
|
I18N.Add("Boost fuel power 2", "(x20,000 for deuteron, x10,000 for antimatter)", "(氘核燃料棒x20,000,反物质燃料棒x10,000)");
|
||||||
I18N.Add("Wind Turbines do global power coverage", "Wind Turbines do global power coverage", "风力涡轮机供电覆盖全球");
|
I18N.Add("Wind Turbines do global power coverage", "Wind Turbines do global power coverage", "风力涡轮机供电覆盖全球");
|
||||||
I18N.Add("Boost geothermal power", "Boost geothermal power(x50,000)", "提升地热发电(x50,000)");
|
I18N.Add("Boost geothermal power", "Boost geothermal power(x50,000)", "提升地热发电(x50,000)");
|
||||||
I18N.Add("Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "提升物流塔和大型采矿机的最大功耗");
|
I18N.Add("Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "Increase maximum power usage in Logistic Stations and Advanced Mining Machines",
|
||||||
|
"提升物流塔和大型采矿机的最大功耗");
|
||||||
I18N.Add("Retrieve/Place items from/to remote planets on logistics control panel", "Retrieve/Place items from/to remote planets on logistics control panel", "在物流总控面板上可以从非本地行星取放物品");
|
I18N.Add("Retrieve/Place items from/to remote planets on logistics control panel", "Retrieve/Place items from/to remote planets on logistics control panel", "在物流总控面板上可以从非本地行星取放物品");
|
||||||
I18N.Add("Infinite Natural Resources", "Infinite natural resources", "自然资源采集不消耗");
|
I18N.Add("Infinite Natural Resources", "Infinite natural resources", "自然资源采集不消耗");
|
||||||
I18N.Add("Fast Mining", "Fast mining", "高速采集");
|
I18N.Add("Fast Mining", "Fast mining", "高速采集");
|
||||||
I18N.Add("Pump Anywhere", "Pump anywhere", "平地抽水");
|
I18N.Add("Pump Anywhere", "Pump anywhere", "平地抽水");
|
||||||
I18N.Add("Skip bullet period", "Skip bullet period", "跳过子弹阶段");
|
I18N.Add("Skip bullet period", "Skip bullet period", "跳过子弹阶段");
|
||||||
|
I18N.Add("Fire all bullets at once", "Fire all bullets at once", "一次弹射所有太阳帆");
|
||||||
I18N.Add("Skip absorption period", "Skip absorption period", "跳过吸收阶段");
|
I18N.Add("Skip absorption period", "Skip absorption period", "跳过吸收阶段");
|
||||||
I18N.Add("Quick absorb", "Quick absorb", "快速吸收");
|
I18N.Add("Quick absorb", "Quick absorb", "快速吸收");
|
||||||
I18N.Add("Eject anyway", "Eject anyway", "全球弹射");
|
I18N.Add("Eject anyway", "Eject anyway", "全球弹射");
|
||||||
@@ -264,6 +266,8 @@ public static class UIConfigWindow
|
|||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period");
|
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period");
|
||||||
|
y += 26f;
|
||||||
|
wnd.AddCheckBox(x + 26f, y, tab4, DysonSpherePatch.FireAllBulletsEnabled, "Fire all bullets at once", 13);
|
||||||
y += 36f;
|
y += 36f;
|
||||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipAbsorbEnabled, "Skip absorption period");
|
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipAbsorbEnabled, "Skip absorption period");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
@@ -278,15 +282,15 @@ public static class UIConfigWindow
|
|||||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.UnlockMaxOrbitRadiusEnabled, "Unlock Dyson Sphere max orbit radius");
|
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.UnlockMaxOrbitRadiusEnabled, "Unlock Dyson Sphere max orbit radius");
|
||||||
y += 30f;
|
y += 30f;
|
||||||
{
|
{
|
||||||
var slider = wnd.AddSlider(x + 20f, y, tab4, DysonSpherePatch.UnlockMaxOrbitRadiusValue, new MaxOrbitRadiusValueMapper(), "##,#m").WithSmallerHandle(-40f);
|
var slider = wnd.AddSlider(x + 20, y, tab4, DysonSpherePatch.UnlockMaxOrbitRadiusValue, new MaxOrbitRadiusValueMapper(), "##,#m").WithSmallerHandle(-40f);
|
||||||
DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged += UnlockMaxOrbitRadiusChanged;
|
DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged += UnlockMaxOrbitRadiusChanged;
|
||||||
wnd.OnFree += () => { DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged -= UnlockMaxOrbitRadiusChanged; };
|
wnd.OnFree += () => { DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged -= UnlockMaxOrbitRadiusChanged; };
|
||||||
UnlockMaxOrbitRadiusChanged(null, null);
|
UnlockMaxOrbitRadiusChanged(null, null);
|
||||||
|
|
||||||
void UnlockMaxOrbitRadiusChanged(object o, EventArgs e)
|
void UnlockMaxOrbitRadiusChanged(object o, EventArgs e)
|
||||||
{
|
{
|
||||||
slider.slider.enabled = DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.Value;
|
slider.slider.enabled = DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.Value;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
}
|
}
|
||||||
x = 300f;
|
x = 300f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
@@ -329,6 +333,7 @@ public static class UIConfigWindow
|
|||||||
{
|
{
|
||||||
_resignGameBtn.gameObject.SetActive(resignEnabled);
|
_resignGameBtn.gameObject.SetActive(resignEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
var history = data.history;
|
var history = data.history;
|
||||||
if (history == null) return;
|
if (history == null) return;
|
||||||
var banEnabled = history.hasUsedPropertyBanAchievement;
|
var banEnabled = history.hasUsedPropertyBanAchievement;
|
||||||
|
|||||||
@@ -3,6 +3,11 @@
|
|||||||
|
|
||||||
## Changlog
|
## Changlog
|
||||||
|
|
||||||
|
* 1.3.6
|
||||||
|
+ `Dismantle blueprint selected buildings`:
|
||||||
|
- Fix a crash on dismantling preview buildings.
|
||||||
|
- Rename to `Shortcut keys for Blueprint Copy mode`, while adding a shortcut key to select all buildings (Ctrl+A by default).
|
||||||
|
+ `Allow overflow for Logistic Stations and Advanced Mining Machines`: Working for Logistics Control Panel now.
|
||||||
* 1.3.5
|
* 1.3.5
|
||||||
+ `Mod manager profile based save folder`: Fix crash on game startup
|
+ `Mod manager profile based save folder`: Fix crash on game startup
|
||||||
* 1.3.4
|
* 1.3.4
|
||||||
@@ -313,6 +318,11 @@
|
|||||||
|
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
|
* 1.3.6
|
||||||
|
+ `拆除蓝图选中的建筑`:
|
||||||
|
- 修复了拆除虚影建筑时崩溃的问题
|
||||||
|
- 重命名为`蓝图复制模式快捷键`,同时添加了选择所有建筑的快捷键(默认为Ctrl+A)
|
||||||
|
+ `允许物流站和大型采矿机物品溢出`:现在也适用于物流控制面板
|
||||||
* 1.3.5
|
* 1.3.5
|
||||||
+ `基于mod管理器配置档案的存档文件夹`:修复游戏启动时崩溃的问题
|
+ `基于mod管理器配置档案的存档文件夹`:修复游戏启动时崩溃的问题
|
||||||
* 1.3.4
|
* 1.3.4
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ public static class FactoryFunctions
|
|||||||
var entityPool = factory.entityPool;
|
var entityPool = factory.entityPool;
|
||||||
var stationPool = factory.transport.stationPool;
|
var stationPool = factory.transport.stationPool;
|
||||||
foreach (var objId in buildPreviewsToRemove)
|
foreach (var objId in buildPreviewsToRemove)
|
||||||
|
{
|
||||||
|
if (objId > 0)
|
||||||
{
|
{
|
||||||
int stationId = entityPool[objId].stationId;
|
int stationId = entityPool[objId].stationId;
|
||||||
if (stationId > 0)
|
if (stationId > 0)
|
||||||
@@ -100,6 +102,7 @@ public static class FactoryFunctions
|
|||||||
sc.storage = new StationStore[sc.storage.Length];
|
sc.storage = new StationStore[sc.storage.Length];
|
||||||
sc.needs = new int[sc.needs.Length];
|
sc.needs = new int[sc.needs.Length];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
build.DoDismantleObject(objId);
|
build.DoDismantleObject(objId);
|
||||||
}
|
}
|
||||||
blueprintCopyTool.ClearSelection();
|
blueprintCopyTool.ClearSelection();
|
||||||
@@ -108,4 +111,21 @@ public static class FactoryFunctions
|
|||||||
blueprintCopyTool.ResetBuildPreviews();
|
blueprintCopyTool.ResetBuildPreviews();
|
||||||
blueprintCopyTool.RefreshBlueprintData();
|
blueprintCopyTool.RefreshBlueprintData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SelectAllBuildingsInBlueprintCopy()
|
||||||
|
{
|
||||||
|
var localFactory = GameMain.localPlanet?.factory;
|
||||||
|
if (localFactory == null) return;
|
||||||
|
var blueprintCopyTool = GameMain.mainPlayer?.controller?.actionBuild?.blueprintCopyTool;
|
||||||
|
if (blueprintCopyTool == null || !blueprintCopyTool.active) return;
|
||||||
|
var entityPool = localFactory.entityPool;
|
||||||
|
foreach (var entity in entityPool)
|
||||||
|
{
|
||||||
|
if (entity.id == 0) continue;
|
||||||
|
blueprintCopyTool.preSelectObjIds.Add(entity.id);
|
||||||
|
blueprintCopyTool.selectedObjIds.Add(entity.id);
|
||||||
|
}
|
||||||
|
blueprintCopyTool.RefreshBlueprintData();
|
||||||
|
blueprintCopyTool.DeterminePreviews();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,12 +41,13 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
|||||||
public static ConfigEntry<int> LabBufferExtraCountForAdvancedAssemble;
|
public static ConfigEntry<int> LabBufferExtraCountForAdvancedAssemble;
|
||||||
public static ConfigEntry<int> LabBufferMaxCountForResearch;
|
public static ConfigEntry<int> LabBufferMaxCountForResearch;
|
||||||
public static ConfigEntry<int> ReceiverBufferCount;
|
public static ConfigEntry<int> ReceiverBufferCount;
|
||||||
public static ConfigEntry<bool> DismantleBlueprintSelectionEnabled;
|
public static ConfigEntry<bool> ShortcutKeysForBlueprintCopyEnabled;
|
||||||
|
|
||||||
private static PressKeyBind _doNotRenderEntitiesKey;
|
private static PressKeyBind _doNotRenderEntitiesKey;
|
||||||
private static PressKeyBind _offgridfForPathsKey;
|
private static PressKeyBind _offgridfForPathsKey;
|
||||||
private static PressKeyBind _cutConveyorBeltKey;
|
private static PressKeyBind _cutConveyorBeltKey;
|
||||||
private static PressKeyBind _dismantleBlueprintSelectionKey;
|
private static PressKeyBind _dismantleBlueprintSelectionKey;
|
||||||
|
private static PressKeyBind _selectAllBuildingsInBlueprintCopyKey;
|
||||||
|
|
||||||
private static int _tankFastFillInAndTakeOutMultiplierRealValue = 2;
|
private static int _tankFastFillInAndTakeOutMultiplierRealValue = 2;
|
||||||
|
|
||||||
@@ -88,6 +89,15 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
I18N.Add("KEYDismantleBlueprintSelection", "[UXA] Dismantle blueprint selected buildings", "[UXA] 拆除蓝图选中的建筑");
|
I18N.Add("KEYDismantleBlueprintSelection", "[UXA] Dismantle blueprint selected buildings", "[UXA] 拆除蓝图选中的建筑");
|
||||||
|
_selectAllBuildingsInBlueprintCopyKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||||
|
{
|
||||||
|
key = new CombineKey((int)KeyCode.A, CombineKey.CTRL_COMB, ECombineKeyAction.OnceClick, false),
|
||||||
|
conflictGroup = KeyBindConflict.KEYBOARD_KEYBIND,
|
||||||
|
name = "SelectAllBuildingsInBlueprintCopy",
|
||||||
|
canOverride = true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
I18N.Add("KEYSelectAllBuildingsInBlueprintCopy", "[UXA] Select all buildings in Blueprint Copy Mode", "[UXA] 蓝图复制时选择所有建筑");
|
||||||
|
|
||||||
BeltSignalsForBuyOut.InitPersist();
|
BeltSignalsForBuyOut.InitPersist();
|
||||||
ProtectVeinsFromExhaustion.InitConfig();
|
ProtectVeinsFromExhaustion.InitConfig();
|
||||||
@@ -182,8 +192,13 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
|||||||
Functions.FactoryFunctions.CutConveyorBelt(cargoTraffic, beltId);
|
Functions.FactoryFunctions.CutConveyorBelt(cargoTraffic, beltId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DismantleBlueprintSelectionEnabled.Value && _dismantleBlueprintSelectionKey.keyValue)
|
if (ShortcutKeysForBlueprintCopyEnabled.Value)
|
||||||
|
{
|
||||||
|
if (_dismantleBlueprintSelectionKey.keyValue)
|
||||||
Functions.FactoryFunctions.DismantleBlueprintSelectedBuildings();
|
Functions.FactoryFunctions.DismantleBlueprintSelectedBuildings();
|
||||||
|
if (_selectAllBuildingsInBlueprintCopyKey.keyValue)
|
||||||
|
Functions.FactoryFunctions.SelectAllBuildingsInBlueprintCopy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Export(BinaryWriter w)
|
public static void Export(BinaryWriter w)
|
||||||
|
|||||||
@@ -466,10 +466,11 @@ public static class LogisticsPatch
|
|||||||
|
|
||||||
private class AllowOverflowInLogistics : PatchImpl<AllowOverflowInLogistics>
|
private class AllowOverflowInLogistics : PatchImpl<AllowOverflowInLogistics>
|
||||||
{
|
{
|
||||||
private static bool _bludprintPasting;
|
private static bool _blueprintPasting;
|
||||||
|
|
||||||
// Do not check for overflow when try to send hand items into storages
|
// Do not check for overflow when try to send hand items into storages
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
|
[HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.OnItemIconMouseDown))]
|
||||||
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnItemIconMouseDown))]
|
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnItemIconMouseDown))]
|
||||||
private static IEnumerable<CodeInstruction> UIStationStorage_OnItemIconMouseDown_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
private static IEnumerable<CodeInstruction> UIStationStorage_OnItemIconMouseDown_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
{
|
{
|
||||||
@@ -516,7 +517,7 @@ public static class LogisticsPatch
|
|||||||
var oldLabels = matcher.Labels;
|
var oldLabels = matcher.Labels;
|
||||||
matcher.Labels = [];
|
matcher.Labels = [];
|
||||||
matcher.InsertAndAdvance(
|
matcher.InsertAndAdvance(
|
||||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(AllowOverflowInLogistics), nameof(_bludprintPasting))).WithLabels(oldLabels),
|
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(AllowOverflowInLogistics), nameof(_blueprintPasting))).WithLabels(oldLabels),
|
||||||
new CodeInstruction(OpCodes.Brfalse, label)
|
new CodeInstruction(OpCodes.Brfalse, label)
|
||||||
);
|
);
|
||||||
matcher.Advance(9).Labels.Add(label);
|
matcher.Advance(9).Labels.Add(label);
|
||||||
@@ -527,14 +528,14 @@ public static class LogisticsPatch
|
|||||||
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CreatePrebuilds))]
|
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CreatePrebuilds))]
|
||||||
private static void BuildTool_BlueprintPaste_CreatePrebuilds_Prefix()
|
private static void BuildTool_BlueprintPaste_CreatePrebuilds_Prefix()
|
||||||
{
|
{
|
||||||
_bludprintPasting = true;
|
_blueprintPasting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CreatePrebuilds))]
|
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CreatePrebuilds))]
|
||||||
private static void BuildTool_BlueprintPaste_CreatePrebuilds_Postfix()
|
private static void BuildTool_BlueprintPaste_CreatePrebuilds_Postfix()
|
||||||
{
|
{
|
||||||
_bludprintPasting = false;
|
_blueprintPasting = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,8 @@ public static class UIConfigWindow
|
|||||||
I18N.Add("Extra buffer count for Self-evolution Labs", "Extra buffer count for Self-evolution Labs", "自演化研究站矩阵额外缓冲数量");
|
I18N.Add("Extra buffer count for Self-evolution Labs", "Extra buffer count for Self-evolution Labs", "自演化研究站矩阵额外缓冲数量");
|
||||||
I18N.Add("Buffer count for researching in labs", "Buffer count for researching in labs", "研究站科研模式缓存数量");
|
I18N.Add("Buffer count for researching in labs", "Buffer count for researching in labs", "研究站科研模式缓存数量");
|
||||||
I18N.Add("Ray Receiver Graviton Lens buffer count", "Ray Receiver Graviton Lens buffer count", "射线接收器透镜缓冲数量");
|
I18N.Add("Ray Receiver Graviton Lens buffer count", "Ray Receiver Graviton Lens buffer count", "射线接收器透镜缓冲数量");
|
||||||
I18N.Add("Dismantle blueprint selected buildings", "Dismantle blueprint selected buildings", "拆除蓝图选中的建筑");
|
I18N.Add("Shortcut keys for Blueprint Copy mode", "Shortcut keys for Blueprint Copy mode", "蓝图复制模式快捷键");
|
||||||
|
I18N.Add("Shortcut keys for Blueprint Copy mode tips", "You can set 2 shortcut keys in Settings panel:\n 1. Select all buildings\n 2. Dismantle selected buildings", "你可以在设置面板中设置2个快捷键:\n 1. 选择所有建筑\n 2. 拆除选中的建筑");
|
||||||
I18N.Add("Shortcut keys for showing stars' name", "Shortcut keys for showing stars' name", "启用显示所有星系名称的快捷键");
|
I18N.Add("Shortcut keys for showing stars' name", "Shortcut keys for showing stars' name", "启用显示所有星系名称的快捷键");
|
||||||
I18N.Add("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航");
|
I18N.Add("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航");
|
||||||
I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航");
|
I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航");
|
||||||
@@ -406,7 +407,8 @@ public static class UIConfigWindow
|
|||||||
y += 36f;
|
y += 36f;
|
||||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.DoNotRenderEntitiesEnabled, "Do not render factory entities");
|
wnd.AddCheckBox(x, y, tab2, FactoryPatch.DoNotRenderEntitiesEnabled, "Do not render factory entities");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.DismantleBlueprintSelectionEnabled, "Dismantle blueprint selected buildings");
|
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryPatch.ShortcutKeysForBlueprintCopyEnabled, "Shortcut keys for Blueprint Copy mode");
|
||||||
|
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab2, "Shortcut keys for Blueprint Copy mode", "Shortcut keys for Blueprint Copy mode tips", "shortcut-keys-for-blueprint-copy-mode-tips");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalsForBuyOutEnabled, "Belt signals for buy out dark fog items automatically");
|
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalsForBuyOutEnabled, "Belt signals for buy out dark fog items automatically");
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
|||||||
FactoryPatch.LabBufferExtraCountForAdvancedAssemble = Config.Bind("Factory", "LabBufferExtraCountForAdvancedAssemble", 3, new ConfigDescription("Extra buffer count for Self-evolution Labs", new AcceptableValueRange<int>(1, 10)));
|
FactoryPatch.LabBufferExtraCountForAdvancedAssemble = Config.Bind("Factory", "LabBufferExtraCountForAdvancedAssemble", 3, new ConfigDescription("Extra buffer count for Self-evolution Labs", new AcceptableValueRange<int>(1, 10)));
|
||||||
FactoryPatch.LabBufferMaxCountForResearch = Config.Bind("Factory", "LabBufferMaxCountForResearch", 10, new ConfigDescription("Buffer count for researching in labs", new AcceptableValueRange<int>(2, 20)));
|
FactoryPatch.LabBufferMaxCountForResearch = Config.Bind("Factory", "LabBufferMaxCountForResearch", 10, new ConfigDescription("Buffer count for researching in labs", new AcceptableValueRange<int>(2, 20)));
|
||||||
FactoryPatch.ReceiverBufferCount = Config.Bind("Factory", "ReceiverBufferCount", 1, new ConfigDescription("Ray Receiver Graviton Lens buffer count", new AcceptableValueRange<int>(1, 20)));
|
FactoryPatch.ReceiverBufferCount = Config.Bind("Factory", "ReceiverBufferCount", 1, new ConfigDescription("Ray Receiver Graviton Lens buffer count", new AcceptableValueRange<int>(1, 20)));
|
||||||
FactoryPatch.DismantleBlueprintSelectionEnabled = Config.Bind("Factory", "DismantleBlueprintSelection", false,
|
FactoryPatch.ShortcutKeysForBlueprintCopyEnabled = Config.Bind("Factory", "DismantleBlueprintSelection", false,
|
||||||
"Dismantle blueprint selected buildings");
|
"Dismantle blueprint selected buildings");
|
||||||
LogisticsPatch.AutoConfigLogisticsEnabled = Config.Bind("Factory", "AutoConfigLogistics", false,
|
LogisticsPatch.AutoConfigLogisticsEnabled = Config.Bind("Factory", "AutoConfigLogistics", false,
|
||||||
"Auto-config logistic stations");
|
"Auto-config logistic stations");
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net472</TargetFramework>
|
<TargetFramework>net472</TargetFramework>
|
||||||
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
||||||
<Description>DSP MOD - UXAssist</Description>
|
<Description>DSP MOD - UXAssist</Description>
|
||||||
<Version>1.3.5</Version>
|
<Version>1.3.6</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<PackageId>UXAssist</PackageId>
|
<PackageId>UXAssist</PackageId>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "UXAssist",
|
"name": "UXAssist",
|
||||||
"version_number": "1.3.5",
|
"version_number": "1.3.6",
|
||||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
||||||
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|||||||
Reference in New Issue
Block a user