diff --git a/Cargo.lock b/Cargo.lock index 166813a5..7d31fdcb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -844,6 +844,15 @@ dependencies = [ "dirs-sys 0.3.7", ] +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys 0.4.1", +] + [[package]] name = "dirs-sys" version = "0.3.7" @@ -855,6 +864,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users 0.4.6", + "windows-sys 0.48.0", +] + [[package]] name = "dirs-sys" version = "0.5.0" @@ -1847,6 +1868,15 @@ dependencies = [ "libc", ] +[[package]] +name = "lz4_flex" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08ab2867e3eeeca90e844d1940eab391c9dc5228783db2ed999acbc0a9ed375a" +dependencies = [ + "twox-hash", +] + [[package]] name = "matchers" version = "0.2.0" @@ -2341,13 +2371,13 @@ dependencies = [ [[package]] name = "rbx_binary" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9573fee5e073d7b303f475c285197fdc8179468de66ca60ee115a58fbac99296" +checksum = "0d419f67c8012bf83569086e1208c541478b3b8e4f523deaa0b80d723fb5ef22" dependencies = [ "ahash", "log", - "lz4", + "lz4_flex", "profiling", "rbx_dom_weak", "rbx_reflection", @@ -2373,9 +2403,9 @@ dependencies = [ [[package]] name = "rbx_dom_weak" -version = "3.0.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04425cf6e9376e5486f4fb35906c120d1b1b45618a490318cf563fab1fa230a9" +checksum = "bc74878a4a801afc8014b14ede4b38015a13de5d29ab0095d5ed284a744253f6" dependencies = [ "ahash", "rbx_types", @@ -2385,9 +2415,9 @@ dependencies = [ [[package]] name = "rbx_reflection" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6d0d62baa613556b058a5f94a53b01cf0ccde0ea327ce03056e335b982e77e" +checksum = "565dd3430991f35443fa6d23cc239fade2110c5089deb6bae5de77c400df4fd2" dependencies = [ "rbx_types", "serde", @@ -2396,11 +2426,12 @@ dependencies = [ [[package]] name = "rbx_reflection_database" -version = "1.0.3+roblox-670" +version = "2.0.0+roblox-694" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22c05ef92528c0fb0cc580592a65ca178d3ea9beb07a1d9ca0a2503c4f3721c" +checksum = "844ceb61f23bad59b06d7299b69ff276579316eafa9857981da3012a6223f663" dependencies = [ - "lazy_static", + "dirs 5.0.1", + "log", "rbx_reflection", "rmp-serde", "serde", @@ -2408,9 +2439,9 @@ dependencies = [ [[package]] name = "rbx_types" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78e4fdde46493def107e5f923d82e813dec9b3eef52c2f75fbad3a716023eda2" +checksum = "03220ffce2bd06ad04f77a003cb807f2e5b2a18e97623066a5ac735a978398af" dependencies = [ "base64 0.13.1", "bitflags 1.3.2", @@ -2423,9 +2454,9 @@ dependencies = [ [[package]] name = "rbx_xml" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb623833c31cc43bbdaeb32f5e91db8ecd63fc46e438d0d268baf9e61539cf1c" +checksum = "be6c302cefe9c92ed09bcbb075cd24379271de135b0af331409a64c2ea3646ee" dependencies = [ "ahash", "base64 0.13.1", @@ -3315,6 +3346,12 @@ dependencies = [ "utf-8", ] +[[package]] +name = "twox-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c" + [[package]] name = "typeid" version = "1.0.3" @@ -3715,6 +3752,15 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -3751,6 +3797,21 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -3793,6 +3854,12 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -3805,6 +3872,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" @@ -3817,6 +3890,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -3841,6 +3920,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" @@ -3853,6 +3938,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" @@ -3865,6 +3956,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" @@ -3877,6 +3974,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" diff --git a/crates/lune-roblox/Cargo.toml b/crates/lune-roblox/Cargo.toml index 6ba6bd96..8bb4547a 100644 --- a/crates/lune-roblox/Cargo.toml +++ b/crates/lune-roblox/Cargo.toml @@ -23,10 +23,10 @@ glam = "0.30" rand = "0.9" thiserror = "2.0" -rbx_binary = "1.0" -rbx_dom_weak = "3.0" -rbx_reflection = "5.0" -rbx_reflection_database = "1.0" -rbx_xml = "1.0" +rbx_binary = "2.0" +rbx_dom_weak = "4.0" +rbx_reflection = "6.0" +rbx_reflection_database = "2.0" +rbx_xml = "2.0" lune-utils = { version = "0.3.3", optional = true, path = "../lune-utils" } diff --git a/crates/lune-roblox/src/datatypes/extension.rs b/crates/lune-roblox/src/datatypes/extension.rs index 2ad11252..55183b28 100644 --- a/crates/lune-roblox/src/datatypes/extension.rs +++ b/crates/lune-roblox/src/datatypes/extension.rs @@ -49,6 +49,7 @@ impl DomValueExt for DomType { Vector3int16 => "Vector3int16", OptionalCFrame => "OptionalCFrame", SecurityCapabilities => "SecurityCapabilities", + NetAssetRef => "NetAssetRef", _ => return None, }) } diff --git a/crates/lune-roblox/src/datatypes/types/content.rs b/crates/lune-roblox/src/datatypes/types/content.rs index 7ef0c5f8..9c22c603 100644 --- a/crates/lune-roblox/src/datatypes/types/content.rs +++ b/crates/lune-roblox/src/datatypes/types/content.rs @@ -24,7 +24,7 @@ impl LuaExportsTable for Content { let from_uri = |_: &Lua, uri: String| Ok(Self(ContentType::Uri(uri))); let from_object = |_: &Lua, obj: LuaUserDataRef| { - let database = rbx_reflection_database::get(); + let database = rbx_reflection_database::get().unwrap(); let instance_descriptor = database .classes .get("Instance") diff --git a/crates/lune-roblox/src/datatypes/types/enum.rs b/crates/lune-roblox/src/datatypes/types/enum.rs index 8c0a5ca5..27b6ddd4 100644 --- a/crates/lune-roblox/src/datatypes/types/enum.rs +++ b/crates/lune-roblox/src/datatypes/types/enum.rs @@ -17,7 +17,7 @@ pub struct Enum { impl Enum { pub(crate) fn from_name(name: impl AsRef) -> Option { - let db = rbx_reflection_database::get(); + let db = rbx_reflection_database::get().unwrap(); db.enums.get(name.as_ref()).map(Enum::from) } } diff --git a/crates/lune-roblox/src/datatypes/types/enums.rs b/crates/lune-roblox/src/datatypes/types/enums.rs index 173085de..ddecb582 100644 --- a/crates/lune-roblox/src/datatypes/types/enums.rs +++ b/crates/lune-roblox/src/datatypes/types/enums.rs @@ -16,7 +16,7 @@ impl LuaUserData for Enums { fn add_methods>(methods: &mut M) { // Methods methods.add_method("GetEnums", |_, _, ()| { - let db = rbx_reflection_database::get(); + let db = rbx_reflection_database::get().unwrap(); Ok(db.enums.values().map(Enum::from).collect::>()) }); methods.add_meta_method( diff --git a/crates/lune-roblox/src/datatypes/types/physical_properties.rs b/crates/lune-roblox/src/datatypes/types/physical_properties.rs index c719a8ac..2260aca8 100644 --- a/crates/lune-roblox/src/datatypes/types/physical_properties.rs +++ b/crates/lune-roblox/src/datatypes/types/physical_properties.rs @@ -21,6 +21,7 @@ pub struct PhysicalProperties { pub(crate) friction_weight: f32, pub(crate) elasticity: f32, pub(crate) elasticity_weight: f32, + pub(crate) acoustic_absorption: f32, } impl PhysicalProperties { @@ -34,6 +35,7 @@ impl PhysicalProperties { elasticity: props.3, friction_weight: props.4, elasticity_weight: props.5, + acoustic_absorption: props.6, }) } } @@ -43,7 +45,7 @@ impl LuaExportsTable for PhysicalProperties { fn create_exports_table(lua: Lua) -> LuaResult { type ArgsMaterial = LuaUserDataRef; - type ArgsNumbers = (f32, f32, f32, Option, Option); + type ArgsNumbers = (f32, f32, f32, Option, Option, Option); let physical_properties_new = |lua: &Lua, args: LuaMultiValue| { if let Ok(value) = ArgsMaterial::from_lua_multi(args.clone(), lua) { @@ -61,8 +63,14 @@ impl LuaExportsTable for PhysicalProperties { value.parent.desc.name ))) } - } else if let Ok((density, friction, elasticity, friction_weight, elasticity_weight)) = - ArgsNumbers::from_lua_multi(args, lua) + } else if let Ok(( + density, + friction, + elasticity, + friction_weight, + elasticity_weight, + acoustic_absorption, + )) = ArgsNumbers::from_lua_multi(args, lua) { Ok(PhysicalProperties { density, @@ -70,6 +78,7 @@ impl LuaExportsTable for PhysicalProperties { friction_weight: friction_weight.unwrap_or(1.0), elasticity, elasticity_weight: elasticity_weight.unwrap_or(1.0), + acoustic_absorption: acoustic_absorption.unwrap_or(1.0), }) } else { // FUTURE: Better error message here using given arg types @@ -92,6 +101,7 @@ impl LuaUserData for PhysicalProperties { fields.add_field_method_get("FrictionWeight", |_, this| Ok(this.friction_weight)); fields.add_field_method_get("Elasticity", |_, this| Ok(this.elasticity)); fields.add_field_method_get("ElasticityWeight", |_, this| Ok(this.elasticity_weight)); + fields.add_field_method_get("AcousticAbsorption", |_, this| Ok(this.acoustic_absorption)); } fn add_methods>(methods: &mut M) { @@ -117,24 +127,26 @@ impl fmt::Display for PhysicalProperties { impl From for PhysicalProperties { fn from(v: DomCustomPhysicalProperties) -> Self { Self { - density: v.density, - friction: v.friction, - friction_weight: v.friction_weight, - elasticity: v.elasticity, - elasticity_weight: v.elasticity_weight, + density: v.density(), + friction: v.friction(), + friction_weight: v.friction_weight(), + elasticity: v.elasticity(), + elasticity_weight: v.elasticity_weight(), + acoustic_absorption: v.acoustic_absorption(), } } } impl From for DomCustomPhysicalProperties { fn from(v: PhysicalProperties) -> Self { - DomCustomPhysicalProperties { - density: v.density, - friction: v.friction, - friction_weight: v.friction_weight, - elasticity: v.elasticity, - elasticity_weight: v.elasticity_weight, - } + DomCustomPhysicalProperties::new( + v.density, + v.friction, + v.elasticity, + v.friction_weight, + v.elasticity_weight, + v.acoustic_absorption, + ) } } @@ -145,44 +157,51 @@ impl From for DomCustomPhysicalProperties { to src, which can be ran in the Roblox Studio command bar */ - #[rustfmt::skip] -const MATERIAL_ENUM_MAP: &[(&str, f32, f32, f32, f32, f32)] = &[ - ("Plastic", 0.70, 0.30, 0.50, 1.00, 1.00), - ("Wood", 0.35, 0.48, 0.20, 1.00, 1.00), - ("Slate", 2.69, 0.40, 0.20, 1.00, 1.00), - ("Concrete", 2.40, 0.70, 0.20, 0.30, 1.00), - ("CorrodedMetal", 7.85, 0.70, 0.20, 1.00, 1.00), - ("DiamondPlate", 7.85, 0.35, 0.25, 1.00, 1.00), - ("Foil", 2.70, 0.40, 0.25, 1.00, 1.00), - ("Grass", 0.90, 0.40, 0.10, 1.00, 1.50), - ("Ice", 0.92, 0.02, 0.15, 3.00, 1.00), - ("Marble", 2.56, 0.20, 0.17, 1.00, 1.00), - ("Granite", 2.69, 0.40, 0.20, 1.00, 1.00), - ("Brick", 1.92, 0.80, 0.15, 0.30, 1.00), - ("Pebble", 2.40, 0.40, 0.17, 1.00, 1.50), - ("Sand", 1.60, 0.50, 0.05, 5.00, 2.50), - ("Fabric", 0.70, 0.35, 0.05, 1.00, 1.00), - ("SmoothPlastic", 0.70, 0.20, 0.50, 1.00, 1.00), - ("Metal", 7.85, 0.40, 0.25, 1.00, 1.00), - ("WoodPlanks", 0.35, 0.48, 0.20, 1.00, 1.00), - ("Cobblestone", 2.69, 0.50, 0.17, 1.00, 1.00), - ("Air", 0.01, 0.01, 0.01, 1.00, 1.00), - ("Water", 1.00, 0.00, 0.01, 1.00, 1.00), - ("Rock", 2.69, 0.50, 0.17, 1.00, 1.00), - ("Glacier", 0.92, 0.05, 0.15, 2.00, 1.00), - ("Snow", 0.90, 0.30, 0.03, 3.00, 4.00), - ("Sandstone", 2.69, 0.50, 0.15, 5.00, 1.00), - ("Mud", 0.90, 0.30, 0.07, 3.00, 4.00), - ("Basalt", 2.69, 0.70, 0.15, 0.30, 1.00), - ("Ground", 0.90, 0.45, 0.10, 1.00, 1.00), - ("CrackedLava", 2.69, 0.65, 0.15, 1.00, 1.00), - ("Neon", 0.70, 0.30, 0.20, 1.00, 1.00), - ("Glass", 2.40, 0.25, 0.20, 1.00, 1.00), - ("Asphalt", 2.36, 0.80, 0.20, 0.30, 1.00), - ("LeafyGrass", 0.90, 0.40, 0.10, 2.00, 2.00), - ("Salt", 2.16, 0.50, 0.05, 1.00, 1.00), - ("Limestone", 2.69, 0.50, 0.15, 1.00, 1.00), - ("Pavement", 2.69, 0.50, 0.17, 0.30, 1.00), - ("ForceField", 2.40, 0.25, 0.20, 1.00, 1.00), +const MATERIAL_ENUM_MAP: &[(&str, f32, f32, f32, f32, f32, f32)] = &[ + ("Plastic", 0.70, 0.30, 0.50, 1.00, 1.00, 0.30), + ("SmoothPlastic", 0.70, 0.20, 0.50, 1.00, 1.00, 0.20), + ("Neon", 0.70, 0.30, 0.20, 1.00, 1.00, 0.30), + ("Wood", 0.35, 0.48, 0.20, 1.00, 1.00, 0.25), + ("WoodPlanks", 0.35, 0.48, 0.20, 1.00, 1.00, 0.25), + ("Marble", 2.56, 0.20, 0.17, 1.00, 1.00, 0.01), + ("Slate", 2.69, 0.40, 0.20, 1.00, 1.00, 0.03), + ("Concrete", 2.40, 0.70, 0.20, 0.30, 1.00, 0.05), + ("Granite", 2.69, 0.40, 0.20, 1.00, 1.00, 0.20), + ("Brick", 1.92, 0.80, 0.15, 0.30, 1.00, 0.35), + ("Pebble", 2.40, 0.40, 0.17, 1.00, 1.50, 0.40), + ("Cobblestone", 2.69, 0.50, 0.17, 1.00, 1.00, 0.45), + ("Rock", 2.69, 0.50, 0.17, 1.00, 1.00, 0.15), + ("Sandstone", 2.69, 0.50, 0.15, 5.00, 1.00, 0.20), + ("Basalt", 2.69, 0.70, 0.15, 0.30, 1.00, 0.20), + ("CrackedLava", 2.69, 0.65, 0.15, 1.00, 1.00, 0.35), + ("Limestone", 2.69, 0.50, 0.15, 1.00, 1.00, 0.15), + ("Pavement", 2.69, 0.50, 0.17, 0.30, 1.00, 0.60), + ("CorrodedMetal", 7.85, 0.70, 0.20, 1.00, 1.00, 0.15), + ("DiamondPlate", 7.85, 0.35, 0.25, 1.00, 1.00, 0.05), + ("Foil", 2.70, 0.40, 0.25, 1.00, 1.00, 0.10), + ("Metal", 7.85, 0.40, 0.25, 1.00, 1.00, 0.10), + ("Grass", 0.90, 0.40, 0.10, 1.00, 1.50, 0.70), + ("LeafyGrass", 0.90, 0.40, 0.10, 2.00, 2.00, 0.75), + ("Sand", 1.60, 0.50, 0.05, 5.00, 2.50, 0.55), + ("Fabric", 0.70, 0.35, 0.05, 1.00, 1.00, 0.65), + ("Snow", 0.90, 0.30, 0.03, 3.00, 4.00, 0.80), + ("Mud", 0.90, 0.30, 0.07, 3.00, 4.00, 0.65), + ("Ground", 0.90, 0.45, 0.10, 1.00, 1.00, 0.60), + ("Asphalt", 2.36, 0.80, 0.20, 0.30, 1.00, 0.40), + ("Salt", 2.16, 0.50, 0.05, 1.00, 1.00, 0.15), + ("Ice", 0.92, 0.02, 0.15, 3.00, 1.00, 0.20), + ("Glacier", 0.92, 0.05, 0.15, 2.00, 1.00, 0.70), + ("Glass", 2.40, 0.25, 0.20, 1.00, 1.00, 0.10), + ("ForceField", 2.40, 0.25, 0.20, 1.00, 1.00, 0.00), + ("Air", 0.01, 0.01, 0.01, 1.00, 1.00, 0.01), + ("Water", 1.00, 0.00, 0.01, 1.00, 1.00, 0.01), + ("Cardboard", 0.70, 0.50, 0.05, 1.00, 2.00, 0.55), + ("Carpet", 1.10, 0.40, 0.25, 1.00, 2.00, 0.65), + ("CeramicTiles", 2.40, 0.51, 0.20, 1.00, 1.00, 0.04), + ("ClayRoofTiles", 2.00, 0.51, 0.20, 1.00, 1.00, 0.30), + ("RoofShingles", 2.36, 0.80, 0.20, 0.30, 1.00, 0.30), + ("Leather", 0.86, 0.35, 0.25, 1.00, 1.00, 0.65), + ("Plaster", 0.75, 0.60, 0.20, 0.30, 1.00, 0.30), + ("Rubber", 1.30, 1.50, 0.95, 3.00, 2.00, 0.50), ]; diff --git a/crates/lune-roblox/src/instance/registry.rs b/crates/lune-roblox/src/instance/registry.rs index 2403b9c9..96747cd7 100644 --- a/crates/lune-roblox/src/instance/registry.rs +++ b/crates/lune-roblox/src/instance/registry.rs @@ -248,7 +248,7 @@ impl InstanceRegistry { */ #[must_use] pub fn class_name_chain(class_name: &str) -> Vec<&str> { - let db = rbx_reflection_database::get(); + let db = rbx_reflection_database::get().unwrap(); let mut list = vec![class_name]; let mut current_name = class_name; diff --git a/crates/lune-roblox/src/reflection/mod.rs b/crates/lune-roblox/src/reflection/mod.rs index e22e07bc..e50f767e 100644 --- a/crates/lune-roblox/src/reflection/mod.rs +++ b/crates/lune-roblox/src/reflection/mod.rs @@ -135,7 +135,7 @@ impl LuaUserData for Database { impl Default for Database { fn default() -> Self { - Self(rbx_reflection_database::get()) + Self(rbx_reflection_database::get().unwrap()) } } diff --git a/crates/lune-roblox/src/shared/instance.rs b/crates/lune-roblox/src/shared/instance.rs index 9225bfd7..8f13dcd7 100644 --- a/crates/lune-roblox/src/shared/instance.rs +++ b/crates/lune-roblox/src/shared/instance.rs @@ -25,7 +25,7 @@ pub(crate) fn find_property_info( instance_class: impl AsRef, property_name: impl AsRef, ) -> Option { - let db = rbx_reflection_database::get(); + let db = rbx_reflection_database::get().unwrap(); let instance_class = instance_class.as_ref(); let property_name = property_name.as_ref(); @@ -103,7 +103,7 @@ pub(crate) fn find_property_info( Checks if an instance class exists in the reflection database. */ pub fn class_exists(class_name: impl AsRef) -> bool { - let db = rbx_reflection_database::get(); + let db = rbx_reflection_database::get().unwrap(); db.classes.contains_key(class_name.as_ref()) } @@ -122,7 +122,7 @@ pub fn class_is_a(instance_class: impl AsRef, class_name: impl AsRef) if class_name == "Instance" || instance_class == class_name { Some(true) } else { - let db = rbx_reflection_database::get(); + let db = rbx_reflection_database::get().unwrap(); while instance_class != class_name { let class_descriptor = db.classes.get(instance_class)?; @@ -149,7 +149,7 @@ pub fn class_is_a(instance_class: impl AsRef, class_name: impl AsRef) pub fn class_is_a_service(instance_class: impl AsRef) -> Option { let mut instance_class = instance_class.as_ref(); - let db = rbx_reflection_database::get(); + let db = rbx_reflection_database::get().unwrap(); loop { let class_descriptor = db.classes.get(instance_class)?; diff --git a/scripts/physical_properties_enum_map.luau b/scripts/physical_properties_enum_map.luau index 3ad9f93a..3b7cd12b 100644 --- a/scripts/physical_properties_enum_map.luau +++ b/scripts/physical_properties_enum_map.luau @@ -10,18 +10,19 @@ for _, enum in Enum.Material:GetEnumItems() do longestNameLen = math.max(longestNameLen, #enum.Name) end -contents ..= "\n#[rustfmt::skip]\nconst MATERIAL_ENUM_MAP: &[(&str, f32, f32, f32, f32, f32)] = &[\n" +contents ..= "\n#[rustfmt::skip]\nconst MATERIAL_ENUM_MAP: &[(&str, f32, f32, f32, f32, f32, f32)] = &[\n" for _, enum in Enum.Material:GetEnumItems() do local props = PhysicalProperties.new(enum) contents ..= string.format( - ' ("%s",%s %.2f, %.2f, %.2f, %.2f, %.2f),\n', + ' ("%s",%s %.2f, %.2f, %.2f, %.2f, %.2f, %.2f),\n', enum.Name, string.rep(" ", longestNameLen - #enum.Name), props.Density, props.Friction, props.Elasticity, props.FrictionWeight, - props.ElasticityWeight + props.ElasticityWeight, + props.AcousticAbsorption ) end contents ..= "];\n" diff --git a/tests/roblox/datatypes/PhysicalProperties.luau b/tests/roblox/datatypes/PhysicalProperties.luau index d87c3ddc..f43b37a4 100644 --- a/tests/roblox/datatypes/PhysicalProperties.luau +++ b/tests/roblox/datatypes/PhysicalProperties.luau @@ -26,12 +26,14 @@ end)) assert(PhysicalProperties.new(1, 2, 3).FrictionWeight == 1) assert(PhysicalProperties.new(1, 2, 3).ElasticityWeight == 1) +assert(PhysicalProperties.new(1, 2, 3).AcousticAbsorption == 1) -assert(PhysicalProperties.new(1, 2, 3, 4, 5).Density == 1) -assert(PhysicalProperties.new(1, 2, 3, 4, 5).Friction == 2) -assert(PhysicalProperties.new(1, 2, 3, 4, 5).Elasticity == 3) -assert(PhysicalProperties.new(1, 2, 3, 4, 5).FrictionWeight == 4) -assert(PhysicalProperties.new(1, 2, 3, 4, 5).ElasticityWeight == 5) +assert(PhysicalProperties.new(1, 2, 3, 4, 5, 6).Density == 1) +assert(PhysicalProperties.new(1, 2, 3, 4, 5, 6).Friction == 2) +assert(PhysicalProperties.new(1, 2, 3, 4, 5, 6).Elasticity == 3) +assert(PhysicalProperties.new(1, 2, 3, 4, 5, 6).FrictionWeight == 4) +assert(PhysicalProperties.new(1, 2, 3, 4, 5, 6).ElasticityWeight == 5) +assert(PhysicalProperties.new(1, 2, 3, 4, 5, 6).AcousticAbsorption == 6) local function fuzzyEq(n0: number, n1: number) return math.abs(n1 - n0) <= 0.0001 @@ -53,6 +55,7 @@ assert(fuzzyEq(sand.Friction, 0.5)) assert(fuzzyEq(sand.Elasticity, 0.05)) assert(fuzzyEq(sand.FrictionWeight, 5)) assert(fuzzyEq(sand.ElasticityWeight, 2.5)) +assert(fuzzyEq(sand.AcousticAbsorption, 0.55)) -- Ops diff --git a/tests/roblox/reflection/enums.luau b/tests/roblox/reflection/enums.luau index aa6b1633..b90be495 100644 --- a/tests/roblox/reflection/enums.luau +++ b/tests/roblox/reflection/enums.luau @@ -28,5 +28,9 @@ for _, enumName in db:GetEnumNames() do ) empty = false end - assert(not empty, "Enum items map must not be empty") + -- As of October 12 2025, the enum AudioCaptureMode is empty in Roblox API dumps. + -- TODO: Remove this if statement when AudioCaptureMode becomes non-empty. + if enumName ~= "AudioCaptureMode" then + assert(not empty, "Enum items map must not be empty") + end end