-
-
Notifications
You must be signed in to change notification settings - Fork 122
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 #28 from hubastard/master
fork update
- Loading branch information
Showing
33 changed files
with
835 additions
and
14 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,50 @@ | ||
name: Build - Win x64 | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request_review: | ||
types: [ submitted ] | ||
|
||
jobs: | ||
|
||
build: | ||
strategy: | ||
matrix: | ||
configuration: [Debug, Release] | ||
|
||
# We *only* want to run this if a collaborator or owner of the repo approves a pull request, or if something is merged into the main branch | ||
if: ${{ github.event.ref == 'refs/heads/master' || (github.event.review.state == 'approved' && (github.event.review.author_association == 'COLLABORATOR' || github.event.review.author_association == 'OWNER')) }} | ||
runs-on: dsp-installed | ||
|
||
env: | ||
Solution_Name: Nebula.sln | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Clear output directory in DSP files | ||
# We use SilentlyContinue here because it errors out of the folder does not exist otherwise | ||
run: rm -R -ErrorAction SilentlyContinue "C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\BepInEx\plugins\Nebula" | ||
|
||
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild | ||
- name: Setup MSBuild.exe | ||
uses: microsoft/[email protected] | ||
|
||
# Build it | ||
- name: Build the application | ||
run: msbuild $env:Solution_Name /restore /p:Configuration=$env:Configuration | ||
env: | ||
Configuration: ${{ matrix.configuration }} | ||
|
||
# Upload it to the run results | ||
- name: Upload a Build Artifact | ||
uses: actions/[email protected] | ||
with: | ||
# Artifact name | ||
name: build-artifacts | ||
# A file, directory or wildcard pattern that describes what to upload | ||
path: C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\BepInEx\plugins\Nebula |
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
25 changes: 25 additions & 0 deletions
25
NebulaClient/PacketProcessors/Factory/Belt/BeltUpdatePickupItemsProcessor.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,25 @@ | ||
using NebulaModel.Attributes; | ||
using NebulaModel.Networking; | ||
using NebulaModel.Packets.Belt; | ||
using NebulaModel.Packets.Processors; | ||
|
||
namespace NebulaClient.PacketProcessors.Factory.Belt | ||
{ | ||
[RegisterPacketProcessor] | ||
class BeltUpdatePickupItemsProcessor : IPacketProcessor<BeltUpdatePickupItemsPacket> | ||
{ | ||
public void ProcessPacket(BeltUpdatePickupItemsPacket packet, NebulaConnection conn) | ||
{ | ||
if (GameMain.data.factories[packet.FactoryIndex]?.cargoTraffic != null) | ||
{ | ||
//Iterate though belt updates and remove target items | ||
for (int i = 0; i < packet.BeltUpdates.Length; i++) | ||
{ | ||
CargoTraffic traffic = GameMain.data.factories[packet.FactoryIndex].cargoTraffic; | ||
CargoPath cargoPath = traffic.GetCargoPath(traffic.beltPool[packet.BeltUpdates[i].BeltId].segPathId); | ||
cargoPath.TryPickItem(packet.BeltUpdates[i].SegId - 4 - 1, 12); | ||
} | ||
} | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
NebulaClient/PacketProcessors/Factory/Belt/BeltUpdatePutItemOnProcessor.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,22 @@ | ||
using NebulaModel.Attributes; | ||
using NebulaModel.Networking; | ||
using NebulaModel.Packets.Belt; | ||
using NebulaModel.Packets.Processors; | ||
using NebulaWorld.Factory; | ||
|
||
namespace NebulaClient.PacketProcessors.Factory.Belt | ||
{ | ||
[RegisterPacketProcessor] | ||
class BeltUpdatePutItemOnProcessor : IPacketProcessor<BeltUpdatePutItemOnPacket> | ||
{ | ||
public void ProcessPacket(BeltUpdatePutItemOnPacket packet, NebulaConnection conn) | ||
{ | ||
if (GameMain.data.factories[packet.FactoryIndex]?.cargoTraffic != null) | ||
{ | ||
FactoryManager.EventFromServer = true; | ||
GameMain.data.factories[packet.FactoryIndex].cargoTraffic.PutItemOnBelt(packet.BeltId, packet.ItemId); | ||
FactoryManager.EventFromServer = false; | ||
} | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
NebulaClient/PacketProcessors/Players/NewDroneOrderProcessor.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,17 @@ | ||
using NebulaModel.Attributes; | ||
using NebulaModel.Networking; | ||
using NebulaModel.Packets.Players; | ||
using NebulaModel.Packets.Processors; | ||
using NebulaWorld; | ||
|
||
namespace NebulaClient.PacketProcessors.Players | ||
{ | ||
[RegisterPacketProcessor] | ||
class NewDroneOrderProcessor : IPacketProcessor<NewDroneOrderPacket> | ||
{ | ||
public void ProcessPacket(NewDroneOrderPacket packet, NebulaConnection conn) | ||
{ | ||
SimulatedWorld.UpdateRemotePlayerDrone(packet); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
NebulaClient/PacketProcessors/Players/RemoveDroneOrdersProcessor.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 NebulaModel.Networking; | ||
using NebulaHost.PacketProcessors.Players; | ||
using NebulaModel.Packets.Processors; | ||
|
||
namespace NebulaClient.PacketProcessors.Players | ||
{ | ||
class RemoveDroneOrdersProcessor : IPacketProcessor<RemoveDroneOrdersPacket> | ||
{ | ||
public void ProcessPacket(RemoveDroneOrdersPacket packet, NebulaConnection conn) | ||
{ | ||
if (packet.QueuedEntityIds != null) | ||
{ | ||
for (int i = 0; i < packet.QueuedEntityIds.Length; i++) | ||
{ | ||
GameMain.mainPlayer.mecha.droneLogic.serving.Remove(packet.QueuedEntityIds[i]); | ||
} | ||
} | ||
} | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
NebulaHost/PacketProcessors/Factory/Belt/BeltUpdatePickupItemsProcessor.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,22 @@ | ||
using NebulaModel.Attributes; | ||
using NebulaModel.Networking; | ||
using NebulaModel.Packets.Belt; | ||
using NebulaModel.Packets.Processors; | ||
|
||
namespace NebulaHost.PacketProcessors.Factory.Belt | ||
{ | ||
[RegisterPacketProcessor] | ||
class BeltUpdatePickupItemsProcessor : IPacketProcessor<BeltUpdatePickupItemsPacket> | ||
{ | ||
public void ProcessPacket(BeltUpdatePickupItemsPacket packet, NebulaConnection conn) | ||
{ | ||
//Iterate though belt updates and remove target items | ||
for (int i = 0; i < packet.BeltUpdates.Length; i++) | ||
{ | ||
CargoTraffic traffic = GameMain.data.factories[packet.FactoryIndex].cargoTraffic; | ||
CargoPath cargoPath = traffic.GetCargoPath(traffic.beltPool[packet.BeltUpdates[i].BeltId].segPathId); | ||
cargoPath.TryPickItem(packet.BeltUpdates[i].SegId - 4 - 1, 12); | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
NebulaHost/PacketProcessors/Factory/Belt/BeltUpdatePutItemOnProcessor.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 @@ | ||
using NebulaModel.Attributes; | ||
using NebulaModel.Networking; | ||
using NebulaModel.Packets.Belt; | ||
using NebulaModel.Packets.Processors; | ||
using NebulaWorld.Factory; | ||
|
||
namespace NebulaHost.PacketProcessors.Factory.Belt | ||
{ | ||
[RegisterPacketProcessor] | ||
class BeltUpdatePutItemOnProcessor : IPacketProcessor<BeltUpdatePutItemOnPacket> | ||
{ | ||
public void ProcessPacket(BeltUpdatePutItemOnPacket packet, NebulaConnection conn) | ||
{ | ||
FactoryManager.EventFromClient = true; | ||
GameMain.data.factories[packet.FactoryIndex].cargoTraffic.PutItemOnBelt(packet.BeltId, packet.ItemId); | ||
FactoryManager.EventFromClient = true; | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
NebulaHost/PacketProcessors/Players/NewDroneOrderProcessor.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,45 @@ | ||
using NebulaModel.Attributes; | ||
using NebulaModel.Networking; | ||
using NebulaModel.Packets.Players; | ||
using NebulaModel.Packets.Processors; | ||
using NebulaWorld; | ||
using NebulaWorld.Player; | ||
|
||
namespace NebulaHost.PacketProcessors.Players | ||
{ | ||
[RegisterPacketProcessor] | ||
class NewDroneOrderProcessor : IPacketProcessor<NewDroneOrderPacket> | ||
{ | ||
private PlayerManager playerManager; | ||
|
||
public NewDroneOrderProcessor() | ||
{ | ||
playerManager = MultiplayerHostSession.Instance.PlayerManager; | ||
} | ||
|
||
public void ProcessPacket(NewDroneOrderPacket packet, NebulaConnection conn) | ||
{ | ||
//Host does not need to know about flying drones of other players if he is not on the same planet | ||
if (GameMain.mainPlayer.planetId != packet.PlanetId) | ||
{ | ||
return; | ||
} | ||
|
||
Player player = playerManager.GetPlayer(conn); | ||
|
||
if (player != null) | ||
{ | ||
if (packet.Stage == 1 || packet.Stage == 2) | ||
{ | ||
DroneManager.AddPlayerDronePlan(player.Id, packet.EntityId); | ||
} | ||
else if (packet.Stage == 3) | ||
{ | ||
DroneManager.RemovePlayerDronePlan(player.Id, packet.EntityId); | ||
} | ||
|
||
SimulatedWorld.UpdateRemotePlayerDrone(packet); | ||
} | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
NebulaHost/PacketProcessors/Routers/PlanetBroadcastProcessor.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,28 @@ | ||
using NebulaModel.Attributes; | ||
using NebulaModel.Networking; | ||
using NebulaModel.Packets.Processors; | ||
using NebulaModel.Packets.Routers; | ||
|
||
namespace NebulaHost.PacketProcessors.Routers | ||
{ | ||
[RegisterPacketProcessor] | ||
class PlanetBroadcastProcessor : IPacketProcessor<PlanetBroadcastPacket> | ||
{ | ||
private PlayerManager playerManager; | ||
public PlanetBroadcastProcessor() | ||
{ | ||
playerManager = MultiplayerHostSession.Instance.PlayerManager; | ||
} | ||
public void ProcessPacket(PlanetBroadcastPacket packet, NebulaConnection conn) | ||
{ | ||
Player player = playerManager.GetPlayer(conn); | ||
if (player != null) | ||
{ | ||
//Forward packet to other users | ||
playerManager.SendRawPacketToPlanet(packet.PacketObject, packet.PlanetId, conn); | ||
//Forward packet to the host | ||
MultiplayerHostSession.Instance.PacketProcessor.EnqueuePacketForProcessing(packet.PacketObject, conn); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.