diff --git a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/ProjectileNetwork.cs b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/ProjectileNetwork.cs index 2cdbc99b..0d2402b7 100644 --- a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/ProjectileNetwork.cs +++ b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/ProjectileNetwork.cs @@ -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 PPProjectiles = new List(); - 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 PPProjectiles = new List(); + 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 FEProjectiles = new List(); for (int i = 0; SyncStream_FireEvent[player.SteamUserId].Count > 0 && i < ProjectilesPerPacket; i++) // Add up to (n) projectiles to the queue diff --git a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/n_SerializableProjectileInfos.cs b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/n_SerializableProjectileInfos.cs index cf48ca04..fb1507f1 100644 --- a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/n_SerializableProjectileInfos.cs +++ b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/n_SerializableProjectileInfos.cs @@ -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( diff --git a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs index 850781f4..670ff3c9 100644 --- a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs +++ b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs @@ -34,9 +34,9 @@ public partial class SorterWeaponLogic : MyGameLogicComponent public MySync 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 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 ControlTypeState; - public MySync HudBarrelIndicatorState; + public MySync 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 ControlTypeState = null; + public MySync HudBarrelIndicatorState = null; public readonly Heart_Settings Settings = new Heart_Settings();