Skip to content

Commit

Permalink
so sorry again (more logging)
Browse files Browse the repository at this point in the history
  • Loading branch information
ari-steas committed Feb 23, 2024
1 parent 1df4922 commit ac130f9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,6 @@ private void SyncPlayerProjectiles(IMyPlayer player)
}
}

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
@@ -1,4 +1,5 @@
using Heart_Module.Data.Scripts.HeartModule.Network;
using Heart_Module.Data.Scripts.HeartModule.ErrorHandler;
using Heart_Module.Data.Scripts.HeartModule.Network;
using Heart_Module.Data.Scripts.HeartModule.Weapons;
using Heart_Module.Data.Scripts.HeartModule.Weapons.AiTargeting;
using ProtoBuf;
Expand Down Expand Up @@ -269,20 +270,27 @@ public Vector3 Direction(int index)

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

HeartData.I.Log.Log("1");
SorterWeaponLogic weapon = WeaponManager.I.GetWeapon(FirerEntityId[index]);
HeartData.I.Log.Log("2");

if (weapon == null)
{
SoftHandle.RaiseSyncException("Attempted to call FireEvent for a weapon that doesn't exist!");
return null;
}

Projectile p = new Projectile(
weapon.Magazines.SelectedAmmo,
weapon.MuzzleMatrix.Translation,
Direction(index),
FirerEntityId[index],
((IMyCubeBlock)MyAPIGateway.Entities.GetEntityById(FirerEntityId[index]))?.CubeGrid.LinearVelocity ?? Vector3D.Zero
weapon?.SorterWep?.CubeGrid.LinearVelocity ?? Vector3D.Zero
)
{
LastUpdate = DateTime.Now.Date.AddMilliseconds(MillisecondsFromMidnight).Ticks
};
HeartData.I.Log.Log("3");

if (p.Guidance != null) // Assign target for self-guided projectiles
{
Expand All @@ -292,9 +300,15 @@ public Projectile ToProjectile(int index)
p.Guidance.SetTarget(WeaponManagerAi.I.GetTargeting(weapon.SorterWep.CubeGrid)?.PrimaryGridTarget);
}

HeartData.I.Log.Log("4");


float delta = (DateTime.Now.Ticks - p.LastUpdate) / (float)TimeSpan.TicksPerSecond;
p.TickUpdate(delta);

HeartData.I.Log.Log("5");


return p;
}

Expand Down

0 comments on commit ac130f9

Please sign in to comment.