Skip to content

Commit 2d64c71

Browse files
committed
Update Code
1 parent 7514c8f commit 2d64c71

10 files changed

+101
-38
lines changed

data/prefabDescs.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
},
159159
{
160160
"ModelID": 70,
161-
"labAssembleSpeed": 20000
161+
"labAssembleSpeed": 40000
162162
},
163163
{
164164
"ModelID": 71,
@@ -214,15 +214,15 @@
214214
},
215215
{
216216
"ModelID": 293,
217-
"enemySpMax": 1200
217+
"enemySpMax": 720
218218
},
219219
{
220220
"ModelID": 294,
221-
"enemySpMax": 1500
221+
"enemySpMax": 900
222222
},
223223
{
224224
"ModelID": 295,
225-
"enemySpMax": 1500
225+
"enemySpMax": 900
226226
},
227227
{
228228
"ModelID": 300,
@@ -271,7 +271,7 @@
271271
},
272272
{
273273
"ModelID": 455,
274-
"labAssembleSpeed": 40000,
274+
"labAssembleSpeed": 80000,
275275
"labResearchSpeed": 4
276276
},
277277
{

data/recipes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5666,7 +5666,7 @@
56665666
"IconPath": "Assets/texpack/高效黑塑料",
56675667
"Type": 16,
56685668
"GridIndex": 4105,
5669-
"Time": 360,
5669+
"Time": 240,
56705670
"Input": [
56715671
1117,
56725672
6222,

data/techs.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,12 +926,14 @@
926926
1142
927927
],
928928
"Items": [
929-
6280
929+
6278,
930+
6279
930931
],
931932
"ItemPoints": [
933+
10,
932934
10
933935
],
934-
"HashNeeded": 720000,
936+
"HashNeeded": 1440000,
935937
"UnlockRecipes": [
936938
57
937939
],

src/Patches/DysonSpherePatches.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,23 @@ public static IEnumerable<CodeInstruction> DysonFrame_segCount_Transpiler(IEnume
1414

1515
matcher.MatchForward(false, new CodeMatch(OpCodes.Ldc_I4_2), new CodeMatch(OpCodes.Mul), new CodeMatch(OpCodes.Stloc_0));
1616

17+
// DysonFrame count /= 2
18+
matcher.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop)).SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop));
19+
20+
return matcher.InstructionEnumeration();
21+
}
22+
23+
[HarmonyPatch(typeof(DysonShell), nameof(DysonShell.GenerateGeometry))]
24+
[HarmonyPatch(typeof(DysonShell), nameof(DysonShell.Import))]
25+
[HarmonyTranspiler]
26+
public static IEnumerable<CodeInstruction> DysonShell_cpPerVertex_Transpiler(IEnumerable<CodeInstruction> instructions)
27+
{
28+
var matcher = new CodeMatcher(instructions);
29+
30+
matcher.MatchForward(false, new CodeMatch(OpCodes.Ldc_I4_2), new CodeMatch(OpCodes.Mul),
31+
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(DysonShell), nameof(DysonShell.cpPerVertex))));
32+
33+
// DysonShell count /= 8
1734
matcher.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Ldc_I4_4))
1835
.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Div));
1936

