Jump to content

Questions regarding sanity reward for prototyping


Recommended Posts

It is possible. All you need to do is edit this builder function:

function Builder:UnlockRecipe(recname)
	local recipe = GetValidRecipe(recname)
	if recipe ~= nil and not recipe.nounlock then
	--print("Unlocking: ", recname)
		if self.inst.components.sanity ~= nil then
			self.inst.components.sanity:DoDelta(TUNING.SANITY_MED)
		end
		self:AddRecipe(recname)
		self.inst:PushEvent("unlockrecipe", { recipe = recname })
	end
end

 

To do that you need to put this in your modmain.lua:

AddComponentPostInit("builder", function(component)
	component.UnlockRecipe = function(self, recname)
		local recipe = GLOBAL.GetValidRecipe(recname)

		if recipe and not recipe.nounlock then
			if self.inst.components.sanity then
				self.inst.components.sanity:DoDelta("your_value")
			end

			self:AddRecipe(recname)
			self.inst:PushEvent("unlockrecipe", { recipe = recname })
		end
	end
end)

 

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