Skip to content

Commit

Permalink
Add buoyancy and density properties to water (#489)
Browse files Browse the repository at this point in the history
Resolves #488
  • Loading branch information
MegaPiggy committed Jan 17, 2023
2 parents addc004 + 0d160c3 commit 1281dbd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NewHorizons/Builder/Body/WaterBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, Wate
fluidVolume._attachedBody = rb;
fluidVolume._triggerVolume = buoyancyTriggerVolume;
fluidVolume._radius = waterSize;
fluidVolume._buoyancyDensity = module.buoyancy;
fluidVolume._density = module.density;
fluidVolume._layer = LayerMask.NameToLayer("BasicEffectVolume");

var fogGO = GameObject.Instantiate(_oceanFog, waterGO.transform);
Expand Down
13 changes: 12 additions & 1 deletion NewHorizons/External/Modules/VariableSize/WaterModule.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using NewHorizons.Utility;
using NewHorizons.Utility;
using Newtonsoft.Json;
using System.ComponentModel;

namespace NewHorizons.External.Modules.VariableSize
{
Expand All @@ -11,6 +12,16 @@ public class WaterModule : VariableSizeModule
/// </summary>
public float size;

/// <summary>
/// Density of the water sphere. The higher the density, the harder it is to go through this fluid.
/// </summary>
[DefaultValue(1.2f)] public float density = 1.2f;

/// <summary>
/// Buoyancy density of the water sphere
/// </summary>
[DefaultValue(1f)] public float buoyancy = 1f;

/// <summary>
/// Tint of the water
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions NewHorizons/Schemas/body_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,18 @@
"description": "Size of the water sphere",
"format": "float"
},
"density": {
"type": "number",
"description": "Density of the water sphere. The higher the density, the harder it is to go through this fluid.",
"format": "float",
"default": 1.2
},
"buoyancy": {
"type": "number",
"description": "Buoyancy density of the water sphere",
"format": "float",
"default": 1.0
},
"tint": {
"description": "Tint of the water",
"$ref": "#/definitions/MColor"
Expand Down

0 comments on commit 1281dbd

Please sign in to comment.