コード例 #1
0
ファイル: Weather.cs プロジェクト: bitcynth/vsessentialsmod
        private void InitWeatherSim()
        {
            weatherSim = new WeatherSimulation(this);
            if (api.Side == EnumAppSide.Client)
            {
                cloudRenderer = new CloudRenderer(capi, weatherSim);
            }

            weatherSim.Initialize();

            if (initialWeatherFromServer != null)
            {
                OnWeatherUpdate(initialWeatherFromServer);
                initialWeatherFromServer = null;
            }

            // Pre init the clouds.
            if (api.Side == EnumAppSide.Client)
            {
                capi.Ambient.UpdateAmbient(0.1f);
                CloudRenderer renderer = this.cloudRenderer as CloudRenderer;

                renderer.blendedCloudDensity          = capi.Ambient.BlendedCloudDensity;
                renderer.blendedGlobalCloudBrightness = capi.Ambient.BlendedCloudBrightness;
                renderer.UpdateWindAndClouds(0.1f);
            }
        }
コード例 #2
0
ファイル: Weather.cs プロジェクト: bitcynth/vsessentialsmod
        public override void StartServerSide(ICoreServerAPI api)
        {
            this.sapi = api;

            serverChannel =
                api.Network.RegisterChannel("weather")
                .RegisterMessageType(typeof(WeatherState))
            ;

            sapi.RegisterCommand("weather", "Show current weather info", "", cmdWeatherServer, Privilege.controlserver);

            sapi.Event.RegisterGameTickListener(OnGameTick, 50);

            sapi.Event.SaveGameLoaded += OnSaveGameLoaded;
            sapi.Event.GameWorldSave  += OnSaveGameSaving;

            api.Event.PlayerJoin += OnPlayerJoin;

            this.cloudRenderer = new CloudRendererDummy();
        }