Skip to content

Commit

Permalink
Merge branch 'master' into logdspver
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantomGamers committed Mar 16, 2024
2 parents 044d7b5 + 8313fa5 commit 24ab16d
Show file tree
Hide file tree
Showing 56 changed files with 1,031 additions and 539 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/thunderstore_bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ function generateManifest() {
const manifest = {
name: pluginInfo.name,
description:
"With this mod you will be able to play with your friends in the same game!",
"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.29",
version_number: pluginInfo.version,
dependencies: [
BEPINEX_DEPENDENCY,
`nebula-${apiPluginInfo.name}-${apiPluginInfo.version}`,
"PhantomGamers-IlLine-1.0.0",
"starfi5h-BulletTime-1.4.5",
"starfi5h-BulletTime-1.4.7",
],
website_url: "https://github.com/hubastard/nebula"
};
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
## Changelog

0.9.1:
- Support combat mode syncing (game version 0.10.29.21950)
- @starfi5h: Implement basic combat syncing framework
- @starfi5h: Add new config option `EnableBattleMessage` to show battle notifications
- @starfi5h: Add map ping: when chat is open, `Ctrl+Alt+LeftClick` on the planet can create a link in chatbox
- @mmjr, @phantomgamers, @sp00ktober: Review code and provide suggestions

0.9.0:
- Now compatible with Dark Fog (DSP 0.10.x) with enemies disabled
- Now compatible with Dark Fog game version (DSP 0.10.x). Combat mode is not supported yet.
- @phantomgamers: fix compilation after update and overall fixes/cleanup
- @phantomgamers: fix UIVirtualStarmap patches
- @phantomgamers: reviewing code from other contributers
Expand Down
9 changes: 5 additions & 4 deletions NebulaModel/DataStructures/Chat/ChatMessageType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ public enum ChatMessageType
PlayerMessage = 0,
SystemInfoMessage = 1,
SystemWarnMessage = 2,
CommandUsageMessage = 3,
CommandOutputMessage = 4,
CommandErrorMessage = 5,
PlayerMessagePrivate = 6
BattleMessage = 3,
CommandUsageMessage = 4,
CommandOutputMessage = 5,
CommandErrorMessage = 6,
PlayerMessagePrivate = 7
}
4 changes: 4 additions & 0 deletions NebulaModel/MultiplayerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ public bool StreamerMode
[Category("Chat")]
public bool EnableInfoMessage { get; set; } = true;

[DisplayName("Show battle notification message")]
[Category("Chat")]
public bool EnableBattleMessage { get; set; } = true;

[DisplayName("Default chat position")]
[Category("Chat")]
public ChatPosition DefaultChatPosition { get; set; } = ChatPosition.LeftMiddle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ protected virtual SubscribeDelegate GetCallbackFromData(NetDataReader reader)

protected virtual void WriteHash<T>(NetDataWriter writer)
{
writer.Put(GetHash<T>());
var hash = GetHash<T>();
writer.Put(hash);
if (!_callbacks.ContainsKey(hash))
{
Log.WarnInform($"WriteHash for unregistered type: " + typeof(T).ToString());
}
}

/// <summary>
Expand Down
14 changes: 13 additions & 1 deletion NebulaModel/Networking/Serialization/NebulaNetPacketProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,19 @@ public void ProcessPacketQueue()
while (pendingPackets.Count > 0 && EnablePacketProcessing)
{
var packet = pendingPackets.Dequeue();
ReadPacket(new NetDataReader(packet.Data), packet.UserData);
try
{
ReadPacket(new NetDataReader(packet.Data), packet.UserData);
}
catch (Exception ex)
{
// We can't do anything to ParseException, so just leave a warning in the log file
// For other exception, display a red error pop-up window
if (ex is not ParseException)
{
Log.Error(ex);
}
}
}
}
}
Expand Down

This file was deleted.

15 changes: 0 additions & 15 deletions NebulaModel/Packets/Factory/Belt/BeltReversePacket.cs

This file was deleted.

17 changes: 17 additions & 0 deletions NebulaModel/Packets/Factory/Belt/BeltReverseRequestPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace NebulaModel.Packets.Factory.Belt;

