mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 04:53:30 +08:00
bug fixes, with TODO added
This commit is contained in:
@@ -49,9 +49,9 @@ public static class PlanetPatch
|
|||||||
{
|
{
|
||||||
var matcher = new CodeMatcher(instructions, generator);
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
matcher.MatchForward(false,
|
matcher.MatchForward(false,
|
||||||
new CodeMatch(instr => instr.opcode == OpCodes.Ldc_I4_S && instr.OperandIs(22))
|
new CodeMatch(instr => instr.opcode == OpCodes.Ldc_I4_S && instr.OperandIs(23))
|
||||||
).Advance(1).MatchForward(false,
|
).Advance(1).MatchForward(false,
|
||||||
new CodeMatch(instr => instr.opcode == OpCodes.Ldc_I4_S && instr.OperandIs(22))
|
new CodeMatch(instr => instr.opcode == OpCodes.Ldc_I4_S && instr.OperandIs(23))
|
||||||
);
|
);
|
||||||
matcher.Repeat(codeMatcher =>
|
matcher.Repeat(codeMatcher =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class HideTips : BaseUnityPlugin
|
|||||||
private static bool _noResearchCompletionPopups = true;
|
private static bool _noResearchCompletionPopups = true;
|
||||||
private static bool _noResearchCompletionTips;
|
private static bool _noResearchCompletionTips;
|
||||||
private static bool _skipPrologue = true;
|
private static bool _skipPrologue = true;
|
||||||
private static bool _hideMenuDemo;
|
// private static bool _hideMenuDemo;
|
||||||
|
|
||||||
private static Harmony _patch;
|
private static Harmony _patch;
|
||||||
|
|
||||||
@@ -34,13 +34,15 @@ public class HideTips : BaseUnityPlugin
|
|||||||
_noResearchCompletionPopups = Config.Bind("General", "NoResearchCompletionPopups", _noResearchCompletionPopups, "Disable Research Completion Popup Windows").Value;
|
_noResearchCompletionPopups = Config.Bind("General", "NoResearchCompletionPopups", _noResearchCompletionPopups, "Disable Research Completion Popup Windows").Value;
|
||||||
_noResearchCompletionTips = Config.Bind("General", "NoResearchCompletionTips", _noResearchCompletionTips, "Disable Research Completion Tips").Value;
|
_noResearchCompletionTips = Config.Bind("General", "NoResearchCompletionTips", _noResearchCompletionTips, "Disable Research Completion Tips").Value;
|
||||||
_skipPrologue = Config.Bind("General", "SkipPrologue", _skipPrologue, "Skip prologue for new game").Value;
|
_skipPrologue = Config.Bind("General", "SkipPrologue", _skipPrologue, "Skip prologue for new game").Value;
|
||||||
_hideMenuDemo = Config.Bind("General", "HideMenuDemo", _hideMenuDemo, "Disable title screen demo scene loading").Value;
|
// _hideMenuDemo = Config.Bind("General", "HideMenuDemo", _hideMenuDemo, "Disable title screen demo scene loading").Value;
|
||||||
if (!_cfgEnabled) return;
|
if (!_cfgEnabled) return;
|
||||||
Harmony.CreateAndPatchAll(typeof(HideTips));
|
Harmony.CreateAndPatchAll(typeof(HideTips));
|
||||||
|
/*
|
||||||
if (_hideMenuDemo)
|
if (_hideMenuDemo)
|
||||||
{
|
{
|
||||||
_patch = Harmony.CreateAndPatchAll(typeof(HideMenuDemo));
|
_patch = Harmony.CreateAndPatchAll(typeof(HideMenuDemo));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
@@ -141,6 +143,7 @@ public class HideTips : BaseUnityPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
[HarmonyPatch]
|
[HarmonyPatch]
|
||||||
class HideMenuDemo
|
class HideMenuDemo
|
||||||
{
|
{
|
||||||
@@ -209,3 +212,4 @@ class HideMenuDemo
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ public static class MechaDronesTweaks
|
|||||||
public static float EnergyMultiplier = 0.1f;
|
public static float EnergyMultiplier = 0.1f;
|
||||||
|
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
[HarmonyPatch(typeof(ConstructionModuleComponent), nameof(ConstructionModuleComponent.SearchForNewTargets))]
|
|
||||||
[HarmonyPatch(typeof(ConstructionSystem), nameof(ConstructionSystem.UpdateDrones))]
|
[HarmonyPatch(typeof(ConstructionSystem), nameof(ConstructionSystem.UpdateDrones))]
|
||||||
[HarmonyPatch(typeof(UIMechaWindow), nameof(UIMechaWindow.UpdateProps))]
|
[HarmonyPatch(typeof(UIMechaWindow), nameof(UIMechaWindow.UpdateProps))]
|
||||||
[HarmonyPatch(typeof(UITechTree), nameof(UITechTree.RefreshDataValueText))]
|
[HarmonyPatch(typeof(UITechTree), nameof(UITechTree.RefreshDataValueText))]
|
||||||
|
|||||||
@@ -347,18 +347,18 @@ public static class FactoryPatch
|
|||||||
* ldloc.s V_88 (88)
|
* ldloc.s V_88 (88)
|
||||||
* ldloc.s V_120 (120)
|
* ldloc.s V_120 (120)
|
||||||
* brtrue.s 2054 (173A) ldc.i4.s 17
|
* brtrue.s 2054 (173A) ldc.i4.s 17
|
||||||
* ldc.i4.s 18
|
* ldc.i4.s EBuildCondition.JointCannotLift (19)
|
||||||
* br.s 2055 (173C) stfld valuetype EBuildCondition BuildPreview::condition
|
* br.s 2055 (173C) stfld valuetype EBuildCondition BuildPreview::condition
|
||||||
* ldc.i4.s 17
|
* ldc.i4.s EBuildCondition.EBuildCondition.JointCannotLift (19) (18)
|
||||||
* stfld valuetype EBuildCondition BuildPreview::condition
|
* stfld valuetype EBuildCondition BuildPreview::condition
|
||||||
*/
|
*/
|
||||||
matcher.MatchForward(false,
|
matcher.MatchForward(false,
|
||||||
new CodeMatch(OpCodes.Ldloc_S),
|
new CodeMatch(OpCodes.Ldloc_S),
|
||||||
new CodeMatch(OpCodes.Ldloc_S),
|
new CodeMatch(OpCodes.Ldloc_S),
|
||||||
new CodeMatch(instr => instr.opcode == OpCodes.Brtrue_S || instr.opcode == OpCodes.Brtrue),
|
new CodeMatch(instr => instr.opcode == OpCodes.Brtrue_S || instr.opcode == OpCodes.Brtrue),
|
||||||
new CodeMatch(instr => instr.opcode == OpCodes.Ldc_I4_S && instr.OperandIs(18)),
|
new CodeMatch(instr => instr.opcode == OpCodes.Ldc_I4_S && instr.OperandIs(19)),
|
||||||
new CodeMatch(instr => instr.opcode == OpCodes.Br_S || instr.opcode == OpCodes.Br),
|
new CodeMatch(instr => instr.opcode == OpCodes.Br_S || instr.opcode == OpCodes.Br),
|
||||||
new CodeMatch(instr => instr.opcode == OpCodes.Ldc_I4_S && instr.OperandIs(17)),
|
new CodeMatch(instr => instr.opcode == OpCodes.Ldc_I4_S && instr.OperandIs(18)),
|
||||||
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(BuildPreview), nameof(BuildPreview.condition)))
|
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(BuildPreview), nameof(BuildPreview.condition)))
|
||||||
);
|
);
|
||||||
if (matcher.IsValid)
|
if (matcher.IsValid)
|
||||||
@@ -375,12 +375,12 @@ public static class FactoryPatch
|
|||||||
|
|
||||||
/* search for:
|
/* search for:
|
||||||
* ldloc.s V_88 (88)
|
* ldloc.s V_88 (88)
|
||||||
* ldc.i4.s 15-19
|
* ldc.i4.s EBuildCondition.TooSteep(16)-EBuildCondition.InputConflict(20)
|
||||||
* stfld valuetype EBuildCondition BuildPreview::condition
|
* stfld valuetype EBuildCondition BuildPreview::condition
|
||||||
*/
|
*/
|
||||||
matcher.Start().MatchForward(false,
|
matcher.Start().MatchForward(false,
|
||||||
new CodeMatch(instr => instr.opcode == OpCodes.Ldloc_S || instr.opcode == OpCodes.Ldloc),
|
new CodeMatch(instr => instr.opcode == OpCodes.Ldloc_S || instr.opcode == OpCodes.Ldloc),
|
||||||
new CodeMatch(instr => (instr.opcode == OpCodes.Ldc_I4_S || instr.opcode == OpCodes.Ldc_I4) && Convert.ToInt64(instr.operand) is >= 15 and <= 19),
|
new CodeMatch(instr => (instr.opcode == OpCodes.Ldc_I4_S || instr.opcode == OpCodes.Ldc_I4) && Convert.ToInt64(instr.operand) is >= 16 and <= 20),
|
||||||
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(BuildPreview), nameof(BuildPreview.condition)))
|
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(BuildPreview), nameof(BuildPreview.condition)))
|
||||||
);
|
);
|
||||||
if (matcher.IsValid)
|
if (matcher.IsValid)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public static class PlanetFunctions
|
|||||||
//planet.data.CalcVerts();
|
//planet.data.CalcVerts();
|
||||||
for (var id = factory.entityCursor - 1; id > 0; id--)
|
for (var id = factory.entityCursor - 1; id > 0; id--)
|
||||||
{
|
{
|
||||||
var ed = factory.entityPool[id];
|
ref var ed = ref factory.entityPool[id];
|
||||||
if (ed.id != id) continue;
|
if (ed.id != id) continue;
|
||||||
if (ed.colliderId != 0)
|
if (ed.colliderId != 0)
|
||||||
{
|
{
|
||||||
@@ -77,6 +77,21 @@ public static class PlanetFunctions
|
|||||||
planet.audio?.RemoveAudioData(ed.audioId);
|
planet.audio?.RemoveAudioData(ed.audioId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (planet.factory.enemyPool != null)
|
||||||
|
{
|
||||||
|
for (var i = planet.factory.enemyCursor - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
ref var ptr13 = ref planet.factory.enemyPool[i];
|
||||||
|
if (ptr13.id != i) continue;
|
||||||
|
var combatStatId = ptr13.combatStatId;
|
||||||
|
planet.factory.skillSystem.OnRemovingSkillTarget(combatStatId, planet.factory.skillSystem.combatStats.buffer[combatStatId].originAstroId, ETargetType.CombatStat);
|
||||||
|
planet.factory.skillSystem.combatStats.Remove(combatStatId);
|
||||||
|
planet.factory.KillEnemyFinally(player, i, ref CombatStat.empty);
|
||||||
|
}
|
||||||
|
planet.factory.enemySystem.Free();
|
||||||
|
UIRoot.instance.uiGame.dfAssaultTip.ClearAllSpots();
|
||||||
|
}
|
||||||
|
|
||||||
var stationPool = factory.transport?.stationPool;
|
var stationPool = factory.transport?.stationPool;
|
||||||
if (stationPool != null)
|
if (stationPool != null)
|
||||||
{
|
{
|
||||||
@@ -120,20 +135,34 @@ public static class PlanetFunctions
|
|||||||
if (warningPool[i].id == i && warningPool[i].factoryId == index)
|
if (warningPool[i].id == i && warningPool[i].factoryId == index)
|
||||||
warningSystem.RemoveWarningData(warningPool[i].id);
|
warningSystem.RemoveWarningData(warningPool[i].id);
|
||||||
}
|
}
|
||||||
|
var isCombatMode = factory.gameData.gameDesc.isCombatMode;
|
||||||
factory.entityCursor = 1;
|
factory.entityCursor = 1;
|
||||||
factory.entityRecycleCursor = 0;
|
factory.entityRecycleCursor = 0;
|
||||||
factory.entityCapacity = 0;
|
factory.entityCapacity = 0;
|
||||||
factory.SetEntityCapacity(1024);
|
factory.SetEntityCapacity(1024);
|
||||||
|
factory.craftCursor = 1;
|
||||||
|
factory.craftRecycleCursor = 0;
|
||||||
|
factory.craftCapacity = 0;
|
||||||
|
factory.SetCraftCapacity(128);
|
||||||
factory.prebuildCursor = 1;
|
factory.prebuildCursor = 1;
|
||||||
factory.prebuildRecycleCursor = 0;
|
factory.prebuildRecycleCursor = 0;
|
||||||
factory.prebuildCapacity = 0;
|
factory.prebuildCapacity = 0;
|
||||||
factory.SetPrebuildCapacity(256);
|
factory.SetPrebuildCapacity(256);
|
||||||
|
factory.enemyCursor = 1;
|
||||||
|
factory.enemyRecycleCursor = 0;
|
||||||
|
factory.enemyCapacity = 0;
|
||||||
|
factory.SetEnemyCapacity(isCombatMode ? 1024 : 32);
|
||||||
factory.cargoContainer = new CargoContainer();
|
factory.cargoContainer = new CargoContainer();
|
||||||
factory.cargoTraffic = new CargoTraffic(planet);
|
factory.cargoTraffic = new CargoTraffic(planet);
|
||||||
factory.blockContainer = new MiniBlockContainer();
|
factory.blockContainer = new MiniBlockContainer();
|
||||||
factory.factoryStorage = new FactoryStorage(planet);
|
factory.factoryStorage = new FactoryStorage(planet);
|
||||||
factory.powerSystem = new PowerSystem(planet);
|
factory.powerSystem = new PowerSystem(planet);
|
||||||
|
factory.constructionSystem = new ConstructionSystem(planet);
|
||||||
factory.factorySystem = new FactorySystem(planet);
|
factory.factorySystem = new FactorySystem(planet);
|
||||||
|
factory.enemySystem = new EnemyDFGroundSystem(planet);
|
||||||
|
factory.combatGroundSystem = new CombatGroundSystem(planet);
|
||||||
|
factory.defenseSystem = new DefenseSystem(planet);
|
||||||
|
factory.planetATField = new PlanetATField(planet);
|
||||||
factory.transport = new PlanetTransport(GameMain.data, planet);
|
factory.transport = new PlanetTransport(GameMain.data, planet);
|
||||||
factory.transport.Init();
|
factory.transport.Init();
|
||||||
factory.digitalSystem = new DigitalSystem(planet);
|
factory.digitalSystem = new DigitalSystem(planet);
|
||||||
|
|||||||
4
UXAssist/TODO.md
Normal file
4
UXAssist/TODO.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#### TODO
|
||||||
|
* Show coordinates of buildings, on both preview-mode and panel
|
||||||
|
* Better handling of consuming metadata
|
||||||
|
* More queued commands
|
||||||
Reference in New Issue
Block a user