Skip to content

Commit 5b3b596

Browse files
Sprint Drei (#896)
2 parents c35e980 + 4afb5d9 commit 5b3b596

File tree

188 files changed

+21364
-8551
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+21364
-8551
lines changed

.github/workflows/API.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: API
22

33
on:
4+
workflow_dispatch: {}
45
push:
56
branches: [ master, dev ]
67
pull_request:

.github/workflows/ClangFormat.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Format Validation (Clang)
22

33
on:
44
workflow_dispatch: {}
5-
push:
5+
push:
66
branches: [ master, dev ]
77
pull_request:
88
branches: [ master, dev ]
@@ -12,12 +12,12 @@ jobs:
1212
name: Run Clang Format Validation Script
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Get Clang Format
15+
- name: Get Clang Format 16
1616
run: |
17+
sudo wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
18+
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main"
1719
sudo apt-get update
18-
sudo apt-get install --no-install-recommends -y
19-
sudo apt-get install clang-format-15
20-
sudo mv /usr/bin/clang-format-15 /usr/bin/clang-format
20+
sudo apt-get install -y clang-format-16
2121
- name: Checkout Code
2222
uses: actions/checkout@v2
2323
- name: Python Setup

api/Api/AssetManager/AudioClipAsset.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using UnityEngine;
44
using UnityEngine.Networking;
55

6+
#nullable enable
7+
68
namespace SynthesisAPI.AssetManager
79
{
810
public class AudioClipAsset : Asset
@@ -15,6 +17,11 @@ public class AudioClipAsset : Asset
1517
public AudioClipAsset(string name, Permissions perm, string sourcePath)
1618
{
1719
Init(name, perm, sourcePath);
20+
21+
// create empty clip
22+
_clip = AudioClip.Create("EmptyClip", 44100, 1, 44100, false);
23+
float[] data = new float[44100];
24+
_clip.SetData(data, 0);
1825
}
1926

2027
public override IEntry Load(byte[] data)
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
using System;
22
using SynthesisAPI.Modules.Attributes;
33

4+
#nullable enable
5+
46
namespace SynthesisAPI.EnvironmentManager.Components {
57
public class BundleMarker : Component {
68
public string Name { get; set; }
9+
10+
public BundleMarker() {
11+
Name = "";
12+
}
713
}
8-
}
14+
}

api/Api/EnvironmentManager/Components/Joints.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
using System.Runtime.CompilerServices;
77
using System.Text;
88

9+
#nullable enable
10+
911
namespace SynthesisAPI.EnvironmentManager.Components
1012
{
1113
/// <summary>
@@ -17,10 +19,10 @@ public class Joints : Component
1719
private static List<Joints> _allJointContainers = new List<Joints>();
1820

1921
public delegate void JointChanged(IJoint joint);
20-
public static event JointChanged GlobalAddJoint;
21-
internal event JointChanged AddJoint;
22-
public static event JointChanged GlobalRemoveJoint;
23-
internal event JointChanged RemoveJoint;
22+
public static event JointChanged? GlobalAddJoint;
23+
internal event JointChanged? AddJoint;
24+
public static event JointChanged? GlobalRemoveJoint;
25+
internal event JointChanged? RemoveJoint;
2426

2527
private List<IJoint> _joints = new List<IJoint>();
2628
public List<IJoint> AllJoints {
@@ -68,7 +70,7 @@ public override bool Equals(object obj) {
6870
if (!(obj is Joints))
6971
return false;
7072

71-
return (obj as Joints).GetHashCode() == GetHashCode();
73+
return (obj as Joints)?.GetHashCode() == GetHashCode();
7274
}
7375
public override int GetHashCode() => _guid.GetHashCode();
7476
}

api/Api/EventBus/Analytics.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using System.Threading;
55
using System.Threading.Tasks;
66

7+
#nullable enable
8+
79
namespace SynthesisAPI.EventBus
810
{
911
public static class Analytics
@@ -522,7 +524,7 @@ private Inner()
522524
StartTimes = new List<KeyValuePair<string, float>>();
523525
}
524526

525-
private static Inner _inst;
527+
private static Inner? _inst;
526528
public static Inner InnerInstance => _inst ??= new Inner();
527529
}
528530
private static Queue<KeyValuePair<string, string>> LoggedData => Instance.LoggedData;

api/Api/EventBus/EventBus.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ public static void ResetAllListeners()
181181
if (AppDomain.CurrentDomain.GetAssemblies()
182182
.Any(a => a.FullName.ToLowerInvariant().StartsWith("nunit.framework")))
183183
{
184-
_inst.TypeSubscribers = new Dictionary<string, EventCallback>();
185-
_inst.TagSubscribers = new Dictionary<string, EventCallback>();
184+
_inst!.TypeSubscribers = new Dictionary<string, EventCallback>();
185+
_inst!.TagSubscribers = new Dictionary<string, EventCallback>();
186186
}
187187
else
188188
{
@@ -205,5 +205,4 @@ private Inner()
205205

206206
private static Inner Instance => Inner.InnerInstance;
207207
}
208-
209208
}

