Ejemplo n.º 1
0
 public static void AddBullet_Postfix(DysonSwarm __instance, SailBullet bullet, int orbitId)
 {
     //Host is sending correction / authorization packet to correct constants of the generated bullet
     if (SimulatedWorld.Initialized && LocalPlayer.IsMasterClient)
     {
         LocalPlayer.SendPacket(new DysonSphereBulletCorrectionPacket(__instance.starData.index, bullet.id, bullet.uEndVel, bullet.uEnd));
     }
 }
 public void ProcessPacket(DysonSphereBulletCorrectionPacket packet, NebulaConnection conn)
 {
     //Check if the bullet that needs to be corrected exists
     if (GameMain.data.dysonSpheres[packet.StarIndex]?.swarm?.bulletPool[packet.BulletId] != null)
     {
         //Update destination values for the bullet
         SailBullet bullet = GameMain.data.dysonSpheres[packet.StarIndex].swarm.bulletPool[packet.BulletId];
         bullet.uEnd    = DataStructureExtensions.ToVector3(packet.UEnd);
         bullet.uEndVel = DataStructureExtensions.ToVector3(packet.UEndVel);
     }
     else
     {
         //TODO: Maybe queue it and check next frame if the bullet already exist?
         //Note: this situation was not observed during test, but maybe it can due to the severe lags?
     }
 }