示例#1
0
        public NetPlayerComponent(AOSServer server)
            : base(server)
        {
            netPlayers        = new BiDictionary <NetConnection, NetworkPlayer>();
            stashedClientInfo = new Dictionary <NetConnection, ClientInfo>();
            channel           = server.GetChannel(AOSChannelType.NetInterface);
            snapshotComponent = server.GetComponent <SnapshotNetComponent>();

            channel.AddRemoteEvent("Server_ClientInfo", R_ClientInfo);
        }
示例#2
0
        public ServerWorld()
        {
            players      = new ConcurrentDictionary <NetConnection, ServerMPPlayer>();
            physEntities = new Dictionary <ushort, GameObject>();

            server            = AOSServer.Instance;
            snapshotComponent = server.GetComponent <SnapshotNetComponent>();
            objectComponent   = server.GetComponent <ObjectNetComponent>();
            channel           = server.GetChannel(AOSChannelType.World);

            channel.AddRemoteEvent("Server_SetBlock", R_SetBlock);
            channel.AddRemoteEvent("Server_ThrowGrenade", R_ThrowGrenade);
            channel.AddRemoteEvent("Server_ShootMelon", R_ShootMelon);

            objectComponent.OnCreatableInstantiated   += ObjectComponent_OnCreatableInstantiated;
            objectComponent.OnCreatableDestroyed      += ObjectComponent_OnCreatableDestroyed;
            snapshotComponent.OnWorldSnapshotOutbound += Server_OnWorldSnapshotOutbound;

            InitializeCMD();

            ConfigSection gameSection = Program.Config.GetSection("Game");

            if (gameSection == null)
            {
                DashCMD.WriteError("[server.cfg - ServerWorld] Section 'Game' is missing!");
            }
            else
            {
                string worldFile = gameSection.GetString("world-file");

                if (!string.IsNullOrWhiteSpace(worldFile))
                {
                    LoadFromFile(worldFile);
                }
                else
                {
                    DashCMD.WriteError("[server.cfg - ServerWorld] Game.world-file is missing!");
                }
            }
        }