Skip to content

Commit

Permalink
Merge pull request #616 from NebulaModTeam/0.10.x
Browse files Browse the repository at this point in the history
0.10.x Update WIP
  • Loading branch information
starfi5h authored Jan 10, 2024
2 parents efda4d8 + da43219 commit f2f4bcb
Show file tree
Hide file tree
Showing 149 changed files with 135,430 additions and 18,841 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
## Changelog

0.9.0:
- Now compatible with Dark Fog (DSP 0.10.x) with enemies disabled
- @phantomgamers: fix compilation after update and overall fixes/cleanup
- @phantomgamers: fix UIVirtualStarmap patches
- @phantomgamers: reviewing code from other contributers
- @starfi5h: fix runtime issues after the update and overall fixes/cleanup
- @starfi5h: improve UI and Keybinding
- @starfi5h: rework Wireless Power Tower syncing
- @starfi5h: add syncing for Battlefield Analysis Base
- @mmjr: disable dark fog switch in lobby and prevent df enabled saves to be loaded.
- @ajh16: sync dark fog lobby settings
- @highrizk: sync storage filters
- @highrizk: update serializer and fix broken packets
- @highrizk: add serialization support and unit tests for dictionaries
- @zzarek: add turret UI syncing
- @sp00ktober: add syncing for new mecha settings and features
- @sp00ktober: sync mecha and battle base construction drones
- @sp00ktober: overall NRE fixes

0.8.14:
- @starfi5h: Fix mecha animation when player count > 2
- @starfi5h: Fix UIPerformance save test in multiplayer
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<OutputPath Condition="Exists('$(DSPGameDir)') Or Exists('$(PropSheetPath).remoteBuild')">$(PluginOutputDirectory)</OutputPath>
<OutputPath Condition="(Exists('$(DSPGameDir)') Or Exists('$(PropSheetPath).remoteBuild')) AND '$(MSBuildProjectName)' != 'NebulaTests' ">$(PluginOutputDirectory)</OutputPath>
<TargetFramework>net472</TargetFramework>
<LangVersion>latest</LangVersion>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
Expand Down
6 changes: 6 additions & 0 deletions Nebula.sln
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NebulaAPI", "NebulaAPI\Nebu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "discord_game_sdk_dotnet", "dep\discord_game_sdk\discord_game_sdk_dotnet.csproj", "{E691A758-2D19-47EF-9410-3C78D99E2488}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NebulaTests", "NebulaTests\NebulaTests.csproj", "{2F4901A9-8BDB-49A7-AD89-9E38B0B3350A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -61,6 +63,10 @@ Global
{E691A758-2D19-47EF-9410-3C78D99E2488}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E691A758-2D19-47EF-9410-3C78D99E2488}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E691A758-2D19-47EF-9410-3C78D99E2488}.Release|Any CPU.Build.0 = Release|Any CPU
{2F4901A9-8BDB-49A7-AD89-9E38B0B3350A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F4901A9-8BDB-49A7-AD89-9E38B0B3350A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F4901A9-8BDB-49A7-AD89-9E38B0B3350A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F4901A9-8BDB-49A7-AD89-9E38B0B3350A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
6 changes: 5 additions & 1 deletion NebulaAPI/DataStructures/IMechaData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ namespace NebulaAPI.DataStructures;

public interface IMechaData : INetSerializable
{
int SandCount { get; set; }
long SandCount { get; set; }
double CoreEnergy { get; set; }
double ReactorEnergy { get; set; }
StorageComponent Inventory { get; set; }
DeliveryPackage DeliveryPackage { get; set; }
StorageComponent ReactorStorage { get; set; }
StorageComponent WarpStorage { get; set; }
MechaForge Forge { get; set; }
ConstructionModuleComponent ConstructionModule { get; set; }
IMechaFightData FightData { get; set; }

public void UpdateMech(Player destination);
}
36 changes: 36 additions & 0 deletions NebulaAPI/DataStructures/IMechaFightData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using NebulaAPI.Interfaces;

namespace NebulaAPI.DataStructures
{
public interface IMechaFightData
{
// TODO: what about spaceSector? Will it be synced in dynamically? Or should it be stored?
bool AutoReplenishFuel { get; set; }
bool AutoReplenishAmmo { get; set; }
bool AutoReplenishHangar { get; set; }
int Hp { get; set; }
long EnergyShieldEnergy { get; set; }
int AmmoItemId { get; set; }
int AmmoInc { get; set; }
int AmmoBulletCount { get; set; }
int AmmoSelectSlot { get; set; }
int AmmoMuzzleFire { get; set; }
int AmmoRoundFire { get; set; }
int AmmoMuzzleIndex { get; set; }
bool LaserActive { get; set; }
bool LaserRecharging { get; set; }
long LaserEnergy { get; set; }
int LaserFire { get; set; }
int BombFire { get; set; }
StorageComponent AmmoStorage { get; set; }
StorageComponent BombStorage { get; set; }
EnemyHatredTarget AmmoHatredTarget { get; set; }
EnemyHatredTarget LaserHatredTarget { get; set; }
StorageComponent FighterStorage { get; set; }
CombatModuleComponent GroundCombatModule { get; set; }
CombatModuleComponent SpaceCombatModule { get; set; }
public void Serialize(INetDataWriter writer);
public void Deserialize(INetDataReader reader);
public void UpdateMech(Player destination);
}
}
16 changes: 14 additions & 2 deletions NebulaAPI/DataStructures/IPlayerTechBonuses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,22 @@ public interface IPlayerTechBonuses : INetSerializable
float maxWarpSpeed { get; set; }
float buildArea { get; set; }
int droneCount { get; set; }
float droneSpeed { get; set; }
int droneMovement { get; set; }
int inventorySize { get; set; }
bool deliveryPackageUnlocked { get; set; }
int deliveryPackageColCount { get; set; }
int deliveryPackageStackSizeMultiplier { get; set; }
double instantBuildEnergy { get; set; }
int hpMaxUpgrade { get; set; }
bool energyShieldUnlocked { get; set; }
float energyShieldRadius { get; set; }
long energyShieldCapacity { get; set; }
long laserEnergyCapacity { get; set; }
float laserLocalAttackRange { get; set; }
float laserSpaceAttackRange { get; set; }
int laserLocalEnergyCost { get; set; }
int laserSpaceEnergyCost { get; set; }
int laserLocalDamage { get; set; }
int laserSpaceDamage { get; set; }
int groundFleetCount { get; set; }
int spaceFleetCount { get; set; }
}
4 changes: 0 additions & 4 deletions NebulaAPI/GameState/IFactoryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,4 @@ public interface IFactoryManager : IDisposable
int GetNextPrebuildId(int planetId);

