Skip to content

Commit

Permalink
Merge pull request #652 from NebulaModTeam/0.10.x-combat
Browse files Browse the repository at this point in the history
Combat - Basic syncing
  • Loading branch information
starfi5h authored Mar 9, 2024
2 parents ae8e7af + cb62d9d commit 94cb2bc
Show file tree
Hide file tree
Showing 152 changed files with 7,003 additions and 526 deletions.
13 changes: 13 additions & 0 deletions NebulaModel/Packets/Combat/DFHive/DFHiveClosePreviewPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace NebulaModel.Packets.Combat.DFHive;

public class DFHiveClosePreviewPacket
{
public DFHiveClosePreviewPacket() { }

public DFHiveClosePreviewPacket(EnemyDFHiveSystem hive)
{
HiveAstroId = hive.hiveAstroId;
}

public int HiveAstroId { get; set; }
}
13 changes: 13 additions & 0 deletions NebulaModel/Packets/Combat/DFHive/DFHiveCreateNewHivePacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace NebulaModel.Packets.Combat.DFHive;

public class DFHiveCreateNewHivePacket
{
public DFHiveCreateNewHivePacket() { }

public DFHiveCreateNewHivePacket(int starId)
{
StarId = starId;
}

public int StarId { get; set; }
}
29 changes: 29 additions & 0 deletions NebulaModel/Packets/Combat/DFHive/DFHiveOpenPreviewPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;

namespace NebulaModel.Packets.Combat.DFHive;

public class DFHiveOpenPreviewPacket
{
public DFHiveOpenPreviewPacket() { }

public DFHiveOpenPreviewPacket(EnemyDFHiveSystem hive, bool sendRecycle)
{
HiveAstroId = hive.hiveAstroId;

if (sendRecycle)
{
EnemyCursor = hive.sector.enemyCursor;
EnemyRecycle = new int[hive.sector.enemyRecycleCursor];
Array.Copy(hive.sector.enemyRecycle, EnemyRecycle, EnemyRecycle.Length);
}
else
{
EnemyCursor = -1;
EnemyRecycle = [];
}
}

public int HiveAstroId { get; set; }
public int EnemyCursor { get; set; }
public int[] EnemyRecycle { get; set; }
}
13 changes: 13 additions & 0 deletions NebulaModel/Packets/Combat/DFHive/DFHiveRealizePacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace NebulaModel.Packets.Combat.DFHive;

public class DFHiveRealizePacket
{
public DFHiveRealizePacket() { }

public DFHiveRealizePacket(int hiveAstroId)
{
HiveAstroId = hiveAstroId;
}

public int HiveAstroId { get; set; }
}
19 changes: 19 additions & 0 deletions NebulaModel/Packets/Combat/DFHive/DFHiveUnderAttackRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using NebulaAPI.DataStructures;

namespace NebulaModel.Packets.Combat.DFHive;

public class DFHiveUnderAttackRequest
{
public DFHiveUnderAttackRequest() { }

public DFHiveUnderAttackRequest(int hiveAstroId, ref VectorLF3 centerUPos, float radius)
{
HiveAstroId = hiveAstroId;
CenterUPos = new Float3((float)centerUPos.x, (float)centerUPos.y, (float)centerUPos.z);
Radius = radius;
}

public int HiveAstroId { get; set; }
public Float3 CenterUPos { get; set; }
public float Radius { get; set; }
}
31 changes: 31 additions & 0 deletions NebulaModel/Packets/Combat/DFHive/DFHiveUpdateStatusPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace NebulaModel.Packets.Combat.DFHive;

public class DFHiveUpdateStatusPacket
{
public DFHiveUpdateStatusPacket() { }

public DFHiveUpdateStatusPacket(in EnemyDFHiveSystem hive)
{
HiveAstroId = hive.hiveAstroId;
ref var evolveData = ref hive.evolve;
Threat = evolveData.threat;
Level = evolveData.level;
Expl = evolveData.expl;
Expf = evolveData.expf;
}

public void Record(in EnemyDFHiveSystem hive)
{
ref var evolveData = ref hive.evolve;
Threat = evolveData.threat;
Level = evolveData.level;
Expl = evolveData.expl;
Expf = evolveData.expf;
}

public int HiveAstroId { get; set; }
public int Threat { get; set; }
public int Level { get; set; }
public int Expl { get; set; }
public int Expf { get; set; }
}
17 changes: 17 additions & 0 deletions NebulaModel/Packets/Combat/DFRelay/DFRelayArriveBasePacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace NebulaModel.Packets.Combat.DFRelay;

