mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 21:10:36 +00:00
28 lines
721 B
Lua
28 lines
721 B
Lua
--!nocheck
|
|
|
|
-- NOTE: This must be ran in Roblox Studio to get up-to-date enum values
|
|
|
|
local contents = ""
|
|
|
|
local longestNameLen = 0
|
|
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"
|
|
for _, enum in Enum.Material:GetEnumItems() do
|
|
local props = PhysicalProperties.new(enum)
|
|
contents ..= string.format(
|
|
' ("%s",%s %.2f, %.2f, %.2f, %.2f, %.2f),\n',
|
|
enum.Name,
|
|
string.rep(" ", longestNameLen - #enum.Name),
|
|
props.Density,
|
|
props.Friction,
|
|
props.Elasticity,
|
|
props.FrictionWeight,
|
|
props.ElasticityWeight
|
|
)
|
|
end
|
|
contents ..= "];\n"
|
|
|
|
print(contents)
|