api/Api/InputManager/Inputs.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
using Logger = UnityEngine.Logger;
99
using Math = System.Math;
1010

11+
#nullable enable
12+
1113
namespace SynthesisAPI.InputManager.Inputs
1214
{
1315
// TODO: Should I add HashCodes?
@@ -77,7 +79,7 @@ public virtual Analog WithModifier(int newMod)
7779
public override bool Equals(object obj) {
7880
if (ReferenceEquals(obj, null) || !(obj is Analog))
7981
return false;
80-
return (obj as Analog).GetHashCode() == GetHashCode();
82+
return (obj as Analog)?.GetHashCode() == GetHashCode();
8183
}
8284

8385
public override int GetHashCode()
@@ -147,7 +149,7 @@ public override Analog WithModifier(int newMod)
147149
public override bool Equals(object obj) {
148150
if (ReferenceEquals(obj, null) || !(obj is Digital))
149151
return false;
150-
return (obj as Digital).GetHashCode() == GetHashCode();
152+
return (obj as Digital)?.GetHashCode() == GetHashCode();
151153
}
152154

153155
public override int GetHashCode()

api/Api/Mirabuf/Appearance.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
using Logger = SynthesisAPI.Utilities.Logger;
66

7+
#nullable enable
8+
79
namespace Mirabuf.Material {
810
public partial class Appearance {
9-
private UMaterial _unityMaterial = null;
11+
private UMaterial? _unityMaterial = null;
1012
public UMaterial UnityMaterial {
1113
get {
1214
if (_unityMaterial == null) {
@@ -53,7 +55,7 @@ public UMaterial UnityMaterial {
5355
public const string OPAQUE_COLOR = "Color_2aa135b32e7e4808b9be05c544657380";
5456
public const string OPAQUE_SMOOTHNESS = "Vector1_dd87d7fcd1f1419f894566001d248ab9";
5557
public const string OPAQUE_METALLIC = "OPAQUE_METALLIC";
56-
private static Shader _defaultOpaqueShader = null;
58+
private static Shader? _defaultOpaqueShader = null;
5759
public static Shader DefaultOpaqueShader {
5860
get {
5961
if (_defaultOpaqueShader == null) {
@@ -64,7 +66,7 @@ public static Shader DefaultOpaqueShader {
6466
}
6567
public const string TRANSPARENT_COLOR = "Color_48545d7793c14f3d9e1dd2264f072068";
6668
public const string TRANSPARENT_SMOOTHNESS = "Vector1_d66a0e8b289a457c85b3b4408b4f3c2f";
67-
private static Shader _defaultTransparentShader = null;
69+
private static Shader? _defaultTransparentShader = null;
6870
public static Shader DefaultTransparentShader {
6971
get {
7072
if (_defaultTransparentShader == null) {

api/Api/Mirabuf/SimpleMotor.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ namespace Mirabuf.Motor {
66
public partial class SimpleMotor {
77

88
// Extremely arbitrary
9-
public const float METRIC_TO_UNITY_TORQUE = 2000f / 50f;
109

1110
private UnityEngine.JointMotor? _unityMotor;
1211
public UnityEngine.JointMotor UnityMotor {
1312
get {
1413
if (!_unityMotor.HasValue) {
1514
_unityMotor = new UnityEngine.JointMotor {
16-
force = StallTorque * METRIC_TO_UNITY_TORQUE,
17-
targetVelocity = MaxVelocity * UnityEngine.Mathf.Rad2Deg,
15+
force = StallTorque,
16+
targetVelocity = MaxVelocity,
1817
freeSpin = BrakingConstant > 0
1918
};
2019
}

0 commit comments

Comments
 (0)