Posts: 313
	Threads: 32
	Joined: Feb 2012
	
Thanks: 98
	Given 14 thank(s) in 13 post(s)
	 
	
	
		Trying to figure out the best way to do it:
1. Use HOOK_PRE_CRAFTING to determinate which objects are in grid, if there are two of same kind (and nothing else) - set output item and health manually?
2. Use HOOK_PRE_CRAFTING, but add recipe in crafting.txt (will it count damaged items as well?) instead of manual parsing and set output health only? (because output item will be set in recipe)
Also: should I change output health in HOOK_POST_CRAFTING as well?
	
	
	
	
	
 
 
	
	
	
		
	Posts: 1,450
	Threads: 53
	Joined: Feb 2011
	
Thanks: 15
	Given 130 thank(s) in 99 post(s)
	 
	
		
		
		06-14-2012, 04:09 AM 
(This post was last modified: 06-14-2012, 04:14 AM by FakeTruth.)
		
	 
	
		I think you should use HOOK_CRAFTING_NO_RECIPE, because that way no unnecessary hooks are called.
Figure out whether there are two of the same items (and only those two) in the crafting grid.
Then use the ItemCategory:IsTool( ItemID ) function to determine it's a tool
Then set the output item to have the ID of the input items, but with less damage (use the damage formula thingy)
	
	
	
	
	
 
 
	
	
	
		
	Posts: 313
	Threads: 32
	Joined: Feb 2012
	
Thanks: 98
	Given 14 thank(s) in 13 post(s)
	 
	
	
		I'm not sure if ItemCategory:IsTool() is accessable in Lua, I'll test it right now...
Could we have IsArmor as well?
	
	
	
	
	
 
 
	
	
	
		
	Posts: 1,450
	Threads: 53
	Joined: Feb 2011
	
Thanks: 15
	Given 130 thank(s) in 99 post(s)
	 
	
	
		I just exported all the ItemCategory functions, and added the IsTool function. I could also add armor functions yea