Skip to content

Commit 188a4a3

Browse files
authored
Merge pull request #748 from starfi5h/master
0.9.19
2 parents 1e92d30 + c2a45a8 commit 188a4a3

File tree

9 files changed

+98
-26
lines changed

9 files changed

+98
-26
lines changed

.github/scripts/thunderstore_bundle.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ function generateManifest() {
117117
const manifest = {
118118
name: pluginInfo.name,
119119
description:
120-
"With this mod you will be able to play with your friends in the same game! Now supports combat mode in game version 0.10.32",
120+
"With this mod you will be able to play with your friends in the same game! Now supports combat mode in game version 0.10.33",
121121
version_number: pluginInfo.version,
122122
dependencies: [
123123
BEPINEX_DEPENDENCY,
124124
`nebula-${apiPluginInfo.name}-${apiPluginInfo.version}`,
125125
"PhantomGamers-IlLine-1.0.0",
126-
"starfi5h-BulletTime-1.5.11",
126+
"starfi5h-BulletTime-1.5.12",
127127
"starfi5h-ErrorAnalyzer-1.3.3",
128-
"starfi5h-NebulaCompatibilityAssist-0.4.27"
128+
"starfi5h-NebulaCompatibilityAssist-0.5.0"
129129
],
130130
website_url: "https://github.com/NebulaModTeam/nebula"
131131
};

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
## Changelog
22

3+
0.9.19:
4+
- Add new config option `Chat View Mode` to switch between TMPro and IMGUI chat window.
5+
- Sync point-to-point transport setting window in client.
6+
- Sync station pairing tab in client.
7+
- Fix InvalidTypeException when placing blueprint foundation.
8+
- Register enemy kill stats for kill events that broadcast from other players.
9+
310
0.9.18:
411
- Compatible with game version 0.10.33.27026
512
- **The dedicated server CLI option has changed from `-server` to `-nebula-server`**

NebulaModel/MultiplayerOptions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ public bool StreamerMode
127127
[DisplayName("Enable Other Player Sounds")]
128128
public bool EnableOtherPlayerSounds { get; set; } = true;
129129

130-
[DisplayName("Enable Unkillable Mode")]
131-
[Description("The mecha will not be destroyed with this mode")]
132-
public bool EnableUnkillableMode { get; set; } = false;
130+
[DisplayName("Enable Invincible Mode")]
131+
[Description("The mecha will not take damage in this mode")]
132+
public bool EnableInvincibleMode { get; set; } = false;
133133

134134

135135
#region Chat Settings
Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,53 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23

34
namespace NebulaModel.Packets.Factory.Foundation;
45

56
public class FoundationBlueprintPastePacket
67
{
78
public FoundationBlueprintPastePacket() { }
89

9-
public FoundationBlueprintPastePacket(int planetId, List<int> reformGridIds,
10-
Dictionary<int, int> levelChanges, int reformType, int reformColor)
10+
public FoundationBlueprintPastePacket(int planetId, Dictionary<int, int> levelChanges,
11+
byte[] reformData)
1112
{
1213
PlanetId = planetId;
14+
LevelChangesKeys = new int[levelChanges.Count];
15+
LevelChangesValues = new int[levelChanges.Count];
16+
var index = 0;
17+
foreach (var pair in levelChanges)
18+
{
19+
LevelChangesKeys[index] = pair.Key;
20+
LevelChangesValues[index] = pair.Value;
21+
index++;
22+
}
23+
ReformData = reformData;
24+
ReformGridIds = [];
25+
}
26+
27+
public FoundationBlueprintPastePacket(int planetId, Dictionary<int, int> levelChanges,
28+
int[] reformGridIds, int reformType, int reformColor)
29+
{
30+
PlanetId = planetId;
31+
LevelChangesKeys = new int[levelChanges.Count];
32+
LevelChangesValues = new int[levelChanges.Count];
33+
var index = 0;
34+
foreach (var pair in levelChanges)
35+
{
36+
LevelChangesKeys[index] = pair.Key;
37+
LevelChangesValues[index] = pair.Value;
38+
index++;
39+
}
40+
ReformData = [];
1341
ReformGridIds = reformGridIds;
14-
LevelChanges = levelChanges;
1542
ReformType = reformType;
1643
ReformColor = reformColor;
1744
}
1845

1946
public int PlanetId { get; set; }
20-
public List<int> ReformGridIds { get; set; }
21-
public Dictionary<int, int> LevelChanges { get; set; }
47+
public int[] LevelChangesKeys { get; set; }
48+
public int[] LevelChangesValues { get; set; }
49+
public byte[] ReformData { get; set; }
50+
public int[] ReformGridIds { get; set; }
2251
public int ReformType { get; set; }
2352
public int ReformColor { get; set; }
2453
}

NebulaNetwork/PacketProcessors/Factory/Foundation/FoundationBlueprintPasteProcessor.cs

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#region
22

3+
using System;
34
using System.Collections.Generic;
45
using NebulaAPI;
56
using NebulaAPI.Packets;
@@ -31,9 +32,22 @@ protected override void ProcessPacket(FoundationBlueprintPastePacket packet, Neb
3132
GameMain.gpuiManager.specifyPlanet = planet;
3233

3334
// Split BuildTool_BlueprintPaste.DetermineReforms into following functions
34-
SetReform(factory, packet.ReformGridIds, packet.ReformType, packet.ReformColor);
35-
AlterHeightMap(planet, packet.LevelChanges);
36-
RemoveVeges(factory, packet.LevelChanges);
35+
factory.platformSystem.EnsureReformData();
36+
if (packet.ReformData != null && packet.ReformData.Length > 0)
37+
{
38+
SetReformByData(factory, packet.ReformData);
39+
}
40+
else if (packet.ReformGridIds != null && packet.ReformGridIds.Length > 0)
41+
{
42+
SetReformByGridIds(factory, packet.ReformGridIds, packet.ReformType, packet.ReformColor);
43+
}
44+
var levelChanges = new Dictionary<int, int>();
45+
for (int i = 0; i < packet.LevelChangesKeys.Length; i++)
46+
{
47+
levelChanges.Add(packet.LevelChangesKeys[i], packet.LevelChangesValues[i]);
48+
}
49+
AlterHeightMap(planet, levelChanges);
50+
RemoveVeges(factory, levelChanges);
3751
UpdateGeothermalStrength(factory);
3852
AlterVeinModels(factory);
3953

@@ -42,11 +56,17 @@ protected override void ProcessPacket(FoundationBlueprintPastePacket packet, Neb
4256
}
4357
}
4458

45-
static void SetReform(PlanetFactory factory, List<int> reformGridIds, int brushType, int brushColor)
59+
static void SetReformByData(PlanetFactory factory, byte[] reformData)
4660
{
47-
PlatformSystem platformSystem = factory.platformSystem;
48-
platformSystem.EnsureReformData();
61+
// EBlueprintPasteResult.HasReform in DetermineReforms()
62+
var length = Math.Min(reformData.Length, factory.platformSystem.reformData.Length);
63+
Array.Copy(reformData, factory.platformSystem.reformData, length);
64+
}
4965

66+
static void SetReformByGridIds(PlanetFactory factory, int[] reformGridIds, int brushType, int brushColor)
67+
{
68+
// EBlueprintPasteResult.BuildingNeedReform in DetermineReforms()
69+
var platformSystem = factory.platformSystem;
5070
foreach (int gridId in reformGridIds)
5171
{
5272
int reformIndex = platformSystem.GetReformIndex(gridId >> 16, gridId & 65535);
@@ -57,6 +77,7 @@ static void SetReform(PlanetFactory factory, List<int> reformGridIds, int brushT
5777
}
5878
}
5979
}
80+
6081
static void AlterHeightMap(PlanetData planet, Dictionary<int, int> heightLevelChanges)
6182
{
6283
PlanetRawData planetRawData = planet.data;
@@ -167,7 +188,7 @@ static void AlterVeinModels(PlanetFactory factory)
167188
physics.SetPlanetPhysicsColliderDirty();
168189
if (Mathf.Abs(magnitude - veinSurfaceThreshold) > 0.1f)
169190
{
170-
Quaternion quaternion = Maths.SphericalRotation(pos, Random.value * 360f);
191+
Quaternion quaternion = Maths.SphericalRotation(pos, UnityEngine.Random.value * 360f);
171192
GameMain.gpuiManager.AlterModel(veinPtr.modelIndex, veinPtr.modelId, veinId, pos, quaternion, false);
172193
}
173194
else

NebulaPatcher/Patches/Dynamic/Mecha_Patch.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#region
22

33
using HarmonyLib;
4+
using NebulaModel;
45
using NebulaModel.Packets.Players;
56
using NebulaWorld;
67

@@ -59,4 +60,11 @@ public static bool AddConsumptionStat_Prefix(int itemId, int itemCount)
5960
Multiplayer.Session.Network.SendPacket(new PlayerMechaStat(itemId, -itemCount));
6061
return false;
6162
}
63+
64+
[HarmonyPrefix]
65+
[HarmonyPatch(nameof(Mecha.TakeDamage))]
66+
public static bool TakeDamage_Prefix()
67+
{
68+
return !Multiplayer.IsActive || !Config.Options.EnableInvincibleMode;
69+
}
6270
}

