Skip to content

Commit

Permalink
Merge pull request StarCoreSE#150 from Jnick-24/Projectile-Guidance
Browse files Browse the repository at this point in the history
framework
  • Loading branch information
ari-steas authored Feb 17, 2024
2 parents 881c9f3 + be20f76 commit aa24705
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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<ulong, Queue<n_SerializableProjectileInfo>> SyncStream_PP = new Dictionary<ulong, Queue<n_SerializableProjectileInfo>>();
private Dictionary<ulong, Queue<n_SerializableFireEvent>> SyncStream_FireEvent = new Dictionary<ulong, Queue<n_SerializableFireEvent>>();

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???
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ProtoBuf;
using Heart_Module.Data.Scripts.HeartModule.Network;
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -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() { }

Expand Down Expand Up @@ -51,7 +54,7 @@ public n_SerializableProjectileInfo(uint uniqueProjectileId, Vector3 positionRel
}

[ProtoContract]
internal class n_SerializableFireEvent
internal class n_SerializableFireEvent : PacketBase
{
public n_SerializableFireEvent() { }

Expand Down

0 comments on commit aa24705

Please sign in to comment.