mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 04:53:30 +08:00
Work in progress
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
|
||||
<Description>DSP MOD - CheatEnabler</Description>
|
||||
<Version>2.3.5</Version>
|
||||
<Version>2.3.6</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>CheatEnabler</PackageId>
|
||||
|
||||
@@ -181,6 +181,17 @@ public static class FactoryPatch
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UXAssist.PlanetFunctions), nameof(UXAssist.PlanetFunctions.BuildOrbitalCollectors))]
|
||||
private static void UXAssist_PlanetFunctions_BuildOrbitalCollectors_Postfix()
|
||||
{
|
||||
var factory = GameMain.mainPlayer?.factory;
|
||||
if (factory != null)
|
||||
{
|
||||
ArrivePlanet(factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class ArchitectMode
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#### 添加一些作弊功能,同时屏蔽异常检测
|
||||
|
||||
## Changlog
|
||||
* 2.3.6
|
||||
+ Fix a issue in `Finish build immediately` that some buildings are not finished immediately.
|
||||
* 2.3.5
|
||||
+ Fix another crash in `Skip bullet period`.
|
||||
* 2.3.4
|
||||
@@ -108,6 +110,8 @@
|
||||
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions
|
||||
|
||||
## 更新日志
|
||||
* 2.3.6
|
||||
+ 修复了`建造秒完成`可能导致部分建筑无法立即完成的问题
|
||||
* 2.3.5
|
||||
+ 修复了`跳过子弹阶段`可能导致崩溃的问题
|
||||
* 2.3.4
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "CheatEnabler",
|
||||
"version_number": "2.3.5",
|
||||
"version_number": "2.3.6",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
|
||||
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
||||
"dependencies": [
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
using System.Threading;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using BepInEx.Configuration;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UXAssist;
|
||||
|
||||
public static class PlanetFunctions
|
||||
{
|
||||
public static ConfigEntry<int> OrbitalCollectorMaxBuildCount;
|
||||
private const int OrbitalCollectorItemId = 2105;
|
||||
public static void DismantleAll(bool toBag)
|
||||
{
|
||||
var player = GameMain.mainPlayer;
|
||||
@@ -141,5 +146,113 @@ public static class PlanetFunctions
|
||||
Thread.Sleep(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void BuildOrbitalCollectors()
|
||||
{
|
||||
var player = GameMain.mainPlayer;
|
||||
if (player == null) return;
|
||||
var planet = GameMain.localPlanet;
|
||||
if (planet is not { type: EPlanetType.Gas }) return;
|
||||
var countToBuild = OrbitalCollectorMaxBuildCount.Value;
|
||||
if (countToBuild == 0) countToBuild = -1;
|
||||
|
||||
var factory = planet.factory;
|
||||
var stationPool = factory.transport.stationPool;
|
||||
var stationCursor = factory.transport.stationCursor;
|
||||
var entityPool = factory.entityPool;
|
||||
var pos = new Vector3(0f, 0f, planet.realRadius * 1.025f + 0.2f);
|
||||
var found = false;
|
||||
for (var i = 1; i < stationCursor; i++)
|
||||
{
|
||||
if (stationPool[i] == null || stationPool[i].id != i) continue;
|
||||
ref var entity = ref entityPool[stationPool[i].entityId];
|
||||
pos = entity.pos;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
var prebuildCursor = factory.prebuildCursor;
|
||||
var prebuildPool = factory.prebuildPool;
|
||||
if (!found)
|
||||
{
|
||||
for (var i = 1; i < prebuildCursor; i++)
|
||||
{
|
||||
if (prebuildPool[i].id != i) continue;
|
||||
pos = prebuildPool[i].pos;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var testPos = pos;
|
||||
var cellCount = PlanetGrid.DetermineLongitudeSegmentCount(0, factory.planet.aux.mainGrid.segment) * 5;
|
||||
var cellRad = Math.PI / cellCount;
|
||||
var distRadCount = 1;
|
||||
for (var i = 1; i <= cellCount; i++)
|
||||
{
|
||||
testPos = Maths.RotateLF(0.0, 1.0, 0.0, cellRad, testPos);
|
||||
if ((testPos - pos).sqrMagnitude < 14297f) continue;
|
||||
distRadCount = i;
|
||||
break;
|
||||
}
|
||||
for (var i = 0; i < cellCount && countToBuild != 0;)
|
||||
{
|
||||
/* Check for collision */
|
||||
var collide = false;
|
||||
for (var j = 1; j < stationCursor; j++)
|
||||
{
|
||||
if (stationPool[j] == null || stationPool[j].id != j) continue;
|
||||
if ((entityPool[stationPool[j].entityId].pos - pos).sqrMagnitude >= 14297f) continue;
|
||||
collide = true;
|
||||
break;
|
||||
}
|
||||
for (var j = 1; j < prebuildCursor; j++)
|
||||
{
|
||||
if (prebuildPool[j].id != j) continue;
|
||||
if ((prebuildPool[j].pos - pos).sqrMagnitude >= 14297f) continue;
|
||||
collide = true;
|
||||
break;
|
||||
}
|
||||
if (collide)
|
||||
{
|
||||
/* rotate for a small cell on sphere */
|
||||
pos = Maths.RotateLF(0.0, 1.0, 0.0, cellRad, pos);
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player.inhandItemId == OrbitalCollectorItemId && player.inhandItemCount > 0)
|
||||
{
|
||||
player.UseHandItems(1, out var _);
|
||||
}
|
||||
else
|
||||
{
|
||||
var count = 1;
|
||||
var itemId = OrbitalCollectorItemId;
|
||||
player.package.TakeTailItems(ref itemId, ref count, out var _);
|
||||
if (count == 0) break;
|
||||
}
|
||||
|
||||
var rot = Maths.SphericalRotation(pos, 0f);
|
||||
var prebuild = new PrebuildData
|
||||
{
|
||||
protoId = 2105,
|
||||
modelIndex = 117,
|
||||
pos = pos,
|
||||
pos2 = pos,
|
||||
rot = rot,
|
||||
rot2 = rot,
|
||||
pickOffset = 0,
|
||||
insertOffset = 0,
|
||||
recipeId = 0,
|
||||
filterId = 0,
|
||||
paramCount = 0
|
||||
};
|
||||
factory.AddPrebuildDataWithComponents(prebuild);
|
||||
prebuildCursor = factory.prebuildCursor;
|
||||
if (countToBuild > 0) countToBuild--;
|
||||
/* rotate for minimal distance for next OC on sphere */
|
||||
pos = Maths.RotateLF(0.0, 1.0, 0.0, cellRad * distRadCount, pos);
|
||||
i += distRadCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
## Changlog
|
||||
* 1.0.3
|
||||
+ Add new function: `Quick build Orbital Collectors`.
|
||||
+ Add confirmation popup for `Re-intialize planet`, `Quick dismantle all buildings`, `Re-initialize Dyson Spheres` and `Quick dismantle Dyson Shells`.
|
||||
+ Fix error on `Remove build count and range limit` when building a large amount of belts.
|
||||
+ Fix an issue that windows position not saved correctly when quit game without using in-game menu.
|
||||
@@ -43,6 +44,7 @@
|
||||
- Enhanced count control for hand-make
|
||||
- Re-intialize planet (without reseting veins)
|
||||
- Quick dismantle all buildings (without drops)
|
||||
- Quick build Orbital Collectors
|
||||
+ Dyson Sphere
|
||||
- Stop ejectors when available nodes are all filled up
|
||||
- Construct only nodes but frames
|
||||
@@ -61,6 +63,7 @@
|
||||
|
||||
## 更新日志
|
||||
* 1.0.3
|
||||
+ 添加了新功能:`快速建造轨道采集器`
|
||||
+ 为`初始化行星`,`快速拆除所有建筑`,`初始化戴森球`和`快速拆除戴森壳`添加了确认弹窗
|
||||
+ 修复了`移除建造数量和范围限制`在建造大量传送带时可能导致的错误
|
||||
+ 修复了在不使用游戏内菜单退出游戏时窗口位置无法正确保存的问题
|
||||
@@ -99,6 +102,7 @@
|
||||
- 手动制造物品的数量控制改进
|
||||
- 初始化本行星(不重置矿脉)
|
||||
- 快速拆除所有建筑(不掉落)
|
||||
- 快速建造轨道采集器
|
||||
+ 戴森球
|
||||
- 可用节点全部造完时停止弹射
|
||||
- 只建造节点不建造框架
|
||||
|
||||
@@ -80,14 +80,19 @@ public class MyWindow: ManualBehaviour
|
||||
btn.UpdateTip();
|
||||
return btn;
|
||||
}
|
||||
|
||||
|
||||
public UIButton AddButton(float x, float y, RectTransform parent, string text = "", int fontSize = 16, string objName = "button", UnityAction onClick = null)
|
||||
{
|
||||
return AddButton(x, y, 150f, parent, text, fontSize, objName, onClick);
|
||||
}
|
||||
|
||||
public UIButton AddButton(float x, float y, float width, RectTransform parent, string text = "", int fontSize = 16, string objName = "button", UnityAction onClick = null)
|
||||
{
|
||||
var panel = UIRoot.instance.uiGame.statWindow.performancePanelUI;
|
||||
var btn = Instantiate(panel.cpuActiveButton);
|
||||
btn.gameObject.name = objName;
|
||||
var rect = Util.NormalizeRectWithTopLeft(btn, x, y, parent);
|
||||
rect.sizeDelta = new Vector2(150, rect.sizeDelta.y);
|
||||
rect.sizeDelta = new Vector2(width, rect.sizeDelta.y);
|
||||
var l = btn.gameObject.transform.Find("button-text").GetComponent<Localizer>();
|
||||
var t = btn.gameObject.transform.Find("button-text").GetComponent<Text>();
|
||||
if (l != null)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UXAssist.UI;
|
||||
using UXAssist.Common;
|
||||
|
||||
@@ -31,6 +32,9 @@ public static class UIConfigWindow
|
||||
I18N.Add("Initialize This Planet Confirm", "This operation will destroy all buildings and revert terrains on this planet, are you sure?", "此操作将会摧毁本行星上的所有建筑并恢复地形,确定吗?");
|
||||
I18N.Add("Dismantle All Buildings", "Dismantle all buildings", "拆除所有建筑");
|
||||
I18N.Add("Dismantle All Buildings Confirm", "This operation will dismantle all buildings on this planet, are you sure?", "此操作将会拆除本行星上的所有建筑,确定吗?");
|
||||
I18N.Add("Quick build Orbital Collectors", "Quick build Orbital Collectors", "快速建造轨道采集器");
|
||||
I18N.Add("Maximum count to build", "Maximum count to build", "最大建造数量");
|
||||
I18N.Add("max", "max", "最大");
|
||||
I18N.Add("Stop ejectors when available nodes are all filled up", "Stop ejectors when available nodes are all filled up", "可用节点全部造完时停止弹射");
|
||||
I18N.Add("Construct only nodes but frames", "Construct only nodes but frames", "只造节点不造框架");
|
||||
I18N.Add("Initialize Dyson Sphere", "Initialize Dyson Sphere", "初始化戴森球");
|
||||
@@ -93,6 +97,26 @@ public static class UIConfigWindow
|
||||
}))
|
||||
);
|
||||
|
||||
y += 72f;
|
||||
wnd.AddButton(x, y, 200, tab2, "Quick build Orbital Collectors", 16, "button-init-planet", PlanetFunctions.BuildOrbitalCollectors);
|
||||
x += 10f;
|
||||
y += 30f;
|
||||
MyWindow.AddText(x, y, tab2, "Maximum count to build", 16, "text-oc-build-count");
|
||||
y += 26f;
|
||||
var sl0 = MySlider.CreateSlider(x, y, tab2, PlanetFunctions.OrbitalCollectorMaxBuildCount.Value, 0f, 40f, "G", 200f);
|
||||
if (PlanetFunctions.OrbitalCollectorMaxBuildCount.Value == 0)
|
||||
{
|
||||
sl0.SetLabelText("max".Translate());
|
||||
}
|
||||
sl0.OnValueChanged += () =>
|
||||
{
|
||||
PlanetFunctions.OrbitalCollectorMaxBuildCount.Value = Mathf.RoundToInt(sl0.Value);
|
||||
if (PlanetFunctions.OrbitalCollectorMaxBuildCount.Value == 0)
|
||||
{
|
||||
sl0.SetLabelText("max".Translate());
|
||||
}
|
||||
};
|
||||
|
||||
var tab3 = wnd.AddTab(trans, "Dyson Sphere");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
|
||||
@@ -45,6 +45,7 @@ public class UXAssist : BaseUnityPlugin
|
||||
"Increase maximum area size for upgrade and dismantle to 31x31 (from 11x11)");
|
||||
FactoryPatch.LargerAreaForTerraformEnabled = Config.Bind("Factory", "LargerAreaForTerraform", false,
|
||||
"Increase maximum area size for terraform to 30x30 (from 10x10)\nNote: this may impact game performance while using large area");
|
||||
PlanetFunctions.OrbitalCollectorMaxBuildCount = Config.Bind("Factory", "OCMaxBuildCount", 0, "Maximum Orbital Collectors to build once, set to 0 to build as many as possible");
|
||||
PlayerPatch.EnhancedMechaForgeCountControlEnabled = Config.Bind("Player", "EnhancedMechaForgeCountControl", false,
|
||||
"Enhanced count control for hand-make, increases maximum of count to 1000, and you can hold Ctrl/Shift/Alt to change the count rapidly");
|
||||
DysonSpherePatch.StopEjectOnNodeCompleteEnabled = Config.Bind("DysonSphere", "StopEjectOnNodeComplete", false,
|
||||
|
||||
Reference in New Issue
Block a user