diff --git a/.github/workflows/debug_build.yml b/.github/workflows/debug_build.yml index c6fc4578..587cc772 100644 --- a/.github/workflows/debug_build.yml +++ b/.github/workflows/debug_build.yml @@ -23,10 +23,3 @@ jobs: uses: './.github/workflows/update_schemas.yml' with: artifact_name: NewHorizons-Schemas-Debug - Build_Docs: - name: 'Build Docs' - needs: Build - if: ${{ needs.Build.outputs.schemas_changed == 'true' }} - uses: './.github/workflows/docs_build.yml' - with: - schemas_artifact: NewHorizons-Schemas-Debug diff --git a/.github/workflows/docs_build.yml b/.github/workflows/docs_build.yml index d7186708..aabdef8e 100644 --- a/.github/workflows/docs_build.yml +++ b/.github/workflows/docs_build.yml @@ -18,8 +18,18 @@ env: URL_PREFIX: '/' PIPENV_VENV_IN_PROJECT: 1 +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: true + jobs: build: + name: Build Docs runs-on: ubuntu-latest steps: @@ -63,15 +73,21 @@ jobs: command: run menagerie generate - name: Upload Artifact - uses: actions/upload-artifact@v2 + if: success() && github.ref == 'refs/heads/main' + uses: actions/upload-pages-artifact@v1 with: - name: Built-Docs path: out/ - - name: Deploy To Pages - if: success() && github.ref == 'refs/heads/main' - uses: JamesIves/github-pages-deploy-action@4.1.5 - with: - branch: gh-pages - folder: out/ + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + name: Deploy Docs + needs: build + if: github.ref == 'refs/heads/main' + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/.github/workflows/update_schemas.yml b/.github/workflows/update_schemas.yml index e1ddbeba..f98394f8 100644 --- a/.github/workflows/update_schemas.yml +++ b/.github/workflows/update_schemas.yml @@ -8,6 +8,11 @@ on: description: 'Name of the artifact to download and check against' type: string +# Prevents schemas from trying to update on old commits +concurrency: + group: "schemas-${{ github.ref }}" + cancel-in-progress: true + jobs: update_schemas: runs-on: ubuntu-latest diff --git a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs index 7850f570..b3a15493 100644 --- a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs +++ b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs @@ -1,5 +1,6 @@ using HarmonyLib; using NewHorizons.Builder.Props; +using NewHorizons.Components; using NewHorizons.Components.Orbital; using NewHorizons.Handlers; using NewHorizons.Utility; @@ -177,6 +178,10 @@ namespace NewHorizons.Builder.Body cloak._sectors = new Sector[] { sector }; cloak.GetComponent().enabled = true; + // Cull stuff + var cullController = go.AddComponent(); + cullController.SetSector(sector); + // finalize atmo.SetActive(true); volumes.SetActive(true); diff --git a/NewHorizons/Components/BrambleSectorController.cs b/NewHorizons/Components/BrambleSectorController.cs new file mode 100644 index 00000000..9d0762eb --- /dev/null +++ b/NewHorizons/Components/BrambleSectorController.cs @@ -0,0 +1,105 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace NewHorizons.Components +{ + public class BrambleSectorController : MonoBehaviour, ISectorGroup + { + private Sector _sector; + + private Renderer[] _renderers = null; + private TessellatedRenderer[] _tessellatedRenderers = null; + private Collider[] _colliders = null; + private Light[] _lights = null; + + public static bool isPlayerInside = false; + public static bool isProbeInside = false; + public static bool isShipInside = false; + + private bool _renderersShown = false; + + public Sector GetSector() => _sector; + + public void SetSector(Sector sector) + { + if (_sector != null) _sector.OnSectorOccupantsUpdated -= OnSectorOccupantsUpdated; + + _sector = sector; + _sector.OnSectorOccupantsUpdated += OnSectorOccupantsUpdated; + } + + private void OnDestroy() + { + if (_sector != null) _sector.OnSectorOccupantsUpdated -= OnSectorOccupantsUpdated; + } + + private void Start() + { + _renderers = gameObject.GetComponentsInChildren(); + _tessellatedRenderers = gameObject.GetComponentsInChildren(); + _colliders = gameObject.GetComponentsInChildren(); + _lights = gameObject.GetComponentsInChildren(); + + DisableRenderers(); + } + + private void OnSectorOccupantsUpdated() + { + if (_sector.ContainsAnyOccupants(DynamicOccupant.Player | DynamicOccupant.Probe)) + { + if (!_renderersShown) EnableRenderers(); + } + else + { + if (_renderersShown) DisableRenderers(); + } + } + + private void EnableRenderers() + { + foreach (var renderer in _renderers) + { + renderer.forceRenderingOff = false; + } + + foreach (var tessellatedRenderer in _tessellatedRenderers) + { + tessellatedRenderer.enabled = true; + } + + foreach (var collider in _colliders) + { + collider.enabled = true; + } + + foreach (var light in _lights) + { + light.enabled = true; + } + } + + private void DisableRenderers() + { + foreach (var renderer in _renderers) + { + renderer.forceRenderingOff = true; + } + + foreach (var tessellatedRenderer in _tessellatedRenderers) + { + tessellatedRenderer.enabled = false; + } + + foreach (var collider in _colliders) + { + collider.enabled = false; + } + + foreach (var light in _lights) + { + light.enabled = false; + } + } + } +} diff --git a/NewHorizons/Components/CloakSectorController.cs b/NewHorizons/Components/CloakSectorController.cs index 7d0bbf7b..59bf41ae 100644 --- a/NewHorizons/Components/CloakSectorController.cs +++ b/NewHorizons/Components/CloakSectorController.cs @@ -10,9 +10,9 @@ namespace NewHorizons.Components private bool _isInitialized; - private List _renderers = null; - private List _tessellatedRenderers = null; - private List _tessSphereToggles = null; + private Renderer[] _renderers = null; + private TessellatedRenderer[] _tessellatedRenderers = null; + private CloakedTessSphereSectorToggle[] _tessSphereToggles = null; public static bool isPlayerInside = false; public static bool isProbeInside = false; @@ -52,9 +52,9 @@ namespace NewHorizons.Components private void SetUpList() { - _renderers = _root.GetComponentsInChildren().ToList(); - _tessellatedRenderers = _root.GetComponentsInChildren().ToList(); - _tessSphereToggles = _root.GetComponentsInChildren().ToList(); + _renderers = _root.GetComponentsInChildren(); + _tessellatedRenderers = _root.GetComponentsInChildren(); + _tessSphereToggles = _root.GetComponentsInChildren(); } public void OnPlayerEnter() diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index ec7d8582..4e77b195 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -47,7 +47,7 @@ namespace NewHorizons public static bool IsSystemReady { get; private set; } public static float FurthestOrbit { get; set; } = 50000f; - public string DefaultStarSystem => SystemDict.Keys.Contains(_defaultSystemOverride) ? _defaultSystemOverride : _defaultStarSystem; + public string DefaultStarSystem => SystemDict.ContainsKey(_defaultSystemOverride) ? _defaultSystemOverride : _defaultStarSystem; public string CurrentStarSystem => _currentStarSystem; public bool IsWarpingFromShip { get; private set; } = false; public bool IsWarpingFromVessel { get; private set; } = false; @@ -99,7 +99,7 @@ namespace NewHorizons _defaultSystemOverride = config.GetSettingsValue("Default System Override"); // Else it doesn't get set idk - if (currentScene == "TitleScreen" && SystemDict.Keys.Contains(_defaultSystemOverride)) + if (currentScene == "TitleScreen" && SystemDict.ContainsKey(_defaultSystemOverride)) { _currentStarSystem = _defaultSystemOverride; } @@ -332,7 +332,7 @@ namespace NewHorizons { // Reset back to original solar system after going to main menu. // If the override is a valid system then we go there - if (SystemDict.Keys.Contains(_defaultSystemOverride)) + if (SystemDict.ContainsKey(_defaultSystemOverride)) { _currentStarSystem = _defaultSystemOverride; IsWarpingFromShip = true; // always do this else sometimes the spawn gets messed up @@ -575,7 +575,7 @@ namespace NewHorizons if (!IsChangingStarSystem) { // If the override is a valid system then we go there - if (SystemDict.Keys.Contains(_defaultSystemOverride)) + if (SystemDict.ContainsKey(_defaultSystemOverride)) { _currentStarSystem = _defaultSystemOverride; IsWarpingFromShip = true; // always do this else sometimes the spawn gets messed up diff --git a/NewHorizons/Utility/AstroObjectLocator.cs b/NewHorizons/Utility/AstroObjectLocator.cs index d0bd3231..d28b225e 100644 --- a/NewHorizons/Utility/AstroObjectLocator.cs +++ b/NewHorizons/Utility/AstroObjectLocator.cs @@ -61,7 +61,7 @@ namespace NewHorizons.Utility { var key = ao._name == AstroObject.Name.CustomString ? ao.GetCustomName() : ao._name.ToString(); - if (_customAstroObjectDictionary.Keys.Contains(key)) + if (_customAstroObjectDictionary.ContainsKey(key)) { Logger.LogWarning($"Registering duplicate [{ao.name}] as [{key}]"); _customAstroObjectDictionary[key] = ao; diff --git a/docs/content/pages/secret.md b/docs/content/pages/secret.md index c556bbb5..d5d0a562 100644 --- a/docs/content/pages/secret.md +++ b/docs/content/pages/secret.md @@ -14,3 +14,6 @@ Uh idk what to put here thought it would be funny haha ![image](https://user-images.githubusercontent.com/25644444/178856213-44cb0a38-6d3d-4af6-b7f8-0ae6cda8d44a.png) +## Test + +aaaaaaaaaaaaaaaaaaaaaaaaa diff --git a/docs/content/pages/tutorials/details.md b/docs/content/pages/tutorials/details.md index 41f704b3..c8483065 100644 --- a/docs/content/pages/tutorials/details.md +++ b/docs/content/pages/tutorials/details.md @@ -8,7 +8,6 @@ Sort_Priority: 85 For physical objects there are currently two ways of setting them up: specify an asset bundle and path to load a custom asset you created, or specify the path to the item you want to copy from the game in the scene hierarchy. Use the [Unity Explorer](https://outerwildsmods.com/mods/unityexplorer){ target="_blank" } mod to find an object you want to copy onto your new body. Some objects work better than others for this. Good luck. Some pointers: - Use "Object Explorer" to search -- Do not use the search functionality on Scene Explorer, it is really, really slow. Use the "Object Search" tab instead. - Generally you can find planets by writing their name with no spaces/punctuation followed by "_Body". - There's also [this community-maintained list of props](https://docs.google.com/spreadsheets/d/1VJaglB1kRL0VqaXhvXepIeymo93zqhWex-j7_QDm6NE/edit?usp=sharing) which you can use to find interesting props and check to see if they have collision.