int GetNextPrebuildId(PlanetFactory factory);

void OnNewSetInserterPickTarget(int objId, int otherObjId, int inserterId, int offset, Vector3 pointPos);

void OnNewSetInserterInsertTarget(int objId, int otherObjId, int inserterId, int offset, Vector3 pointPos);
}
151 changes: 151 additions & 0 deletions NebulaAPI/Interfaces/INetDataReader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
// #pragma once
// #ifndef INetDataReader.cs_H_
// #define INetDataReader.cs_H_
//
// #endif

using System;
using System.Net;
using System.Runtime.CompilerServices;

namespace NebulaAPI.Interfaces;

public interface INetDataReader
{
byte[] RawData
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
}

int RawDataSize
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
}

int UserDataOffset
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
}

int UserDataSize
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
}

bool IsNull
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
}

int Position
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
}

bool EndOfData
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
}

int AvailableBytes
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
}

void SkipBytes(int count);
void SetPosition(int position);
void SetSource(INetDataWriter dataWriter);
void SetSource(byte[] source);
void SetSource(byte[] source, int offset, int maxSize);
IPEndPoint GetNetEndPoint();
byte GetByte();
sbyte GetSByte();
T[] GetArray<T>(int size);
bool[] GetBoolArray();
ushort[] GetUShortArray();
short[] GetShortArray();
int[] GetIntArray();
uint[] GetUIntArray();
float[] GetFloatArray();
double[] GetDoubleArray();
long[] GetLongArray();
ulong[] GetULongArray();
string[] GetStringArray();

