diff --git a/plugin/src/PatchTree.lua b/plugin/src/PatchTree.lua index 66116ebc..c33255d1 100644 --- a/plugin/src/PatchTree.lua +++ b/plugin/src/PatchTree.lua @@ -256,24 +256,41 @@ function PatchTree.build(patch, instanceMap, changeListHeaders) addProp("Name", instance.Name, change.changedName) end - for prop, incoming in change.changedProperties do - local incomingSuccess, incomingValue = decodeValue(incoming, instanceMap) - local currentSuccess, currentValue = getProperty(instance, prop) + for prop, incoming in change.changedProperties do + local incomingSuccess, incomingValue = decodeValue(incoming, instanceMap) + local currentSuccess, currentValue = getProperty(instance, prop) - -- Check if this is a Source property - count line differences - if prop == "Source" and currentSuccess and incomingSuccess then - hasSourceChange = true - totalLineChanges, whitespaceLineChanges = - WhitespaceUtil.CountLineDifferences(currentValue, incomingValue) + -- 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 - - addProp( - prop, - if currentSuccess then currentValue else "[Error]", - if incomingSuccess then incomingValue else select(2, next(incoming)) - ) end + -- Check if this is a Source property - count line differences + if prop == "Source" and currentSuccess and incomingSuccess then + hasSourceChange = true + totalLineChanges, whitespaceLineChanges = + WhitespaceUtil.CountLineDifferences(currentValue, incomingValue) + end + + addProp( + prop, + if currentSuccess then currentValue else "[Error]", + if incomingSuccess then incomingValue else select(2, next(incoming)) + ) + end + -- Count non-Source property changes local propCount = changeIndex - (if hasSourceChange then 1 else 0)