Exemple #1
0
 public static bool Prefix(WorldEnvironment __instance, ref bool ___bTerrainActived, EntityPlayer ___localPlayer)
 {
     if (!GameManager.IsDedicatedServer && DistantTerrain.Instance != null && !GameManager.IsSplatMapAvailable())
     {
         if (DistantTerrain.Instance.IsTerrainReady)
         {
             if (!___bTerrainActived)
             {
                 ___bTerrainActived = true;
                 DistantTerrain.Instance.SetTerrainVisible(true);
                 List <Chunk> chunkArrayCopySync = GameManager.Instance.World.ChunkCache.GetChunkArrayCopySync();
                 for (int i = 0; i < chunkArrayCopySync.Count; i++)
                 {
                     if (chunkArrayCopySync[i].IsDisplayed)
                     {
                         DistantTerrain.Instance.ActivateChunk(chunkArrayCopySync[i].X, chunkArrayCopySync[i].Z, false);
                     }
                 }
             }
         }
         else
         {
             ___bTerrainActived = false;
         }
         if (___localPlayer)
         {
             DistantTerrain.Instance.UpdateTerrain(___localPlayer.GetPosition());
         }
     }
     return(true);
 }
Exemple #2
0
 public static void Postfix(WorldEnvironment __instance, World ___m_World)
 {
     if (GamePrefs.GetString(EnumGamePrefs.GameWorld) == "Empty" || GamePrefs.GetString(EnumGamePrefs.GameWorld) == "Playtesting")
     {
         if (DistantTerrain.Instance != null)
         {
             DistantTerrain.Instance.Cleanup();
             DistantTerrain.Instance = null;
         }
         return;
     }
     if (!GameManager.IsDedicatedServer && !GameManager.IsSplatMapAvailable())
     {
         Debug.Log("Creating Legacy Distant Terrain");
         if (DistantTerrain.Instance == null && !GameManager.Instance.World.ChunkClusters[0].IsFixedSize)
         {
             DistantTerrain.cShiftHiResChunks = new Vector3(0f, 0.5f, 0f);
             DistantTerrain.Instance          = new DistantTerrain();
             DistantTerrain.Instance.Init();
         }
         DistantTerrainConstants.SeaLevel = 0f;
         DistantTerrain.Instance.Configure(new DelegateGetTerrainHeight(terrainHeightFuncAllOtherWorlds), GameManager.Instance.World.wcd, 0f);
         if (DistantTerrain.Instance != null)
         {
             DistantTerrain.Instance.SetTerrainVisible(true);
         }
     }
 }
Exemple #3
0
 public override void _Ready()
 {
     Player              = (PlayerManager)GetChild(0);
     World               = (WorldEnvironment)GetNode("World");
     Fadescreen          = (Sprite)GetNode("CamFollow").GetChild(0).GetChild(0).GetChild(0);
     Fadescreen.Modulate = new Color(0, 0, 0, 0);
 }
Exemple #4
0
 public static void Postfix(WorldEnvironment __instance, ChunkCluster.OnChunkVisibleDelegate ___chunkClusterVisibleDelegate)
 {
     if (DistantTerrain.Instance != null && !GameManager.IsSplatMapAvailable())
     {
         GameManager.Instance.World.ChunkClusters[0].OnChunkVisibleDelegates -= ___chunkClusterVisibleDelegate;
         DistantTerrain.Instance.Cleanup();
         DistantTerrain.Instance = null;
     }
 }
Exemple #5
0
    public override void _Ready()
    {
        base._Ready();
        WorldEnvironment we = GetNode(Game.WORLD_ENVIRO_PATH) as WorldEnvironment;

        Godot.Environment env = we.GetEnvironment();

        env.SetBackground(Godot.Environment.BGMode.Sky);
        sky = env.GetSky() as ProceduralSky;
        sky.SetSkyCurve(0.3f);
        sky.SetGroundCurve(0.3f);
    }
Exemple #6
0
    public override void _Ready()
    {
        // Initialize game components
        GameManager.Instance.MainNode = this;

        // Get Nodes
        Environment = GetNode("Environment") as Spatial;
        WorldEnv    = GetNode("Environment/WorldEnvironment") as WorldEnvironment;
        Interface   = GetNode("Interface") as Interface;

        // Node is ready!
        GD.print("Main scenes is ready.");
    }
