Jump to content

[HELP] What is chopping component?


Recommended Posts

Hey, I need help finding out what the component would be for when an axe is used to chop a tree.

For example: This is for when a player uses a weapon to attack something,

inst.components.weapon.onattack

And think it would look something like this: inst.components.tool.onchop

 

Thank You :wilson_love:

Link to comment
Share on other sites

It is done by action instead of component function.

You can listen to performaction event instead.

	local function onchop(inst, data)
		if data then data = data.action end
		if data and data.action==GLOBAL.ACTIONS.CHOP then
			--do something here
			print("Doer is a", data.doer.prefab)
			print("Target is a", data.target.prefab)
		end
	end
	inst:ListenForEvent("performaction", onchop)

 

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