1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-10 10:43:27 +08:00

add LogisticMiner (idea from PlanetMiner)

This commit is contained in:
2022-08-22 21:53:53 +08:00
parent 16dcf732b3
commit 4a88a6a8bf
5 changed files with 292 additions and 32 deletions

View File

@@ -1,44 +1,41 @@
using BepInEx;
using HarmonyLib;
namespace DevShortcuts
namespace DevShortcuts;
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
public class DevShortcuts : BaseUnityPlugin
{
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
public class DevShortcuts : BaseUnityPlugin
private void Awake()
{
private void Awake()
{
// Plugin startup logic
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
}
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
}
private void Start()
{
Harmony.CreateAndPatchAll(typeof(DevShortcuts));
}
private void Start()
{
Harmony.CreateAndPatchAll(typeof(DevShortcuts));
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerController), "Init")]
static void PlayerControllerInit(ref PlayerAction[] ___actions, Player ___player)
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerController), "Init")]
static void PlayerControllerInit(ref PlayerAction[] ___actions, Player ___player)
{
var cnt = ___actions.Length;
var newActions = new PlayerAction[cnt + 1];
for (int i = 0; i < cnt; i++)
{
var cnt = ___actions.Length;
var newActions = new PlayerAction[cnt + 1];
for (int i = 0; i < cnt; i++)
{
newActions[i] = ___actions[i];
}
var test = new PlayerAction_Test();
test.Init(___player);
newActions[cnt] = test;
___actions = null;
___actions = newActions;
newActions[i] = ___actions[i];
}
var test = new PlayerAction_Test();
test.Init(___player);
newActions[cnt] = test;
___actions = newActions;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerAction_Test), "GameTick")]
static void PlayerAction_TestGameTick(PlayerAction_Test __instance, long timei)
{
__instance.Update();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerAction_Test), "GameTick")]
static void PlayerAction_TestGameTick(PlayerAction_Test __instance, long timei)
{
__instance.Update();
}
}