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:
Joe 2026-01-20 21:49:42 -06:00
parent 196cf7aed7
commit 06457bc0db

View file

@ -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