Community Forum

Register Hand Tool

Forum Overview >> Farming Simulator 17

CategoryFarming Simulator 17
Created11.08.2017 18:42

Grzegorz V (vnsfdg21) 11.08.2017 18:42
Can I find out exactly how the ".lua" file should look like to register a new Handtool ?

I have reviewed all the documentation for the Handtool and nothing has been found.
The most useful would be somehow like a coincide to look complete line: "registerHandTool (string typeName, table classObject)"

May I ask for some example, based on a chainsaw?

Emil Drefers (Unknown) 14.08.2017 06:52

the registration for chauinsaw looks like:
registerHandTool("chainsaw", Chainsaw);

If u stick to the
It should be all good, I'ld say.

So, the first lines of Chainsaw.lua look like:

Chainsaw = {}

local Chainsaw_mt = Class(Chainsaw, HandTool)

InitStaticObjectClass(Chainsaw, "Chainsaw", ObjectIds.OBJECT_CHAINSAW)

function Chainsaw:new(isServer, isClient, customMt)
local mt = customMt
if mt == nil then
mt = Chainsaw_mt

local self = HandTool:new(isServer, isClient, mt)
return self

I think the rest is listed in the docs at GDN.


Grzegorz V (vnsfdg21) 15.08.2017 09:26
Thanks for the great example :D

Note: Log in to post. Create a new account here.