src/Patches/GammaGeneratorPatches.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System.Collections.Generic;
2+
using System.Reflection.Emit;
3+
using HarmonyLib;
4+
5+
namespace ProjectGenesis.Patches
6+
{
7+
public static class GammaGeneratorPatches
8+
{
9+
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.GameTick_Gamma))]
10+
[HarmonyTranspiler]
11+
public static IEnumerable<CodeInstruction> PowerGeneratorComponent_GameTick_Gamma_Transpiler(
12+
IEnumerable<CodeInstruction> instructions)
13+
{
14+
var matcher = new CodeMatcher(instructions);
15+
16+
matcher.MatchForward(false,
17+
new CodeMatch(OpCodes.Ldfld,
18+
AccessTools.Field(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.catalystPoint))),
19+
new CodeMatch(OpCodes.Ldc_I4_1), new CodeMatch(OpCodes.Sub));
20+
21+
// catalystPoint cost * 10
22+
matcher.Advance(1).SetAndAdvance(OpCodes.Ldc_I4_S, (sbyte)10);
23+
24+
matcher.MatchForward(false,
25+
new CodeMatch(OpCodes.Ldfld,
26+
AccessTools.Field(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.catalystIncPoint))),
27+
new CodeMatch(OpCodes.Ldloc_2), new CodeMatch(OpCodes.Sub));
28+
29+
// catalystIncPoint cost * 10
30+
matcher.Advance(2).InsertAndAdvance(new CodeInstruction(OpCodes.Ldc_I4_S, (sbyte)10), new CodeInstruction(OpCodes.Mul));
31+
32+
return matcher.InstructionEnumeration();
33+
}
34+
35+
[HarmonyPatch(typeof(UIPowerGeneratorWindow), nameof(UIPowerGeneratorWindow._OnUpdate))]
36+
[HarmonyTranspiler]
37+
public static IEnumerable<CodeInstruction> UIPowerGeneratorWindow_OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions)
38+
{
39+
var matcher = new CodeMatcher(instructions);
40+
41+
matcher.MatchForward(false, new CodeMatch(OpCodes.Ldstr, "0.100 / min"));
42+
matcher.SetOperandAndAdvance("1 / min");
43+
44+
matcher.MatchForward(false, new CodeMatch(OpCodes.Ldstr, "0.100 / min"));
45+
matcher.SetOperandAndAdvance("1 / min");
46+
47+
return matcher.InstructionEnumeration();
48+
}
49+
}
50+
}

src/Patches/InserterComponentPatches.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ namespace ProjectGenesis.Patches
66
{
77
public static class InserterComponentPatches
88
{
9-
[HarmonyTranspiler]
109
[HarmonyPatch(typeof(ItemProto), nameof(ItemProto.GetPropValue))]
10+
[HarmonyTranspiler]
1111
public static IEnumerable<CodeInstruction> ItemProto_GetPropValue_Transpiler(IEnumerable<CodeInstruction> instructions)
1212
{
1313
var matcher = new CodeMatcher(instructions);
@@ -17,8 +17,8 @@ public static IEnumerable<CodeInstruction> ItemProto_GetPropValue_Transpiler(IEn
1717
return matcher.InstructionEnumeration();
1818
}
1919

20-
[HarmonyTranspiler]
2120
[HarmonyPatch(typeof(UIInserterWindow), nameof(UIInserterWindow._OnUpdate))]
21+
[HarmonyTranspiler]
2222
public static IEnumerable<CodeInstruction> UIInserterWindow__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions)
2323
{
2424
var matcher = new CodeMatcher(instructions);
@@ -28,8 +28,8 @@ public static IEnumerable<CodeInstruction> UIInserterWindow__OnUpdate_Transpiler
2828
return matcher.InstructionEnumeration();
2929
}
3030

31-
[HarmonyTranspiler]
3231
[HarmonyPatch(typeof(InserterComponent), nameof(InserterComponent.InternalUpdate_Bidirectional))]
32+
[HarmonyTranspiler]
3333
public static IEnumerable<CodeInstruction> InserterComponent_InternalUpdate_Bidirectional_Transpiler(
3434
IEnumerable<CodeInstruction> instructions)
3535
{

src/Patches/PlanetGasPatches.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static IEnumerable<CodeInstruction> PlanetGen_SetPlanetTheme_RemoveOcean(
7474

7575
matcher.Advance(1).InsertAndAdvance(new CodeInstruction(OpCodes.Ldloc_S, themeProto),
7676
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(ThemeProto), nameof(ThemeProto.WaterItemId))),
77-
new CodeInstruction(OpCodes.Ldc_I4_0), new CodeInstruction(OpCodes.Bne_Un_S, label));
77+
new CodeInstruction(OpCodes.Ldc_I4_0), new CodeInstruction(OpCodes.Bgt_Un_S, label));
7878

7979
return matcher.InstructionEnumeration();
8080
}