public class BeltReverseRequestPacket
{
public BeltReverseRequestPacket() { }

public BeltReverseRequestPacket(int beltId, int planetId, int authorId)
{
BeltId = beltId;
PlanetId = planetId;
AuthorId = authorId;
}

public int BeltId { get; set; }
public int PlanetId { get; set; }
public int AuthorId { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ public FoundationBuildUpdatePacket(Vector3 center, float radius, int reformSize,
ReformIndices = btr?.extraCircleIndices;
ExtraCenter = center.ToFloat3();
CirclePointCount = btr.circlePointCount;
IsCircle = true;
}
else //Normal reform
{
ReformIndices = btr?.cursorIndices;
ExtraCenter = new Float3(Vector3.zero);
CirclePointCount = 0;
IsCircle = false;
}
}

Expand All @@ -48,4 +50,5 @@ public FoundationBuildUpdatePacket(Vector3 center, float radius, int reformSize,
public Float3 GroundTestPos { get; set; }
public Float3 ExtraCenter { get; set; }
public int CirclePointCount { get; set; }
public bool IsCircle { get; set; }
}
15 changes: 0 additions & 15 deletions NebulaModel/Packets/GameHistory/GameHistoryTechRefundPacket.cs

This file was deleted.

64 changes: 0 additions & 64 deletions NebulaModel/Packets/Session/HandshakeRequest.cs

This file was deleted.

3 changes: 3 additions & 0 deletions NebulaModel/Utils/ChatUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ public static Color GetMessageColor(ChatMessageType messageType)
case ChatMessageType.SystemWarnMessage:
return new Color(1, 0.95f, 0, 1);

case ChatMessageType.BattleMessage:
return Color.cyan;

case ChatMessageType.CommandUsageMessage:
return new Color(1, 0.65f, 0, 1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ protected override void ProcessPacket(DFTinderDispatchPacket packet, NebulaConne
var hiveSystem = GameMain.spaceSector.GetHiveByAstroId(packet.OriginHiveAstroId);
if (hiveSystem == null) return;

Multiplayer.Session.Enemies.DisplayAstroMessage("DF seed sent out from".Translate(), hiveSystem.starData.astroId);

ref var tinderComponent = ref hiveSystem.tinders.buffer[packet.TinderId];
if (tinderComponent.id != packet.TinderId) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using NebulaModel.Packets;
using NebulaModel.Packets.Combat.GroundEnemy;
using NebulaWorld;
using NebulaWorld.Combat;

#endregion

Expand All @@ -18,23 +19,17 @@ public class DFGLaunchAssaultProcessor : PacketProcessor<DFGLaunchAssaultPacket>
protected override void ProcessPacket(DFGLaunchAssaultPacket packet, NebulaConnection conn)
{
var factory = GameMain.galaxy.PlanetById(packet.PlanetId)?.factory;
if (factory == null) return;
if (factory == null)
{
// Display message in chat if it can't show in UIDarkFogMonitor
Multiplayer.Session.Enemies.DisplayPlanetPingMessage("Planetary base is attacking".Translate(), packet.PlanetId, packet.TarPos.ToVector3());
return;
}

using (Multiplayer.Session.Combat.IsIncomingRequest.On())
{
// Set enemyRecycle pool to make enemyId stay in sync
factory.enemyCursor = packet.EnemyCursor;
var capacity = factory.enemyCapacity;
while (capacity <= factory.enemyCursor)
{
capacity *= 2;
}
if (capacity > factory.enemyCapacity)
{
factory.SetEnemyCapacity(capacity);
}
factory.enemyRecycleCursor = packet.EnemyRecyle.Length;
Array.Copy(packet.EnemyRecyle, factory.enemyRecycle, packet.EnemyRecyle.Length);
EnemyManager.SetPlanetFactoryRecycle(factory, packet.EnemyCursor, packet.EnemyRecyle);

var dFBase = factory.enemySystem.bases.buffer[packet.BaseId];
dFBase.turboTicks = 60;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ protected override void ProcessPacket(DFGUpdateBaseStatusPacket packet, NebulaCo
if (factory == null) return;

var dFBase = factory.enemySystem.bases.buffer[packet.BaseId];
if (dFBase == null) return;
ref var evolveData = ref dFBase.evolve;
evolveData.threat = packet.Threat;
if (evolveData.level != packet.Level)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class DFSLaunchLancerAssaultProcessor : PacketProcessor<DFSLaunchLancerAs
{
protected override void ProcessPacket(DFSLaunchLancerAssaultPacket packet, NebulaConnection conn)
{
Multiplayer.Session.Enemies.DisplayAstroMessage("Space hive is attacking".Translate(), packet.TargetAstroId);
var spaceSector = GameMain.spaceSector;
var hive = spaceSector.GetHiveByAstroId(packet.HiveAstroId);
if (hive == null) return;
Expand Down

This file was deleted.

Loading

0 comments on commit 24ab16d

Please sign in to comment.