local z=require(script.Parent.Parent.lib.t)local Y={"\066\097\099\107\065\099\099\101\115\115\111\114\121","\070\097\099\101\065\099\099\101\115\115\111\114\121";"\070\114\111\110\116\065\099\099\101\115\115\111\114\121";"\072\097\105\114\065\099\099\101\115\115\111\114\121";"\072\097\116\065\099\099\101\115\115\111\114\121","\078\101\099\107\065\099\099\101\115\115\111\114\121","\083\104\111\117\108\100\101\114\115\065\099\099\101\115\115\111\114\121";"\066\111\100\121\084\121\112\101\083\099\097\108\101","\068\101\112\116\104\083\099\097\108\101";"\072\101\097\100\083\099\097\108\101","\072\101\105\103\104\116\083\099\097\108\101","\080\114\111\112\111\114\116\105\111\110\083\099\097\108\101";"\087\105\100\116\104\083\099\097\108\101";"\067\108\105\109\098\065\110\105\109\097\116\105\111\110";"\070\097\108\108\065\110\105\109\097\116\105\111\110";"\073\100\108\101\065\110\105\109\097\116\105\111\110";"\074\117\109\112\065\110\105\109\097\116\105\111\110","\082\117\110\065\110\105\109\097\116\105\111\110","\083\119\105\109\065\110\105\109\097\116\105\111\110","\087\097\108\107\065\110\105\109\097\116\105\111\110","\070\097\099\101","\072\101\097\100";"\076\101\102\116\065\114\109";"\076\101\102\116\076\101\103";"\082\105\103\104\116\065\114\109";"\082\105\103\104\116\076\101\103";"\084\111\114\115\111","\071\114\097\112\104\105\099\084\083\104\105\114\116","\080\097\110\116\115";"\083\104\105\114\116";"\072\101\097\100\067\111\108\111\114","\076\101\102\116\065\114\109\067\111\108\111\114";"\076\101\102\116\076\101\103\067\111\108\111\114","\082\105\103\104\116\065\114\109\067\111\108\111\114";"\082\105\103\104\116\076\101\103\067\111\108\111\114","\084\111\114\115\111\067\111\108\111\114"}local Z=z.tuple(z.instanceOf("\072\117\109\097\110\111\105\100\068\101\115\099\114\105\112\116\105\111\110"),z.instanceOf("\072\117\109\097\110\111\105\100\068\101\115\099\114\105\112\116\105\111\110"))local function a(z,a)assert(Z(z,a))local U=Instance.new("\072\117\109\097\110\111\105\100\068\101\115\099\114\105\112\116\105\111\110")local G=z:Clone()for z,Y in pairs(Y)do if a[Y]~=U[Y]then G[Y]=a[Y]end end return G end return a
--[[
	Combines two HumanoidDescriptions into one.

	This allows you to easily mix and match a base HumanoidDescription with a
	predefined HumanoidDescription, so that players can still look like
	themselves with some alterations.

	Usage:

		local base = Instance.new("HumanoidDescription")
		base.HairAccessory = 1
		base.NeckAccessory = 3

		local override = Instance.new("HumanoidDescription")
		override.HairAccessory = 2

		local combined = combineDescriptions(base, override)

		print(combined.HairAccessory) -- 2
		print(combined.NeckAccessory) -- 3
]]

local t = require(script.Parent.Parent.lib.t)

local HUMANOID_DESCRIPTION_PROPS = {
	"BackAccessory", "FaceAccessory", "FrontAccessory", "HairAccessory",
	"HatAccessory", "NeckAccessory", "ShouldersAccessory",

	"BodyTypeScale", "DepthScale", "HeadScale", "HeightScale",
	"ProportionScale", "WidthScale",

	"ClimbAnimation", "FallAnimation", "IdleAnimation", "JumpAnimation",
	"RunAnimation", "SwimAnimation", "WalkAnimation",

	"Face", "Head", "LeftArm", "LeftLeg", "RightArm", "RightLeg", "Torso",

	"GraphicTShirt", "Pants", "Shirt",

	"HeadColor", "LeftArmColor", "LeftLegColor", "RightArmColor",
	"RightLegColor", "TorsoColor"
}

local combineDescriptionsCheck = t.tuple(
	t.instanceOf("HumanoidDescription"),
	t.instanceOf("HumanoidDescription")
)

local function combineDescriptions(base, override)
	assert(combineDescriptionsCheck(base, override))

	local defaults = Instance.new("HumanoidDescription")

	local description = base:Clone()
	for _, prop in pairs(HUMANOID_DESCRIPTION_PROPS) do
		if override[prop] ~= defaults[prop] then
			description[prop] = override[prop]
		end
	end
	return description
end

return combineDescriptions