Exemple #7
0
    public override void _Ready()
    {
        base._Ready();
        WorldEnvironment we = GetNode(Game.WORLD_ENVIRO_PATH) as WorldEnvironment;

        Godot.Environment env = we.GetEnvironment();

        env.SetBackground(Godot.Environment.BGMode.Sky);
        sky = env.GetSky() as ProceduralSky;
        sky.SetSkyCurve(0.3f);
        sky.SetGroundCurve(0.3f);

        status = Status.DORMANT;

        dm = GetNode(Game.NATURAL_DISASTERS_PATH) as DisasterManager;
    }
Exemple #8
0
        public override void _Ready()
        {
            _worldEnvironment = GetNode <WorldEnvironment>("WorldEnvironment");
            var settings = GetNode <Settings>("/root/Settings");

            if (settings.GIQuality == Settings.GIQualityEnum.High)
            {
                ProjectSettings.SetSetting("rendering/quality/voxel_cone_tracing/high_quality", true);
            }
            else if (settings.GIQuality == Settings.GIQualityEnum.Low)
            {
                ProjectSettings.SetSetting("rendering/quality/voxel_cone_tracing/high_quality", false);
            }
            else
            {
                GetNode <GIProbe>("GIProbe").Hide();
                GetNode <Spatial>("ReflectionProbes").Show();
            }

            if (settings.AAQuality == Settings.AAQualityEnum.AA_8x)
            {
                GetTree().Root.Msaa = Viewport.MSAA.Msaa8x;
            }
            else if (settings.AAQuality == Settings.AAQualityEnum.AA_4x)
            {
                GetTree().Root.Msaa = Viewport.MSAA.Msaa4x;
            }
            else if (settings.AAQuality == Settings.AAQualityEnum.AA_2x)
            {
                GetTree().Root.Msaa = Viewport.MSAA.Msaa2x;
            }
            else
            {
                GetTree().Root.Msaa = Viewport.MSAA.Disabled;
            }

            if (settings.SSAOQuality == Settings.SSAOQualityEnum.High)
            {
                _worldEnvironment.Environment.SsaoQuality = Godot.Environment.SSAOQuality.High;
            }
            else if (settings.SSAOQuality == Settings.SSAOQualityEnum.Low)
            {
                _worldEnvironment.Environment.SsaoQuality = Godot.Environment.SSAOQuality.Low;
            }
            else
            {
                _worldEnvironment.Environment.SsaoEnabled = false;
            }

            if (settings.BloomQuality == Settings.BloomQualityEnum.High)
            {
                _worldEnvironment.Environment.GlowEnabled        = true;
                _worldEnvironment.Environment.GlowBicubicUpscale = true;
            }
            else if (settings.BloomQuality == Settings.BloomQualityEnum.Low)
            {
                _worldEnvironment.Environment.GlowEnabled        = true;
                _worldEnvironment.Environment.GlowBicubicUpscale = false;
            }
            else
            {
                _worldEnvironment.Environment.GlowEnabled        = false;
                _worldEnvironment.Environment.GlowBicubicUpscale = false;
            }

            if (settings.Resolution == Settings.ResolutionEnum.Native)
            {
            }
            else if (settings.Resolution == Settings.ResolutionEnum.Res_1080)
            {
                var minsize = new Vector2(OS.WindowSize.x * 1080 / OS.WindowSize.y, 1080.0f);
                GetTree().SetScreenStretch(SceneTree.StretchMode.Viewport, SceneTree.StretchAspect.KeepHeight, minsize);
            }
            else if (settings.Resolution == Settings.ResolutionEnum.Res_720)
            {
                var minsize = new Vector2(OS.WindowSize.x * 720 / OS.WindowSize.y, 720.0f);
                GetTree().SetScreenStretch(SceneTree.StretchMode.Viewport, SceneTree.StretchAspect.KeepHeight, minsize);
            }
            else if (settings.Resolution == Settings.ResolutionEnum.Res_540)
            {
                var minsize = new Vector2(OS.WindowSize.x * 540 / OS.WindowSize.y, 540.0f);
                GetTree().SetScreenStretch(SceneTree.StretchMode.Viewport, SceneTree.StretchAspect.KeepHeight, minsize);
            }
        }