## Improvements

- Updated description of VariableSizeModule (thanks LeeSpork)

## Bug fixes

- Make `GetPlanet` only check planets in the current system. This
prevents it from pulling the wrong config if a planet in another system
has the same name (thanks coderCleric).
- Fixed interaction volumes breaking when no shape provided.
- Added an effect ruleset to sand. Fixes #1099
This commit is contained in:
xen-42 2025-09-15 17:52:30 -04:00 committed by GitHub
commit 0b7e9b47fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 30 additions and 12 deletions

View File

@ -10,6 +10,7 @@ namespace NewHorizons.Builder.Body
private static GameObject _sandCollider;
private static GameObject _sandOcclusion;
private static GameObject _sandProxyShadowCaster;
private static Material _hgtSandEffectMaterial;
private static bool _isInit;
@ -23,6 +24,7 @@ namespace NewHorizons.Builder.Body
if (_sandCollider == null) _sandCollider = SearchUtilities.Find("TowerTwin_Body/SandSphere_Draining/Collider").InstantiateInactive().Rename("Prefab_TT_SandCollider").DontDestroyOnLoad();
if (_sandOcclusion == null) _sandOcclusion = SearchUtilities.Find("TowerTwin_Body/SandSphere_Draining/OcclusionSphere").InstantiateInactive().Rename("Prefab_TT_SandOcclusion").DontDestroyOnLoad();
if (_sandProxyShadowCaster == null) _sandProxyShadowCaster = SearchUtilities.Find("TowerTwin_Body/SandSphere_Draining/ProxyShadowCaster").InstantiateInactive().Rename("Prefab_TT_SandProxyShadowCaster").DontDestroyOnLoad();
if (_hgtSandEffectMaterial == null) _hgtSandEffectMaterial = new Material(SearchUtilities.Find("FocalBody/Sector_HGT").GetComponent<EffectRuleset>()._sandMaterial).DontDestroyOnLoad();
}
public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, SandModule module)
@ -35,6 +37,14 @@ namespace NewHorizons.Builder.Body
var sandSphere = Object.Instantiate(_sandSphere, sandGO.transform);
sandSphere.name = "Sphere";
sandSphere.SetActive(true);
sandSphere.AddComponent<SphereShape>().radius = 1;
sandSphere.AddComponent<OWTriggerVolume>();
var sandEffectMaterial = new Material(_hgtSandEffectMaterial);
var sER = sandSphere.AddComponent<EffectRuleset>();
sER._type = EffectRuleset.BubbleType.None;
sER._sandMaterial = sandEffectMaterial;
if (module.tint != null)
{
var oldMR = sandSphere.GetComponent<TessellatedSphereRenderer>();
@ -49,6 +59,10 @@ namespace NewHorizons.Builder.Body
Object.Destroy(oldMR);
sandMR.sharedMaterials[0].color = module.tint.ToColor();
sandMR.sharedMaterials[1].color = module.tint.ToColor();
var baseColor = module.tint.ToColor();
var effectColor = new Color(baseColor.r * 0.184f, baseColor.g * 0.184f, baseColor.b * 0.184f, baseColor.a); // base game does .184 darker
sandEffectMaterial.color = effectColor;
}
var collider = Object.Instantiate(_sandCollider, sandGO.transform);

View File

@ -15,11 +15,15 @@ namespace NewHorizons.Builder.Volumes
public static InteractReceiver Make(GameObject planetGO, Sector sector, InteractionVolumeInfo info, IModBehaviour mod)
{
// Interaction volumes must use colliders because the first-person interaction system uses raycasting
if (info.shape != null)
if (info.shape != null && info.shape?.useShape == false)
{
info.shape.useShape = false;
NHLogger.LogError($"Interaction volumes only support colliders. Affects planet [{planetGO.name}]. Set useShape to false.");
}
// If info.shape was null, it will still default to using a sphere with info.radius, just make sure it does so with a collider
info.shape ??= new();
info.shape.useShape = false;
var receiver = VolumeBuilder.Make<InteractReceiver>(planetGO, sector, info);
receiver.gameObject.layer = Layer.Interactible;

View File

@ -6,8 +6,8 @@ namespace NewHorizons.External.Modules.VariableSize
public class VariableSizeModule
{
/// <summary>
/// Scale this object over time. Time value is in minutes.
/// Scale this object over time. Time is in minutes. Value is a multiplier of the size of the object.
/// </summary>
public TimeValuePair[] curve;
}
}
}

View File

@ -83,7 +83,7 @@ namespace NewHorizons
public GameObject GetPlanet(string name)
{
return Main.BodyDict.Values.SelectMany(x => x)?.ToList()?.FirstOrDefault(x => x.Config.name == name)?.Object;
return Main.BodyDict[Main.Instance.CurrentStarSystem].FirstOrDefault(x => x.Config.name == name)?.Object;
}
public string GetCurrentStarSystem() => Main.Instance.CurrentStarSystem;

View File

@ -1846,7 +1846,7 @@
"properties": {
"curve": {
"type": "array",
"description": "Scale this object over time. Time value is in minutes.",
"description": "Scale this object over time. Time is in minutes. Value is a multiplier of the size of the object.",
"items": {
"$ref": "#/definitions/TimeValuePair"
}
@ -2035,7 +2035,7 @@
"properties": {
"curve": {
"type": "array",
"description": "Scale this object over time. Time value is in minutes.",
"description": "Scale this object over time. Time is in minutes. Value is a multiplier of the size of the object.",
"items": {
"$ref": "#/definitions/TimeValuePair"
}
@ -4808,7 +4808,7 @@
"properties": {
"curve": {
"type": "array",
"description": "Scale this object over time. Time value is in minutes.",
"description": "Scale this object over time. Time is in minutes. Value is a multiplier of the size of the object.",
"items": {
"$ref": "#/definitions/TimeValuePair"
}
@ -5089,7 +5089,7 @@
"properties": {
"curve": {
"type": "array",
"description": "Scale this object over time. Time value is in minutes.",
"description": "Scale this object over time. Time is in minutes. Value is a multiplier of the size of the object.",
"items": {
"$ref": "#/definitions/TimeValuePair"
}
@ -5255,7 +5255,7 @@
"properties": {
"curve": {
"type": "array",
"description": "Scale this object over time. Time value is in minutes.",
"description": "Scale this object over time. Time is in minutes. Value is a multiplier of the size of the object.",
"items": {
"$ref": "#/definitions/TimeValuePair"
}
@ -7830,7 +7830,7 @@
"properties": {
"curve": {
"type": "array",
"description": "Scale this object over time. Time value is in minutes.",
"description": "Scale this object over time. Time is in minutes. Value is a multiplier of the size of the object.",
"items": {
"$ref": "#/definitions/TimeValuePair"
}

View File

@ -4,7 +4,7 @@
"author": "xen, Bwc9876, JohnCorby, MegaPiggy, and friends",
"name": "New Horizons",
"uniqueName": "xen.NewHorizons",
"version": "1.28.6",
"version": "1.28.7",
"owmlVersion": "2.12.1",
"dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "PacificEngine.OW_CommonResources" ],