diff --git a/Generated/Classes.cs b/Generated/Classes.cs index 1539527..a4359ac 100644 --- a/Generated/Classes.cs +++ b/Generated/Classes.cs @@ -1,5 +1,5 @@ // Auto-generated list of creatable Roblox classes. -// Updated as of 0.469.0.418830 +// Updated as of 0.470.0.419147 using System; @@ -648,6 +648,7 @@ namespace RobloxFiles public class HingeConstraint : Constraint { public ActuatorType ActuatorType = ActuatorType.None; + public float AngularResponsiveness = 45; public float AngularSpeed; public float AngularVelocity; public bool LimitsEnabled; @@ -690,6 +691,7 @@ namespace RobloxFiles { public ActuatorType ActuatorType = ActuatorType.None; public bool LimitsEnabled; + public float LinearResponsiveness = 45; public float LowerLimit; public float MotorMaxAcceleration = float.MaxValue; public float MotorMaxForce; @@ -706,6 +708,7 @@ namespace RobloxFiles { public ActuatorType AngularActuatorType = ActuatorType.None; public bool AngularLimitsEnabled; + public float AngularResponsiveness = 45; public float AngularRestitution; public float AngularSpeed; public float AngularVelocity; @@ -743,6 +746,18 @@ namespace RobloxFiles public Vector3 Torque_ = new Vector3(); } + public class TorsionSpringConstraint : Constraint + { + public float Coils = 8; + public float Damping = 0.01f; + public bool LimitEnabled; + public float MaxAngle = 45; + public float MaxTorque = float.MaxValue; + public float Radius = 0.4f; + public float Restitution; + public float Stiffness = 100; + } + public class UniversalConstraint : Constraint { public bool LimitsEnabled; @@ -2191,6 +2206,7 @@ namespace RobloxFiles public bool Locked; public bool Massless; public Material Material = Material.Plastic; + public CFrame PivotOffset = new CFrame(); public Vector3 Position { @@ -2392,6 +2408,7 @@ namespace RobloxFiles public SharedString ModelMeshData = SharedString.FromBase64("yuZpQdnvvUBOTYh1jqZ2cA=="); public Vector3 ModelMeshSize = new Vector3(); public BasePart PrimaryPart; + public CFrame WorldPivot = new CFrame(); } public class Actor : Model diff --git a/Generated/Enums.cs b/Generated/Enums.cs index e7044ce..c3e3f85 100644 --- a/Generated/Enums.cs +++ b/Generated/Enums.cs @@ -1,5 +1,5 @@ // Auto-generated list of Roblox enums. -// Updated as of 0.469.0.418830 +// Updated as of 0.470.0.419147 namespace RobloxFiles.Enums { diff --git a/RobloxFileFormat.dll b/RobloxFileFormat.dll index 5c6c938..fb2d56b 100644 Binary files a/RobloxFileFormat.dll and b/RobloxFileFormat.dll differ diff --git a/Tree/Instance.cs b/Tree/Instance.cs index 904f440..4cc0799 100644 --- a/Tree/Instance.cs +++ b/Tree/Instance.cs @@ -137,11 +137,9 @@ namespace RobloxFiles { if (AttributesImpl.TryGetValue(key, out Attribute attr)) { - object result = attr.Value; - - if (result is T) + if (attr.Value is T result) { - value = (T)result; + value = result; return true; } } @@ -193,8 +191,7 @@ namespace RobloxFiles /// The instance whose ancestry will be tested against this Instance. public bool IsDescendantOf(Instance ancestor) { - Contract.Requires(ancestor != null); - return ancestor.IsAncestorOf(this); + return ancestor?.IsAncestorOf(this) ?? false; } /// @@ -203,9 +200,7 @@ namespace RobloxFiles [Obsolete("Use the `is` operator instead.")] public bool IsA() where T : Instance { - Type myType = GetType(); - Type classType = typeof(T); - return classType.IsAssignableFrom(myType); + return this is T; } /// @@ -214,14 +209,10 @@ namespace RobloxFiles /// /// The type of Instance to cast to. /// The instance as the type '' if it can be converted, or null. + [Obsolete("Use the `as` operator instead.")] public T Cast() where T : Instance { - T result = null; - - if (this is T) - result = this as T; - - return result; + return this as T; } /// diff --git a/UnitTest/Program.cs b/UnitTest/Program.cs index eb43cc2..9b62385 100644 --- a/UnitTest/Program.cs +++ b/UnitTest/Program.cs @@ -1,18 +1,11 @@ using System; -using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Linq; -using System.Text.RegularExpressions; - -using RobloxFiles.DataTypes; namespace RobloxFiles.UnitTest { static class Program { - const string pattern = "\\d+$"; - static void PrintTreeImpl(Instance inst, int stack = 0) { string padding = ""; @@ -24,15 +17,20 @@ namespace RobloxFiles.UnitTest switch (inst.ClassName) { case "Script": + { extension = ".server.lua"; break; + } case "LocalScript": + { extension = ".client.lua"; break; + } case "ModuleScript": + { extension = ".lua"; break; - default: break; + } } Console.WriteLine($"{padding}{inst.Name}{extension}"); @@ -54,57 +52,7 @@ namespace RobloxFiles.UnitTest Debugger.Break(); } - - static void CountAssets(string path) - { - Console.WriteLine("Opening file..."); - RobloxFile target = RobloxFile.Open(path); - - var workspace = target.FindFirstChildOfClass(); - var assets = new HashSet(); - - if (workspace == null) - { - Console.WriteLine("No workspace found!"); - Debugger.Break(); - - return; - } - - foreach (Instance inst in workspace.GetDescendants()) - { - var instPath = inst.GetFullName(); - var props = inst.Properties; - - foreach (var prop in props) - { - var propName = prop.Key; - var content = prop.Value.CastValue(); - - if (content != null) - { - string url = content.Url.Trim(); - - var id = Regex - .Match(url, pattern)? - .Value; - - if (id != null && id.Length > 5) - url = "rbxassetid://" + id; - - if (url.Length > 0 && !assets.Contains(url)) - { - Console.WriteLine($"[{url}] at {instPath}.{propName}"); - assets.Add(url); - } - } - } - } - - Console.WriteLine("Done! Press any key to continue..."); - Console.Read(); - } - + [STAThread] static void Main(string[] args) { @@ -120,8 +68,6 @@ namespace RobloxFiles.UnitTest RobloxFile bin = RobloxFile.Open(@"Files\Binary.rbxl"); RobloxFile xml = RobloxFile.Open(@"Files\Xml.rbxlx"); - Folder attributes = bin.FindFirstChild("Attributes", true); - Console.WriteLine("Files opened! Pausing execution for debugger analysis..."); Debugger.Break();