Jump to content

Recommended Posts

Thought this would be as simple as adding finiteuses, but no luck. This is concerning adding a new razor item and adding durability to the old item (since there's no point making a "better" razor if the vanilla one is unbreakable). Using prefabpostinit for the razor, and defined within the prefab file for the new razor.

Basically it shows durability (100%) but no amount of shaving beefalo lowers the durability on either item.

Anyone point me to what I'm missing?

modmain.lua

goldenrazor.lua

More Gold Tools (DST).rar

Edited by justjasper

something like this should work; (modmain)

AddComponentPostInit("beard", function(self)
	local oldShave = self.Shave
	function self:Shave(who, withwhat)
		local result = oldShave(self, who, withwhat)
		
		if result and withwhat and withwhat.components.finiteuses then
			withwhat.components.finiteuses:Use(1)
		end
		
		return result
	end
end)

 

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
×
  • Create New...