From be20f761e44c2093d4f1b1e470150d22faab3785 Mon Sep 17 00:00:00 2001 From: Aristeas <94058548+Jnick-24@users.noreply.github.com> Date: Fri, 16 Feb 2024 22:24:33 -0600 Subject: [PATCH] a --- .../ProjectileNetworking.cs | 62 +++++++++++++++++++ .../n_SerializableProjectileInfo.cs | 9 ++- 2 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/ProjectileNetworking.cs diff --git a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/ProjectileNetworking.cs b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/ProjectileNetworking.cs new file mode 100644 index 00000000..0bc06b18 --- /dev/null +++ b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/ProjectileNetworking.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VRage.Game.ModAPI; +using YourName.ModName.Data.Scripts.HeartModule.Weapons.Setup.Adding; + +namespace Heart_Module.Data.Scripts.HeartModule.Projectiles.ProjectileNetworking +{ + public class ProjectileNetworking + { + const int ProjectilesPerPacket = 50; + const int TicksPerPacket = 4; + + private Dictionary> SyncStream_PP = new Dictionary>(); + private Dictionary> SyncStream_FireEvent = new Dictionary>(); + + public void QueueSync_PP(Projectile projectile) + { + QueueSync_PP(null, projectile); + } + + public void QueueSync_PP(IMyPlayer player, Projectile projectile) + { + + } + + public void QueueSync_FireEvent(SorterWeaponLogic weapon, Projectile projectile) + { + QueueSync_FireEvent(null, weapon, projectile); + } + + public void QueueSync_FireEvent(IMyPlayer player, SorterWeaponLogic weapon, Projectile projectile) + { + + } + + + int ticks = 0; + public void Update1() + { + ticks++; + if (ticks % TicksPerPacket != 0) + return; + + // Iterate through SyncStreams based on projectilesperpacket + // you will need a way to combine all the projectiles into one packet + // this will not work without many edits sorry + } + + public void Init() + { + // Called from ProjectileManager, this class will be a variable inside it (like a weapon's magazines) + } + + public void Close() + { + // maybe??? + } + } +} diff --git a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/n_SerializableProjectileInfo.cs b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/n_SerializableProjectileInfo.cs index 09d52bd6..6af2f300 100644 --- a/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/n_SerializableProjectileInfo.cs +++ b/Orrery Combat Framework - Heart Module/Data/Scripts/HeartModule/Projectiles/ProjectileNetworking/n_SerializableProjectileInfo.cs @@ -1,4 +1,5 @@ -using ProtoBuf; +using Heart_Module.Data.Scripts.HeartModule.Network; +using ProtoBuf; using System; using System.Collections.Generic; using System.Linq; @@ -9,8 +10,10 @@ namespace Heart_Module.Data.Scripts.HeartModule.Projectiles.ProjectileNetworking { + // TODO: Make these implement packetbase stuff + [ProtoContract] - internal class n_SerializableProjectileInfo + internal class n_SerializableProjectileInfo : PacketBase { public n_SerializableProjectileInfo() { } @@ -51,7 +54,7 @@ public n_SerializableProjectileInfo(uint uniqueProjectileId, Vector3 positionRel } [ProtoContract] - internal class n_SerializableFireEvent + internal class n_SerializableFireEvent : PacketBase { public n_SerializableFireEvent() { }