-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #595 from starfi5h/pr-bugfix0.8.12
Bugfix for nebula 0.8.12 (DSP 0.9.27.15466)
- Loading branch information
Showing
34 changed files
with
527 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace NebulaModel.Packets.Factory.Belt | ||
{ | ||
public class BeltReversePacket | ||
{ | ||
public int BeltId { get; set; } | ||
public int PlanetId { get; set; } | ||
|
||
public BeltReversePacket() { } | ||
public BeltReversePacket(int beltId, int planetId) | ||
{ | ||
BeltId = beltId; | ||
PlanetId = planetId; | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
NebulaModel/Packets/Factory/Inserter/InserterOffsetCorrectionPacket.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace NebulaModel.Packets.Factory.Inserter | ||
{ | ||
public class InserterOffsetCorrectionPacket | ||
{ | ||
public int InserterId { get; set; } | ||
public short PickOffset { get; set; } | ||
public short InsertOffset { get; set; } | ||
public int PlanetId { get; set; } | ||
|
||
public InserterOffsetCorrectionPacket() { } | ||
public InserterOffsetCorrectionPacket(int inserterId, short pickOffset, short insertOffset, int planetId) | ||
{ | ||
InserterId = inserterId; | ||
PickOffset = pickOffset; | ||
InsertOffset = insertOffset; | ||
PlanetId = planetId; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
NebulaNetwork/PacketProcessors/Factory/Belt/BeltReverseProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using NebulaAPI; | ||
using NebulaModel.Packets.Factory.Belt; | ||
|
||
namespace NebulaNetwork.PacketProcessors.Factory.Belt | ||
{ | ||
[RegisterPacketProcessor] | ||
internal class BeltReverseProcessor : BasePacketProcessor<BeltReversePacket> | ||
{ | ||
public override void ProcessPacket(BeltReversePacket packet, INebulaConnection conn) | ||
{ | ||
PlanetFactory factory = GameMain.galaxy.PlanetById(packet.PlanetId).factory; | ||
if (factory == null) | ||
return; | ||
|
||
using (NebulaModAPI.MultiplayerSession.Factories.IsIncomingRequest.On()) | ||
{ | ||
NebulaModAPI.MultiplayerSession.Factories.EventFactory = factory; | ||
NebulaModAPI.MultiplayerSession.Factories.TargetPlanet = packet.PlanetId; | ||
if (NebulaModAPI.MultiplayerSession.LocalPlayer.IsHost) | ||
{ | ||
// Load planet model | ||
NebulaModAPI.MultiplayerSession.Factories.AddPlanetTimer(packet.PlanetId); | ||
} | ||
|
||
UIBeltWindow beltWindow = UIRoot.instance.uiGame.beltWindow; | ||
beltWindow._Close(); // close the window first to avoid changing unwant variable when setting beltId | ||
PlanetFactory tmpFactory = beltWindow.factory; | ||
int tmpBeltId = beltWindow.beltId; | ||
beltWindow.factory = factory; | ||
beltWindow.beltId = packet.BeltId; | ||
beltWindow.OnReverseButtonClick(0); | ||
beltWindow.factory = tmpFactory; | ||
beltWindow.beltId = tmpBeltId; | ||
|
||
NebulaModAPI.MultiplayerSession.Factories.EventFactory = null; | ||
NebulaModAPI.MultiplayerSession.Factories.TargetPlanet = NebulaModAPI.PLANET_NONE; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
NebulaNetwork/PacketProcessors/Factory/Inserter/InserterOffsetCorrectionProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using NebulaAPI; | ||
using NebulaModel.Packets.Factory.Inserter; | ||
|
||
namespace NebulaNetwork.PacketProcessors.Factory.Inserter | ||
{ | ||
[RegisterPacketProcessor] | ||
internal class InserterOffsetCorrectionProcessor : BasePacketProcessor<InserterOffsetCorrectionPacket> | ||
{ | ||
public override void ProcessPacket(InserterOffsetCorrectionPacket packet, INebulaConnection conn) | ||
{ | ||
InserterComponent[] pool = GameMain.galaxy.PlanetById(packet.PlanetId)?.factory?.factorySystem?.inserterPool; | ||
if (pool != null) | ||
{ | ||
NebulaModel.Logger.Log.Warn($"{packet.PlanetId} Fix inserter{packet.InserterId} pickOffset->{packet.PickOffset} insertOffset->{packet.InsertOffset}"); | ||
pool[packet.InserterId].pickOffset = packet.PickOffset; | ||
pool[packet.InserterId].insertOffset = packet.InsertOffset; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.