src/Patches/RecipeExtraPowerPatches.cs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@ namespace ProjectGenesis.Patches
99
public static class RecipeExtraPowerPatches
1010
{
1111
/// <summary>
12-
/// 1 == 600kw
12+
/// 1 == 300kw
1313
/// </summary>
1414
public static readonly Dictionary<int, int> RecipePowerRate = new Dictionary<int, int>
1515
{
16-
{ ProtoID.R水电解, 2 },
17-
{ ProtoID.R重氢, 4 },
18-
{ ProtoID.R三元精金, 4 },
19-
{ ProtoID.R光子物质化, 4 },
20-
{ ProtoID.R奇异物质, 4 },
21-
{ ProtoID.R氦核转化, 4 },
22-
{ ProtoID.R质能储存高效, 4 },
23-
{ ProtoID.R能量物质化, 4 },
16+
{ ProtoID.R水电解, 4 },
17+
{ ProtoID.R羰基合成, 4 },
18+
{ ProtoID.R重氢, 8 },
19+
{ ProtoID.R三元精金, 16 },
20+
{ ProtoID.R光子物质化, 8 },
21+
{ ProtoID.R奇异物质, 8 },
22+
{ ProtoID.R氦核转化, 8 },
23+
{ ProtoID.R质能储存高效, 8 },
24+
{ ProtoID.R能量物质化, 8 },
2425
};
2526

2627
[HarmonyPatch(typeof(AssemblerComponent), nameof(AssemblerComponent.SetPCState))]
@@ -29,11 +30,12 @@ public static void AssemblerComponent_SetPCState_Postfix(AssemblerComponent __in
2930
{
3031
if (!__instance.replicating) return;
3132

32-
if (!RecipePowerRate.TryGetValue(__instance.recipeId, out int num)) return;
33-
3433
ref PowerConsumerComponent component = ref pcPool[__instance.pcId];
35-
component.requiredEnergy = (component.workEnergyPerTick + __instance.speedOverride * num) * (1000 + __instance.extraPowerRatio)
36-
/ 1000L;
34+
35+
int num = RecipePowerRate.GetValueOrDefault(__instance.recipeId, 1);
36+
37+
component.requiredEnergy = (component.workEnergyPerTick + __instance.speedOverride * num / 2)
38+
* (1000 + __instance.extraPowerRatio) / 1000;
3739
}
3840
}
3941
}

src/ProjectGenesis.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class ProjectGenesis : BaseUnityPlugin, IModCanSave, IMultiplayerModWithS
4949
public const string MODGUID = "org.LoShin.GenesisBook";
5050
public const string MODNAME = "GenesisBook";
5151
public const string VERSION = "3.1.0";
52-
public const string DEBUGVERSION = "-alpha1.0";
52+
public const string DEBUGVERSION = "-alpha0.2";
5353

5454
public static bool LoadCompleted;
5555

src/Utils/CopyModelUtils.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,20 +204,12 @@ internal static void ItemPostFix()
204204

205205
internal static void ModifyEnemyHpUpgrade()
206206
{
207-
for (int i = ProtoID.M行星基地; i <= ProtoID.M导轨; i++)
207+
for (int i = ProtoID.M行星基地; i <= ProtoID.M守卫者; i++)
208208
{
209209
ModelProto model = LDB.models.Select(i);
210-
model.HpMax *= 2;
211-
model.HpUpgrade *= 2;
212-
model.HpRecover *= 2;
213-
}
214-
215-
for (int i = ProtoID.M强袭者; i <= ProtoID.M守卫者; i++)
216-
{
217-
ModelProto model = LDB.models.Select(i);
218-
model.HpMax *= 5;
219-
model.HpUpgrade *= 5;
220-
model.HpRecover *= 5;
210+
model.HpMax *= 3;
211+
model.HpUpgrade *= 3;
212+
model.HpRecover *= 3;
221213
}
222214
}
223215
}

0 commit comments

Comments
 (0)