NebulaPatcher/Patches/Dynamic/Player_Patch.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ public static bool Kill_Prefix(Player __instance)
159159
{
160160
if (!Multiplayer.IsActive) return true;
161161
if (__instance != GameMain.mainPlayer) return false;
162-
if (Config.Options.EnableUnkillableMode) return false;
163162

164163
if (__instance.isAlive)
165164
{

NebulaPatcher/Patches/Transpilers/BuildTool_BlueprintPaste_Transpiler.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ private static void BroadcastReform(BuildTool_BlueprintPaste buildTool)
9393
{
9494
if (!Multiplayer.IsActive) return;
9595

96-
var reformTool = buildTool.player.controller.actionBuild.reformTool;
97-
var brushType = (reformTool != null) ? reformTool.brushType : 0;
98-
var brushColor = (reformTool != null) ? reformTool.brushColor : 0;
99-
Multiplayer.Session.Network.SendPacketToLocalStar(new FoundationBlueprintPastePacket(
100-
buildTool.planet.id, buildTool.reformGridIds.ToList(), buildTool.tmpModLevel, brushType, brushColor));
96+
if (buildTool.hasPastedReform)
97+
{
98+
Multiplayer.Session.Network.SendPacketToLocalStar(new FoundationBlueprintPastePacket(
99+
buildTool.planet.id, buildTool.tmpModLevel, buildTool.factory.platformSystem.reformData));
100+
}
101+
else
102+
{
103+
var reformTool = buildTool.player.controller.actionBuild.reformTool;
104+
var brushType = (reformTool != null) ? reformTool.brushType : 0;
105+
var brushColor = (reformTool != null) ? reformTool.brushColor : 0;
106+
Multiplayer.Session.Network.SendPacketToLocalStar(new FoundationBlueprintPastePacket(
107+
buildTool.planet.id, buildTool.tmpModLevel, buildTool.reformGridIds.ToArray(), brushType, brushColor));
108+
}
101109
}
102110
}

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3-
"version": "0.9.18",
3+
"version": "0.9.19",
44
"assemblyVersion": {
55
"precision": "build"
66
},

0 commit comments

Comments
 (0)