Merge branch 'xen-42:dev' into dev

This commit is contained in:
TerrificTrifid 2022-07-28 22:31:58 -05:00 committed by GitHub
commit 5ffc533d2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 153 additions and 27 deletions

View File

@ -23,10 +23,3 @@ jobs:
uses: './.github/workflows/update_schemas.yml' uses: './.github/workflows/update_schemas.yml'
with: with:
artifact_name: NewHorizons-Schemas-Debug 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

View File

@ -18,8 +18,18 @@ env:
URL_PREFIX: '/' URL_PREFIX: '/'
PIPENV_VENV_IN_PROJECT: 1 PIPENV_VENV_IN_PROJECT: 1
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs: jobs:
build: build:
name: Build Docs
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -63,15 +73,21 @@ jobs:
command: run menagerie generate command: run menagerie generate
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v2 if: success() && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v1
with: with:
name: Built-Docs
path: out/ path: out/
- name: Deploy To Pages deploy:
if: success() && github.ref == 'refs/heads/main' environment:
uses: JamesIves/github-pages-deploy-action@4.1.5 name: github-pages
with: url: ${{ steps.deployment.outputs.page_url }}
branch: gh-pages runs-on: ubuntu-latest
folder: out/ name: Deploy Docs
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

View File

@ -8,6 +8,11 @@ on:
description: 'Name of the artifact to download and check against' description: 'Name of the artifact to download and check against'
type: string type: string
# Prevents schemas from trying to update on old commits
concurrency:
group: "schemas-${{ github.ref }}"
cancel-in-progress: true
jobs: jobs:
update_schemas: update_schemas:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -1,5 +1,6 @@
using HarmonyLib; using HarmonyLib;
using NewHorizons.Builder.Props; using NewHorizons.Builder.Props;
using NewHorizons.Components;
using NewHorizons.Components.Orbital; using NewHorizons.Components.Orbital;
using NewHorizons.Handlers; using NewHorizons.Handlers;
using NewHorizons.Utility; using NewHorizons.Utility;
@ -177,6 +178,10 @@ namespace NewHorizons.Builder.Body
cloak._sectors = new Sector[] { sector }; cloak._sectors = new Sector[] { sector };
cloak.GetComponent<Renderer>().enabled = true; cloak.GetComponent<Renderer>().enabled = true;
// Cull stuff
var cullController = go.AddComponent<BrambleSectorController>();
cullController.SetSector(sector);
// finalize // finalize
atmo.SetActive(true); atmo.SetActive(true);
volumes.SetActive(true); volumes.SetActive(true);

View File

@ -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<Renderer>();
_tessellatedRenderers = gameObject.GetComponentsInChildren<TessellatedRenderer>();
_colliders = gameObject.GetComponentsInChildren<Collider>();
_lights = gameObject.GetComponentsInChildren<Light>();
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;
}
}
}
}

View File

@ -10,9 +10,9 @@ namespace NewHorizons.Components
private bool _isInitialized; private bool _isInitialized;
private List<Renderer> _renderers = null; private Renderer[] _renderers = null;
private List<TessellatedRenderer> _tessellatedRenderers = null; private TessellatedRenderer[] _tessellatedRenderers = null;
private List<CloakedTessSphereSectorToggle> _tessSphereToggles = null; private CloakedTessSphereSectorToggle[] _tessSphereToggles = null;
public static bool isPlayerInside = false; public static bool isPlayerInside = false;
public static bool isProbeInside = false; public static bool isProbeInside = false;
@ -52,9 +52,9 @@ namespace NewHorizons.Components
private void SetUpList() private void SetUpList()
{ {
_renderers = _root.GetComponentsInChildren<Renderer>().ToList(); _renderers = _root.GetComponentsInChildren<Renderer>();
_tessellatedRenderers = _root.GetComponentsInChildren<TessellatedRenderer>().ToList(); _tessellatedRenderers = _root.GetComponentsInChildren<TessellatedRenderer>();
_tessSphereToggles = _root.GetComponentsInChildren<CloakedTessSphereSectorToggle>().ToList(); _tessSphereToggles = _root.GetComponentsInChildren<CloakedTessSphereSectorToggle>();
} }
public void OnPlayerEnter() public void OnPlayerEnter()

View File

@ -47,7 +47,7 @@ namespace NewHorizons
public static bool IsSystemReady { get; private set; } public static bool IsSystemReady { get; private set; }
public static float FurthestOrbit { get; set; } = 50000f; 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 string CurrentStarSystem => _currentStarSystem;
public bool IsWarpingFromShip { get; private set; } = false; public bool IsWarpingFromShip { get; private set; } = false;
public bool IsWarpingFromVessel { get; private set; } = false; public bool IsWarpingFromVessel { get; private set; } = false;
@ -99,7 +99,7 @@ namespace NewHorizons
_defaultSystemOverride = config.GetSettingsValue<string>("Default System Override"); _defaultSystemOverride = config.GetSettingsValue<string>("Default System Override");
// Else it doesn't get set idk // Else it doesn't get set idk
if (currentScene == "TitleScreen" && SystemDict.Keys.Contains(_defaultSystemOverride)) if (currentScene == "TitleScreen" && SystemDict.ContainsKey(_defaultSystemOverride))
{ {
_currentStarSystem = _defaultSystemOverride; _currentStarSystem = _defaultSystemOverride;
} }
@ -332,7 +332,7 @@ namespace NewHorizons
{ {
// Reset back to original solar system after going to main menu. // Reset back to original solar system after going to main menu.
// If the override is a valid system then we go there // If the override is a valid system then we go there
if (SystemDict.Keys.Contains(_defaultSystemOverride)) if (SystemDict.ContainsKey(_defaultSystemOverride))
{ {
_currentStarSystem = _defaultSystemOverride; _currentStarSystem = _defaultSystemOverride;
IsWarpingFromShip = true; // always do this else sometimes the spawn gets messed up IsWarpingFromShip = true; // always do this else sometimes the spawn gets messed up
@ -575,7 +575,7 @@ namespace NewHorizons
if (!IsChangingStarSystem) if (!IsChangingStarSystem)
{ {
// If the override is a valid system then we go there // If the override is a valid system then we go there
if (SystemDict.Keys.Contains(_defaultSystemOverride)) if (SystemDict.ContainsKey(_defaultSystemOverride))
{ {
_currentStarSystem = _defaultSystemOverride; _currentStarSystem = _defaultSystemOverride;
IsWarpingFromShip = true; // always do this else sometimes the spawn gets messed up IsWarpingFromShip = true; // always do this else sometimes the spawn gets messed up

View File

@ -61,7 +61,7 @@ namespace NewHorizons.Utility
{ {
var key = ao._name == AstroObject.Name.CustomString ? ao.GetCustomName() : ao._name.ToString(); 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}]"); Logger.LogWarning($"Registering duplicate [{ao.name}] as [{key}]");
_customAstroObjectDictionary[key] = ao; _customAstroObjectDictionary[key] = ao;

View File

@ -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) ![image](https://user-images.githubusercontent.com/25644444/178856213-44cb0a38-6d3d-4af6-b7f8-0ae6cda8d44a.png)
## Test
aaaaaaaaaaaaaaaaaaaaaaaaa

View File

@ -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: 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 - 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". - 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. - 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.