/// <summary>
/// Note that "maxStringLength" only limits the number of characters in a string, not its size in bytes.
/// Strings that exceed this parameter are returned as empty
/// </summary>
string[] GetStringArray(int maxStringLength);

bool GetBool();
char GetChar();
ushort GetUShort();
short GetShort();
long GetLong();
ulong GetULong();
int GetInt();
uint GetUInt();
float GetFloat();
double GetDouble();

/// <summary>
/// Note that "maxLength" only limits the number of characters in a string, not its size in bytes.
/// </summary>
/// <returns>"string.Empty" if value > "maxLength"</returns>
string GetString(int maxLength);

string GetString();
ArraySegment<byte> GetBytesSegment(int count);
ArraySegment<byte> GetRemainingBytesSegment();
T Get<T>() where T : struct, INetSerializable;
T Get<T>(Func<T> constructor) where T : class, INetSerializable;
byte[] GetRemainingBytes();
void GetBytes(byte[] destination, int start, int count);
void GetBytes(byte[] destination, int count);
sbyte[] GetSBytesWithLength();
byte[] GetBytesWithLength();
byte PeekByte();
sbyte PeekSByte();
bool PeekBool();
char PeekChar();
ushort PeekUShort();
short PeekShort();
long PeekLong();
ulong PeekULong();
int PeekInt();
uint PeekUInt();
float PeekFloat();
double PeekDouble();

/// <summary>
/// Note that "maxLength" only limits the number of characters in a string, not its size in bytes.
/// </summary>
string PeekString(int maxLength);

string PeekString();
bool TryGetByte(out byte result);
bool TryGetSByte(out sbyte result);
bool TryGetBool(out bool result);
bool TryGetChar(out char result);
bool TryGetShort(out short result);
bool TryGetUShort(out ushort result);
bool TryGetInt(out int result);
bool TryGetUInt(out uint result);
bool TryGetLong(out long result);
bool TryGetULong(out ulong result);
bool TryGetFloat(out float result);
bool TryGetDouble(out double result);
bool TryGetString(out string result);
bool TryGetStringArray(out string[] result);
bool TryGetBytesWithLength(out byte[] result);
void Clear();
}
85 changes: 85 additions & 0 deletions NebulaAPI/Interfaces/INetDataWriter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// #pragma once
// #ifndef INetDataWriter.cs_H_
// #define INetDataWriter.cs_H_
//
// #endif

using System;
using System.Net;
using System.Runtime.CompilerServices;

namespace NebulaAPI.Interfaces;

public interface INetDataWriter
{
int Capacity
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
}

byte[] Data
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
}

int Length
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
}

void ResizeIfNeed(int newSize);
void EnsureFit(int additionalSize);
void Reset(int size);
void Reset();
byte[] CopyData();

/// <summary>
/// Sets position of NetDataWriter to rewrite previous values
/// </summary>
/// <param name="position">new byte position</param>
/// <returns>previous position of data writer</returns>
int SetPosition(int position);

void Put(float value);
void Put(double value);
void Put(long value);
void Put(ulong value);
void Put(int value);
void Put(uint value);
void Put(char value);
void Put(ushort value);
void Put(short value);
void Put(sbyte value);
void Put(byte value);
void Put(byte[] data, int offset, int length);
void Put(byte[] data);
void Put(bool value);
void Put(IPEndPoint endPoint);
void Put(string value);

/// <summary>
/// Note that "maxLength" only limits the number of characters in a string, not its size in bytes.
/// </summary>
void Put(string value, int maxLength);

void Put<T>(T obj) where T : INetSerializable;
void PutSBytesWithLength(sbyte[] data, int offset, int length);
void PutSBytesWithLength(sbyte[] data);
void PutBytesWithLength(byte[] data, int offset, int length);
void PutBytesWithLength(byte[] data);
void PutArray(Array arr, int sz);
void PutArray(float[] value);
void PutArray(double[] value);
void PutArray(long[] value);
void PutArray(ulong[] value);
void PutArray(int[] value);
void PutArray(uint[] value);
void PutArray(ushort[] value);
void PutArray(short[] value);
void PutArray(bool[] value);
void PutArray(string[] value);
void PutArray(string[] value, int strMaxLength);
}
Loading

0 comments on commit f2f4bcb

Please sign in to comment.