Jump to content

Changing the insulation, rain resistance and dapperness of clothing items and armor.


Recommended Posts

Self-explanatory title. What is the most clean and practical way to do that? If I wanted to make the Beekeeper Hat give 40% rain protection, how would I go about it? Same if I want to make the Cat Cap warmer and restore more sanity, etc.

Link to comment
Share on other sites

Changing a prefab is done by adding AddPrefabPostInit. To change hats waterproofness, insulation or dapperness you'll have to add this:

-- Waterproofness
	if inst.components.waterproofer == nil then -- Checking if the hat has a waterproofer component since not every hat has one
		inst:AddComponent("waterproofer") -- If it doesn't have one, add it
		inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_ABSOLUTE) -- Set waterproofness ( You can check tuning values in tuning.lua )
	else -- If it already has a waterproofer component
		inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_ABSOLUTE) -- Set waterproofness
	end

-- Insulation
	if inst.components.insulator == nil then -- Checking if the hat has a insulator component since not every hat has one
		inst:AddComponent("insulator") -- If it doesn't have one, add it
        inst.components.insulator:SetInsulation(TUNING.INSULATION_LARGE) -- Set insulation
	else -- If it already has a waterproofer component
        inst.components.insulator:SetInsulation(TUNING.INSULATION_LARGE) -- Set insulation
	end

-- Dapperness
	if inst.components.equippable ~= nil then -- Since every hat has the equippable component you only need to check if it isn't nil, you don't need to add it
		inst.components.equippable.dapperness = TUNING.DAPPERNESS_SUPERHUGE -- Set dapperness
	end

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...