Пример #1
0
        public override void StartServerSide(ICoreServerAPI api)
        {
            sapi = api;

            if (api.ModLoader.IsModSystemEnabled("Vintagestory.ServerMods.WorldEdit.WorldEdit"))
            {
                RegisterUtil.RegisterTool(api.ModLoader.GetModSystem("Vintagestory.ServerMods.WorldEdit.WorldEdit"));
            }

            // Set up day/night cycle
            api.WorldManager.SetBlockLightLevels(config.BlockLightLevels);
            api.WorldManager.SetSunLightLevels(config.SunLightLevels);
            api.WorldManager.SetSunBrightness(config.SunBrightness);

            api.Event.PlayerCreate     += Event_PlayerCreate;
            api.Event.PlayerNowPlaying += Event_PlayerPlaying;
            api.Event.PlayerJoin       += Event_PlayerJoin;

            api.Event.ServerRunPhase(EnumServerRunPhase.ModsAndConfigReady, loadConfig);

            api.Event.ServerRunPhase(EnumServerRunPhase.GameReady, () => {
                applyConfig();
                config.ResolveStartItems(api.World);
                api.World.Calendar.OnGetSolarSphericalCoords = GetSolarSphericalCoords;
                api.World.Calendar.OnGetHemisphere           = GetHemisphere;
            });

            AiTaskRegistry.Register <AiTaskBellAlarm>("bellalarm");
            AiTaskRegistry.Register <AiTaskThrowAtEntity>("throwatentity");
        }
Пример #2
0
        public override void StartServerSide(ICoreServerAPI api)
        {
            this.sapi = api;

            if (api.ModLoader.IsModSystemEnabled("Vintagestory.ServerMods.WorldEdit.WorldEdit"))
            {
                RegisterUtil.RegisterTool(api.ModLoader.GetModSystem("Vintagestory.ServerMods.WorldEdit.WorldEdit"));
            }

            // Set up day/night cycle
            api.WorldManager.SetBlockLightLevels(config.BlockLightLevels);
            api.WorldManager.SetSunLightLevels(config.SunLightLevels);
            api.WorldManager.SetSunBrightness(config.SunBrightness);

            //api.WorldManager.SetCurrencyIcon(config.CurrencyItemIcon);

            api.Event.PlayerCreate += Event_PlayerCreate;
            api.Event.ServerRunPhase(EnumServerRunPhase.LoadGame, () => config.ResolveStartItems(api.World));
        }