public class DFRelayArriveBasePacket
{
public DFRelayArriveBasePacket() { }

public DFRelayArriveBasePacket(in DFRelayComponent dFRelay)
{
HiveAstroId = dFRelay.hiveAstroId;
RelayId = dFRelay.id;
HiveRtseed = dFRelay.hive.rtseed;
}

public int HiveAstroId { get; set; }
public int RelayId { get; set; }
public int HiveRtseed { get; set; }
}
15 changes: 15 additions & 0 deletions NebulaModel/Packets/Combat/DFRelay/DFRelayArriveDockPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace NebulaModel.Packets.Combat.DFRelay;

public class DFRelayArriveDockPacket
{
public DFRelayArriveDockPacket() { }

public DFRelayArriveDockPacket(in DFRelayComponent dFRelay)
{
HiveAstroId = dFRelay.hiveAstroId;
RelayId = dFRelay.id;
}

public int HiveAstroId { get; set; }
public int RelayId { get; set; }
}
17 changes: 17 additions & 0 deletions NebulaModel/Packets/Combat/DFRelay/DFRelayLeaveBasePacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace NebulaModel.Packets.Combat.DFRelay;

public class DFRelayLeaveBasePacket
{
public DFRelayLeaveBasePacket() { }

public DFRelayLeaveBasePacket(in DFRelayComponent dFRelay)
{
HiveAstroId = dFRelay.hiveAstroId;
RelayId = dFRelay.id;
RelayNeutralizedCounter = dFRelay.hive.relayNeutralizedCounter;
}

public int HiveAstroId { get; set; }
public int RelayId { get; set; }
public int RelayNeutralizedCounter { get; set; }
}
27 changes: 27 additions & 0 deletions NebulaModel/Packets/Combat/DFRelay/DFRelayLeaveDockPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using NebulaAPI.DataStructures;

namespace NebulaModel.Packets.Combat.DFRelay;

public class DFRelayLeaveDockPacket
{
public DFRelayLeaveDockPacket() { }

public DFRelayLeaveDockPacket(in DFRelayComponent dFRelay)
{
HiveAstroId = dFRelay.hiveAstroId;
RelayId = dFRelay.id;
TargetAstroId = dFRelay.targetAstroId;
BaseId = dFRelay.baseId;
TargetLPos = dFRelay.targetLPos.ToFloat3();
TargetYaw = dFRelay.targetYaw;
BaseState = dFRelay.baseState;
}

public int HiveAstroId { get; set; }
public int RelayId { get; set; }
public int TargetAstroId { get; set; }
public int BaseId { get; set; }
public Float3 TargetLPos { get; set; }
public float TargetYaw { get; set; }
public float BaseState { get; set; }
}
17 changes: 17 additions & 0 deletions NebulaModel/Packets/Combat/DFTinder/DFTinderDispatchPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace NebulaModel.Packets.Combat.DFTinder;

public class DFTinderDispatchPacket
{
public DFTinderDispatchPacket() { }

public DFTinderDispatchPacket(in DFTinderComponent dFTinder)
{
OriginHiveAstroId = dFTinder.originHiveAstroId;
TargetHiveAstroId = dFTinder.targetHiveAstroId;
TinderId = dFTinder.id;
}

public int OriginHiveAstroId { get; set; }
public int TargetHiveAstroId { get; set; }
public int TinderId { get; set; }
}
17 changes: 17 additions & 0 deletions NebulaModel/Packets/Combat/GroundEnemy/DFGActivateBasePacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace NebulaModel.Packets.Combat.GroundEnemy;

public class DFGActivateBasePacket
{
public DFGActivateBasePacket() { }

public DFGActivateBasePacket(int planetId, int baseId, bool setToSeekForm)
{
PlanetId = planetId;
BaseId = baseId;
SetToSeekForm = setToSeekForm;
}

public int PlanetId { get; set; }
public int BaseId { get; set; }
public bool SetToSeekForm { get; set; }
}
25 changes: 25 additions & 0 deletions NebulaModel/Packets/Combat/GroundEnemy/DFGActivateUnitPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace NebulaModel.Packets.Combat.GroundEnemy;

