mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-25 04:54:07 +00:00
Enhance property handling in PatchTree.build function to support EnumItem conversion for incoming raw numbers. Improved readability by restructuring property change checks and maintaining line change calculations for Source properties.
This commit is contained in:
parent
196cf7aed7
commit
06457bc0db
1 changed files with 31 additions and 14 deletions
|
|
@ -260,6 +260,23 @@ function PatchTree.build(patch, instanceMap, changeListHeaders)
|
|||
local incomingSuccess, incomingValue = decodeValue(incoming, instanceMap)
|
||||
local currentSuccess, currentValue = getProperty(instance, prop)
|
||||
|
||||
-- If incoming is a raw number and current is an EnumItem, convert incoming
|
||||
-- to the proper EnumItem for better display (server sends Enum as raw numbers)
|
||||
if
|
||||
incomingSuccess
|
||||
and currentSuccess
|
||||
and typeof(incomingValue) == "number"
|
||||
and typeof(currentValue) == "EnumItem"
|
||||
then
|
||||
local enumType = currentValue.EnumType
|
||||
local ok, converted = pcall(function()
|
||||
return enumType:FromValue(incomingValue)
|
||||
end)
|
||||
if ok and converted then
|
||||
incomingValue = converted
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if this is a Source property - count line differences
|
||||
if prop == "Source" and currentSuccess and incomingSuccess then
|
||||
hasSourceChange = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue