Example #1
0
        public void TestInitialize()
        {
            loadedChunks   = new LoadedChunks();
            packetReceiver = new ChunkAwarePacketReceiver(loadedChunks);

            loadedChunk   = loadedChunks.GetChunk(loadedActionPosition);
            unloadedChunk = loadedChunks.GetChunk(unloadedActionPosition);

            loadedChunks.AddChunk(loadedChunk);
        }
        private bool PacketWasDeferred(Packet packet)
        {
            if (packet is PlayerActionPacket playerAction)
            {
                if (!playerAction.PlayerMustBeInRangeToReceive)
                {
                    return(false);
                }

                Int3 actionChunk = loadedChunks.GetChunk(playerAction.ActionPosition);

                if (!loadedChunks.IsLoadedChunk(actionChunk))
                {
                    Console.WriteLine("Action was deferred, chunk not loaded: " + actionChunk);
                    AddPacketToDeferredMap(playerAction, actionChunk);
                    return(true);
                }
            }

            return(false);
        }