Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
starfi5h committed Mar 14, 2024
1 parent 8203ccb commit 7962507
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace NebulaModel.Packets.Factory.Belt;

public class BeltReverseRequest
public class BeltReverseRequestPacket
{
public BeltReverseRequest() { }
public BeltReverseRequestPacket() { }

public BeltReverseRequest(int beltId, int planetId, int authorId)
public BeltReverseRequestPacket(int beltId, int planetId, int authorId)
{
BeltId = beltId;
PlanetId = planetId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
namespace NebulaNetwork.PacketProcessors.Factory.Belt;

[RegisterPacketProcessor]
internal class BeltReverseProcessor : BasePacketProcessor<BeltReverseRequest>
internal class BeltReverseProcessor : BasePacketProcessor<BeltReverseRequestPacket>
{
public override void ProcessPacket(BeltReverseRequest packet, INebulaConnection conn)
public override void ProcessPacket(BeltReverseRequestPacket packet, INebulaConnection conn)
{
var factory = GameMain.galaxy.PlanetById(packet.PlanetId).factory;
if (factory == null)
Expand All @@ -34,6 +34,11 @@ public override void ProcessPacket(BeltReverseRequest packet, INebulaConnection
NebulaModAPI.MultiplayerSession.Factories.EventFactory = factory;
NebulaModAPI.MultiplayerSession.Factories.TargetPlanet = packet.PlanetId;
NebulaModAPI.MultiplayerSession.Factories.PacketAuthor = packet.AuthorId;
if (IsHost)
{
// Load planet model
NebulaModAPI.MultiplayerSession.Factories.AddPlanetTimer(packet.PlanetId);
}

var beltWindow = UIRoot.instance.uiGame.beltWindow;
try
Expand Down
2 changes: 1 addition & 1 deletion NebulaPatcher/Patches/Dynamic/UIBeltWindow_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static bool OnReverseButtonClick_Prefix(UIBeltWindow __instance)
if (Multiplayer.Session.Factories.IsIncomingRequest.Value) return true;

// Notify others about belt direction reverse
var packet = new BeltReverseRequest(__instance.beltId, __instance.factory.planetId, Multiplayer.Session.LocalPlayer.Id);
var packet = new BeltReverseRequestPacket(__instance.beltId, __instance.factory.planetId, Multiplayer.Session.LocalPlayer.Id);
if (Multiplayer.Session.IsServer)
{
var starId = __instance.factory.planetId / 100;
Expand Down

0 comments on commit 7962507

Please sign in to comment.