Skip to content

Commit

Permalink
Update to try to fix logger color coding, and fix player movement bei…
Browse files Browse the repository at this point in the history
…ng locked out of water
  • Loading branch information
Happyrobot33 committed Sep 28, 2023
1 parent e7b02ed commit 5e18b19
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 26 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ public class WingFlightPlusGlide : UdonSharpBehaviour
public bool bankingTurns = true;
bool bankingTurns_DEFAULT = true;

[Tooltip("If enabled, gravity will be saved each time the user takes off, instead of just at the start of the world. (Default: false)")]
public bool dynamicGravity = false;
[Tooltip("If enabled, gravity and movement will be saved each time the user takes off, instead of just at the start of the world. (Default: false)")]
public bool dynamicPlayerPhysics = false;

// Essential Variables
private VRCPlayerApi LocalPlayer;
Expand Down Expand Up @@ -184,9 +184,12 @@ public void Start()
{
LocalPlayer = Networking.LocalPlayer;
//save the user gravity if dynamic gravity is disabled
if (!dynamicGravity)
if (!dynamicPlayerPhysics)
{
oldGravityStrength = LocalPlayer.GetGravityStrength();
oldWalkSpeed = LocalPlayer.GetWalkSpeed();
oldRunSpeed = LocalPlayer.GetRunSpeed();
oldStrafeSpeed = LocalPlayer.GetStrafeSpeed();
}
}

Expand Down Expand Up @@ -524,9 +527,12 @@ private void ImmobilizePart(bool b)
{
if (b)
{
oldWalkSpeed = LocalPlayer.GetWalkSpeed();
oldRunSpeed = LocalPlayer.GetRunSpeed();
oldStrafeSpeed = LocalPlayer.GetStrafeSpeed();
if(dynamicPlayerPhysics)
{
oldWalkSpeed = LocalPlayer.GetWalkSpeed();
oldRunSpeed = LocalPlayer.GetRunSpeed();
oldStrafeSpeed = LocalPlayer.GetStrafeSpeed();
}
LocalPlayer.SetWalkSpeed(0f);
LocalPlayer.SetRunSpeed(0f);
LocalPlayer.SetStrafeSpeed(0f);
Expand Down Expand Up @@ -558,7 +564,7 @@ public void TakeOff()
if (!isFlying)
{
isFlying = true;
if (dynamicGravity)
if (dynamicPlayerPhysics)
{
oldGravityStrength = LocalPlayer.GetGravityStrength();
}
Expand Down Expand Up @@ -646,20 +652,23 @@ public void DisableBetaFeatures()
}

/// <summary>
/// Calling this function tells the script to pull in a new world gravity value. This is useful if you have a world that changes gravity often, but still want water systems to work.
/// Calling this function tells the script to pull in the worlds values for player physics. This is useful if you have a world that changes gravity or movement often, but still want water systems to work.
/// </summary>
/// <remarks>
/// This function is only useful if dynamic gravity is disabled. Otherwise, it will do nothing.
/// This function is only useful if dynamic player physics is disabled. Otherwise, it will do nothing.
/// </remarks>
public void UpdateGravity()
public void UpdatePlayerPhysics()
{
if (!dynamicGravity)
if (!dynamicPlayerPhysics)
{
oldGravityStrength = LocalPlayer.GetGravityStrength();
Logger.Log("Gravity updated.");
oldWalkSpeed = LocalPlayer.GetWalkSpeed();
oldRunSpeed = LocalPlayer.GetRunSpeed();
oldStrafeSpeed = LocalPlayer.GetStrafeSpeed();
Logger.Log("Player Physics updated.");
}
else {
Logger.Log("Dynamic gravity is enabled. Gravity will be updated automatically.");
Logger.Log("Dynamic Player Physics is enabled. Player Physics will be updated automatically.");
}
}
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void Start()
Log("Logging started");
}

const string color = "#FFA500";
const string color = "orange";
const string prefix = "[" + "<color=" + color + ">" + "OpenFlight" + "</color>" + "] ";

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1584,13 +1584,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: dynamicGravity
Data: dynamicPlayerPhysics
- Name: $v
Entry: 7
Data: 81|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: dynamicGravity
Data: dynamicPlayerPhysics
- Name: <UserType>k__BackingField
Entry: 9
Data: 17
Expand Down Expand Up @@ -1620,8 +1620,8 @@ MonoBehaviour:
Data: 83|UnityEngine.TooltipAttribute, UnityEngine.CoreModule
- Name: tooltip
Entry: 1
Data: 'If enabled, gravity will be saved each time the user takes off, instead
of just at the start of the world. (Default: false)'
Data: 'If enabled, gravity and movement will be saved each time the user takes
off, instead of just at the start of the world. (Default: false)'
- Name:
Entry: 8
Data:
Expand Down
2 changes: 1 addition & 1 deletion Packages/com.mattshark.openflight/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.mattshark.openflight",
"displayName": "OpenFlight",
"version": "1.5.2-beta.1",
"version": "1.5.2-beta.2",
"description": "A VRChat flight system that allow all kinds of avatars to fly. https://github.com/Mattshark89/OpenFlight-VRC",
"bugs" : {
"url" : "https://github.com/Mattshark89/OpenFlight-VRC/issues"
Expand Down
4 changes: 2 additions & 2 deletions docs/ScriptReference/Flight/WingFlightPlusGlide.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This is the script that dictates the velocity and movement of flight itself.
| gravityCurve | [AnimationCurve](https://docs.unity3d.com/ScriptReference/AnimationCurve.html) | Similar to Size Curve, but instead of modifying Flap Strength, it only affects Gravity. This value is ignored (Size Curve will be used instead) unless Use Gravity Curve is enabled |
| debugOutput | [TextMeshProUGUI](https://docs.unity3d.com/Packages/[email protected]/api/TMPro.TextMeshProUGUI.html) | If a GameObject with a TextMeshPro component is attached here, debug some basic info into it |
| bankingTurns | bool | Allows for players to tilt their arms to turn left or right while gliding |
| dynamicGravity | bool | If enabled, gravity will be saved each time the user takes off, instead of just at the start of the world. |
| dynamicPlayerPhysics | bool | If enabled, gravity and movement will be saved each time the user takes off, instead of just at the start of the world. |
| armspan | float | The armspan of the player |
| wingtipOffset | float | The wingtip offset of the player. Usually set by [AvatarDetection](/ScriptReference/Detection/AvatarDetection.md) |
| weight | float | The weight of the player. Usually set by [AvatarDetection](/ScriptReference/Detection/AvatarDetection.md) |
Expand All @@ -33,6 +33,6 @@ This is the script that dictates the velocity and movement of flight itself.
|-|-|-|
| EnableBetaFeatures | void | Enables beta features such as banking turns |
| DisableBetaFeatures | void | Disables beta features such as banking turns |
| UpdateGravity | void | Calling this function tells the script to pull in a new world gravity value. This is useful if you have a world that changes gravity often, but still want water systems to work. This function is only useful if dynamic gravity is disabled. Otherwise, it will do nothing. |
| UpdatePlayerPhysics | void | Calling this function tells the script to pull in the worlds values for player physics. This is useful if you have a world that changes gravity or movement often, but still want water systems to work. This function is only useful if dynamic player physics is disabled. Otherwise, it will do nothing. |
| InitializeDefaults | void | Tells the script to store its default values internally. This should only be done once upon world load |
| RestoreDefaults | void | Restores the default values of the script into itself. This will reset the script to the defaults that were set in unity itself, not the packages defaults |

0 comments on commit 5e18b19

Please sign in to comment.