forked from NebulaModTeam/nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
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 NebulaModTeam#570 from hubastard/dsp-0.9.26
fix compatibility with dsp 0.9.26.12891
- Loading branch information
Showing
53 changed files
with
895 additions
and
80 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
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,27 @@ | ||
namespace NebulaModel.Packets.Factory | ||
{ | ||
public class EntityBoostSwitchPacket | ||
{ | ||
public int PlanetId { get; set; } | ||
public EBoostEntityType EntityType { get; set; } | ||
public int Id { get; set; } | ||
public bool Enable { get; set; } | ||
|
||
public EntityBoostSwitchPacket() { } | ||
|
||
public EntityBoostSwitchPacket(int planetId, EBoostEntityType entityType, int id, bool enable) | ||
{ | ||
PlanetId = planetId; | ||
EntityType = entityType; | ||
Id = id; | ||
Enable = enable; | ||
} | ||
} | ||
|
||
public enum EBoostEntityType | ||
{ | ||
ArtificialStar, | ||
Ejector, | ||
Silo | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ts/Factory/FoundationBuildUpdatePacket.cs → ...Foundation/FoundationBuildUpdatePacket.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
21 changes: 21 additions & 0 deletions
21
NebulaModel/Packets/Factory/Foundation/PlanetReformPacket.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,21 @@ | ||
namespace NebulaModel.Packets.Factory.Foundation | ||
{ | ||
public class PlanetReformPacket | ||
{ | ||
public int PlanetId { get; set; } | ||
public bool IsReform { get; set; } // true = reform all, false = revert | ||
public int Type { get; set; } | ||
public int Color { get; set; } | ||
public bool Bury { get; set; } | ||
|
||
public PlanetReformPacket() { } | ||
public PlanetReformPacket(int planetId, bool isReform, int type = 0, int color = 0, bool bury = false) | ||
{ | ||
PlanetId = planetId; | ||
IsReform = isReform; | ||
Type = type; | ||
Color = color; | ||
Bury = bury; | ||
} | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
NebulaModel/Packets/GameHistory/GameHistoryFeatureKeyPacket.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,15 @@ | ||
namespace NebulaModel.Packets.GameHistory | ||
{ | ||
public class GameHistoryFeatureKeyPacket | ||
{ | ||
public int FeatureId { get; set; } | ||
public bool Add { get; set; } | ||
|
||
public GameHistoryFeatureKeyPacket() { } | ||
public GameHistoryFeatureKeyPacket(int featureId, bool add) | ||
{ | ||
FeatureId = featureId; | ||
Add = add; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace NebulaModel.Packets.Planet | ||
{ | ||
public class VegeAddPacket | ||
{ | ||
public int PlanetId { get; set; } | ||
public bool IsVein { get; set; } | ||
public byte[] Data { get; set; } | ||
|
||
public VegeAddPacket() { } | ||
public VegeAddPacket(int planetId, bool isVein, byte[] data) | ||
{ | ||
PlanetId = planetId; | ||
IsVein = isVein; | ||
Data = data; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#pragma warning disable IDE1006 | ||
namespace NebulaModel.Packets.Universe | ||
{ | ||
public class DysonSailDataPacket | ||
{ | ||
public int StarIndex { get; set; } | ||
public int OrbitId { get; set; } | ||
public long ExpiryTime { get; set; } | ||
public float st { get; set; } | ||
public float px { get; set; } | ||
public float py { get; set; } | ||
public float pz { get; set; } | ||
public float vx { get; set; } | ||
public float vy { get; set; } | ||
public float vz { get; set; } | ||
public float gs { get; set; } | ||
|
||
public DysonSailDataPacket() { } | ||
public DysonSailDataPacket(int starIndex, ref DysonSail sail, int orbitId, long expiryTime) | ||
{ | ||
StarIndex = starIndex; | ||
OrbitId = orbitId; | ||
ExpiryTime = expiryTime; | ||
st = sail.st; | ||
px = sail.px; | ||
py = sail.py; | ||
pz = sail.pz; | ||
vx = sail.vx; | ||
vy = sail.vy; | ||
vz = sail.vz; | ||
gs = sail.gs; | ||
} | ||
} | ||
} | ||
#pragma warning restore IDE1006 |
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 |
---|---|---|
|
@@ -19,6 +19,7 @@ public enum SwarmRemoveOrbitEvent | |
{ | ||
Remove, | ||
Disable, | ||
Enable | ||
Enable, | ||
RemoveSails | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
NebulaNetwork/PacketProcessors/Factory/Entity/EntityBoostSwitchProcessor.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,56 @@ | ||
using NebulaAPI; | ||
using NebulaModel.Networking; | ||
using NebulaModel.Packets; | ||
using NebulaModel.Packets.Factory; | ||
|
||
namespace NebulaNetwork.PacketProcessors.Factory.Entity | ||
{ | ||
[RegisterPacketProcessor] | ||
class EntityBoostSwitchProcessor : PacketProcessor<EntityBoostSwitchPacket> | ||
{ | ||
public override void ProcessPacket(EntityBoostSwitchPacket packet, NebulaConnection conn) | ||
{ | ||
PlanetFactory factory = GameMain.galaxy.PlanetById(packet.PlanetId)?.factory; | ||
if (factory == null) | ||
{ | ||
return; | ||
} | ||
|
||
switch (packet.EntityType) | ||
{ | ||
case EBoostEntityType.ArtificialStar: | ||
if (packet.Id < factory.powerSystem.genCursor) | ||
{ | ||
factory.powerSystem.genPool[packet.Id].SetBoost(packet.Enable); | ||
if (UIRoot.instance.uiGame.generatorWindow.generatorId == packet.Id) | ||
{ | ||
UIRoot.instance.uiGame.generatorWindow.boostSwitch.SetImmediately(packet.Enable); | ||
} | ||
} | ||
break; | ||
|
||
case EBoostEntityType.Ejector: | ||
if (packet.Id < factory.factorySystem.ejectorCursor) | ||
{ | ||
factory.factorySystem.ejectorPool[packet.Id].SetBoost(packet.Enable); | ||
if (UIRoot.instance.uiGame.ejectorWindow.ejectorId == packet.Id) | ||
{ | ||
UIRoot.instance.uiGame.ejectorWindow.boostSwitch.SetImmediately(packet.Enable); | ||
} | ||
} | ||
break; | ||
|
||
case EBoostEntityType.Silo: | ||
if (packet.Id < factory.factorySystem.siloCursor) | ||
{ | ||
factory.factorySystem.siloPool[packet.Id].SetBoost(packet.Enable); | ||
if (UIRoot.instance.uiGame.siloWindow.siloId == packet.Id) | ||
{ | ||
UIRoot.instance.uiGame.siloWindow.boostSwitch.SetImmediately(packet.Enable); | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
NebulaNetwork/PacketProcessors/Factory/Foundation/FoundationBuildUpdateProcessor.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
42 changes: 42 additions & 0 deletions
42
NebulaNetwork/PacketProcessors/Factory/Foundation/PlanetReformProcessor.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,42 @@ | ||
using NebulaAPI; | ||
using NebulaModel.Networking; | ||
using NebulaModel.Packets; | ||
using NebulaModel.Packets.Factory.Foundation; | ||
using NebulaWorld; | ||
|
||
namespace NebulaNetwork.PacketProcessors.Factory.Foundation | ||
{ | ||
[RegisterPacketProcessor] | ||
internal class PlanetReformProcessor : PacketProcessor<PlanetReformPacket> | ||
{ | ||
public override void ProcessPacket(PlanetReformPacket packet, NebulaConnection conn) | ||
{ | ||
using (Multiplayer.Session.Planets.IsIncomingRequest.On()) | ||
{ | ||
PlanetData planet = GameMain.galaxy.PlanetById(packet.PlanetId); | ||
if (planet?.factory == null) | ||
{ | ||
return; | ||
} | ||
Multiplayer.Session.Factories.TargetPlanet = packet.PlanetId; | ||
Multiplayer.Session.Factories.AddPlanetTimer(packet.PlanetId); | ||
PlanetData pData = GameMain.gpuiManager.specifyPlanet; | ||
GameMain.gpuiManager.specifyPlanet = planet; | ||
|
||
if (packet.IsReform) | ||
{ | ||
// Reform whole planet | ||
planet.factory.PlanetReformAll(packet.Type, packet.Color, packet.Bury); | ||
} | ||
else | ||
{ | ||
// Revert whole planet | ||
planet.factory.PlanetReformRevert(); | ||
} | ||
|
||
GameMain.gpuiManager.specifyPlanet = pData; | ||
Multiplayer.Session.Factories.TargetPlanet = NebulaModAPI.PLANET_NONE; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.