Skip to content

Commit

Permalink
Logging?
Browse files Browse the repository at this point in the history
  • Loading branch information
ari-steas committed Feb 23, 2024
1 parent 1918e07 commit 1df4922
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,26 +190,30 @@ public void Update1()

private void SyncPlayerProjectiles(IMyPlayer player)
{
if (player.Character == null) // TODO: Proper handling for spectator
return;

if (!SyncStream_PP.ContainsKey(player.SteamUserId)) // Avoid breaking if the player somehow hasn't been added
// TODO: Distance based syncing.
if (player.Character != null) // TODO: Proper handling for spectator
{
SoftHandle.RaiseSyncException("Player " + player.DisplayName + " is missing projectile sync queue!");
return;
}
if (!SyncStream_PP.ContainsKey(player.SteamUserId)) // Avoid breaking if the player somehow hasn't been added
{
SoftHandle.RaiseSyncException("Player " + player.DisplayName + " is missing projectile sync queue!");
return;
}

// Full Projectile Packets
List<Projectile> PPProjectiles = new List<Projectile>();
for (int i = 0; SyncStream_PP[player.SteamUserId].Count > 0 && i < ProjectilesPerPacket; i++) // Add up to (n) projectiles to the queue
PPProjectiles.Add(SyncStream_PP[player.SteamUserId].Dequeue());
// Full Projectile Packets
List<Projectile> PPProjectiles = new List<Projectile>();
for (int i = 0; SyncStream_PP[player.SteamUserId].Count > 0 && i < ProjectilesPerPacket; i++) // Add up to (n) projectiles to the queue
PPProjectiles.Add(SyncStream_PP[player.SteamUserId].Dequeue());

if (PPProjectiles.Count > 0)
{
n_SerializableProjectileInfos ppInfos = new n_SerializableProjectileInfos(PPProjectiles, player.Character);
HeartData.I.Net.SendToPlayer(ppInfos, player.SteamUserId);
if (PPProjectiles.Count > 0)
{
n_SerializableProjectileInfos ppInfos = new n_SerializableProjectileInfos(PPProjectiles, player.Character);
HeartData.I.Net.SendToPlayer(ppInfos, player.SteamUserId);
}
}

if (SyncStream_FireEvent[player.SteamUserId].Count > 0)
HeartData.I.Log.Log("FESync: " + SyncStream_FireEvent[player.SteamUserId].Count);

// FireEvent packets (these are smaller but less precise)
List<Projectile> FEProjectiles = new List<Projectile>();
for (int i = 0; SyncStream_FireEvent[player.SteamUserId].Count > 0 && i < ProjectilesPerPacket; i++) // Add up to (n) projectiles to the queue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ public Vector3 Direction(int index)

public Projectile ToProjectile(int index)
{
MyAPIGateway.Utilities.ShowNotification("I'M A REAL BOY NOW");

SorterWeaponLogic weapon = WeaponManager.I.GetWeapon(FirerEntityId[index]);

Projectile p = new Projectile(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public partial class SorterWeaponLogic : MyGameLogicComponent

public MySync<bool, SyncDirection.BothWays> ShootState; //temporary (lmao) magic bullshit in place of actual packet sending
//insert ammo loaded state here (how the hell are we gonna do that)
public MySync<long, SyncDirection.BothWays> AmmoLoadedState; //dang this mysync thing is pretty cool it will surely not bite me in the ass when I need over 32 entries
public MySync<long, SyncDirection.BothWays> ControlTypeState;
public MySync<bool, SyncDirection.BothWays> HudBarrelIndicatorState;
public MySync<long, SyncDirection.BothWays> AmmoLoadedState = null; //dang this mysync thing is pretty cool it will surely not bite me in the ass when I need over 32 entries
public MySync<long, SyncDirection.BothWays> ControlTypeState = null;
public MySync<bool, SyncDirection.BothWays> HudBarrelIndicatorState = null;

public readonly Heart_Settings Settings = new Heart_Settings();

Expand Down

0 comments on commit 1df4922

Please sign in to comment.