public class DFGActivateUnitPacket
{
public DFGActivateUnitPacket() { }

public DFGActivateUnitPacket(int planetId, int baseId, int formId, int portId, EEnemyBehavior behavior, int stateTick, int enemyId)
{
PlanetId = planetId;
BaseId = (ushort)baseId;
FormId = (byte)formId; // current max: 2
PortId = (ushort)portId; // current max: 1440
Behavior = (byte)behavior;
StateTick = (short)stateTick; // current max: 120
EnemyId = enemyId;
}

public int PlanetId { get; set; }
public ushort BaseId { get; set; }
public byte FormId { get; set; }
public ushort PortId { get; set; }
public byte Behavior { get; set; }
public short StateTick { get; set; }
public int EnemyId { get; set; }
}
15 changes: 15 additions & 0 deletions NebulaModel/Packets/Combat/GroundEnemy/DFGDeactivateUnitPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace NebulaModel.Packets.Combat.GroundEnemy;

public class DFGDeactivateUnitPacket
{
public DFGDeactivateUnitPacket() { }

public DFGDeactivateUnitPacket(int planetId, int enemyId)
{
PlanetId = planetId;
EnemyId = enemyId;
}

public int PlanetId { get; set; }
public int EnemyId { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace NebulaModel.Packets.Combat.GroundEnemy;

public class DFGDeferredCreateEnemyPacket
{
public DFGDeferredCreateEnemyPacket() { }

public DFGDeferredCreateEnemyPacket(int planetId, int baseId, int builderIndex, int enemyId)
{
PlanetId = planetId;
BaseId = baseId;
BuilderIndex = builderIndex;
EnemyId = enemyId;
}

public int PlanetId { get; set; }
public int BaseId { get; set; }
public int BuilderIndex { get; set; }
public int EnemyId { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace NebulaModel.Packets.Combat.GroundEnemy;

public class DFGDeferredRemoveEnemyPacket
{
public DFGDeferredRemoveEnemyPacket() { }

public DFGDeferredRemoveEnemyPacket(int planetId, int enemyId)
{
PlanetId = planetId;
EnemyId = enemyId;
}

public int PlanetId { get; set; }
public int EnemyId { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace NebulaModel.Packets.Combat.GroundEnemy;

public class DFGFormationAddUnitPacket
{
public DFGFormationAddUnitPacket() { }

public DFGFormationAddUnitPacket(int planetId, int baseId, int formId, int portId)
{
PlanetId = planetId;
BaseId = baseId;
FormId = (byte)formId;
PortId = (ushort)portId;
}

public int PlanetId { get; set; }
public int BaseId { get; set; }
public byte FormId { get; set; }
public ushort PortId { get; set; }
}
15 changes: 15 additions & 0 deletions NebulaModel/Packets/Combat/GroundEnemy/DFGKillEnemyPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace NebulaModel.Packets.Combat.GroundEnemy;

public class DFGKillEnemyPacket
{
public DFGKillEnemyPacket() { }

public DFGKillEnemyPacket(int planetId, int enemyId)
{
PlanetId = planetId;
EnemyId = enemyId;
}

public int PlanetId { get; set; }
public int EnemyId { get; set; }
}
43 changes: 43 additions & 0 deletions NebulaModel/Packets/Combat/GroundEnemy/DFGLaunchAssaultPacket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using NebulaAPI.DataStructures;
using UnityEngine;

namespace NebulaModel.Packets.Combat.GroundEnemy;

public class DFGLaunchAssaultPacket
{
public DFGLaunchAssaultPacket() { }

public DFGLaunchAssaultPacket(in DFGBaseComponent dFGBase,
in Vector3 tarPos, float expandRadius, int unitCount0, int unitCount1, int ap0, int ap1, int unitThreat)
{
PlanetId = dFGBase.groundSystem.planet.id;
BaseId = dFGBase.id;
EvolveThreat = dFGBase.evolve.threat;
TarPos = tarPos.ToFloat3();
ExpandRadius = expandRadius;
UnitCount0 = unitCount0;
UnitCount1 = unitCount1;
Ap0 = ap0;
Ap1 = ap1;
UnitThreat = unitThreat;

var factory = dFGBase.groundSystem.factory;
EnemyCursor = factory.enemyCursor;
EnemyRecyle = new int[factory.enemyRecycleCursor];
Array.Copy(factory.enemyRecycle, EnemyRecyle, EnemyRecyle.Length);
}

public int PlanetId { get; set; }
public int BaseId { get; set; }
public int EvolveThreat { get; set; }
public Float3 TarPos { get; set; }
public float ExpandRadius { get; set; }
public int UnitCount0 { get; set; }
public int UnitCount1 { get; set; }
public int Ap0 { get; set; }
public int Ap1 { get; set; }
public int UnitThreat { get; set; }
public int EnemyCursor { get; set; }
public int[] EnemyRecyle { get; set; }
}
Loading

0 comments on commit 94cb2bc

Please sign in to comment.