Merge pull request #143 from MegaPiggy/signal

Fixes
This commit is contained in:
Nick 2022-05-19 17:39:50 -04:00 committed by GitHub
commit baf3b6a39c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 7 deletions

View File

@ -32,6 +32,8 @@ namespace NewHorizons.Builder.Atmosphere
PR._useMinimap = useMiniMap;
PR._useAltimeter = useMiniMap;
rulesetGO.AddComponent<AntiTravelMusicRuleset>();
EffectRuleset ER = rulesetGO.AddComponent<EffectRuleset>();
ER._type = EffectRuleset.BubbleType.Underwater;
var gdRuleset = GameObject.Find("GiantsDeep_Body/Sector_GD/Volumes_GD/RulesetVolumes_GD").GetComponent<EffectRuleset>();

View File

@ -3,7 +3,7 @@ namespace NewHorizons.Builder.General
{
public static class AmbientLightBuilder
{
public static void Make(GameObject planetGO, Sector sector, float scale)
public static void Make(GameObject planetGO, Sector sector, float scale, float intensity = 0.5f)
{
GameObject lightGO = GameObject.Instantiate(GameObject.Find("BrittleHollow_Body/AmbientLight_BH_Surface"), sector?.transform ?? planetGO.transform);
lightGO.transform.position = planetGO.transform.position;
@ -19,7 +19,7 @@ namespace NewHorizons.Builder.General
light.color = new Color(0.0f, 0.0f, 0.8f, 0.0225f);
light.range = scale;
light.intensity = 0.5f;
light.intensity = intensity;
}
}
}

View File

@ -142,10 +142,12 @@ namespace NewHorizons.Builder.Props
var source = signalGO.AddComponent<AudioSource>();
var owAudioSource = signalGO.AddComponent<OWAudioSource>();
owAudioSource._audioSource = source;
AudioSignal audioSignal;
if (info.InsideCloak) audioSignal = signalGO.AddComponent<CloakedAudioSignal>();
else audioSignal = signalGO.AddComponent<AudioSignal>();
audioSignal._owAudioSource = owAudioSource;
var frequency = StringToFrequency(info.Frequency);
var name = StringToSignalName(info.Name);

View File

@ -107,6 +107,8 @@ namespace NewHorizons.Components
if (newState.orbit != null && newState.orbit != oldState.orbit) SetNewOrbit(primaryBody, orbitalParams);
_currentIndex = newIndex;
GlobalMessenger<OWRigidbody>.FireEvent("QuantumMoonChangeState", _rb);
}
// Be completely sure we move the visibility tracker back to our planet

View File

@ -4,7 +4,9 @@ namespace NewHorizons.External.Modules
public class BaseModule
{
public bool HasMapMarker { get; set; }
[System.Obsolete("HasAmbientLight is deprecated, please use AmbientLight instead")]
public bool HasAmbientLight { get; set; }
public float AmbientLight { get; set; }
public float SurfaceGravity { get; set; }
public string GravityFallOff { get; set; } = "linear";
public float SurfaceSize { get; set; }

View File

@ -378,7 +378,11 @@ namespace NewHorizons.Handlers
{
var sphereOfInfluence = GetSphereOfInfluence(body);
if (body.Config.Base.HasAmbientLight)
if (body.Config.Base.AmbientLight != 0)
{
AmbientLightBuilder.Make(go, sector, sphereOfInfluence, body.Config.Base.AmbientLight);
}
else if (body.Config.Base.HasAmbientLight)
{
AmbientLightBuilder.Make(go, sector, sphereOfInfluence);
}

View File

@ -125,5 +125,12 @@ namespace NewHorizons.Patches
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(TravelerAudioManager), nameof(TravelerAudioManager.Update))]
public static void TravelerAudioManager_Update(TravelerAudioManager __instance)
{
__instance._signals.RemoveAll(signal => signal == null || signal.gameObject == null || signal._owAudioSource == null || signal._owAudioSource._audioSource == null);
}
}
}

View File

@ -209,10 +209,10 @@
"default": false,
"description": "If the body should have a marker on the map screen."
},
"hasAmbientLight": {
"type": "boolean",
"default": false,
"description": "If the dark side of the body should have some slight amount of light"
"ambientLight": {
"type": "number",
"default": 0,
"description": "The intensity of light the dark side of the body should have. Timber Hearth has 1.4 for reference"
},
"surfaceGravity": {
"type": "number",