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
Hi
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
Hi,

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

If u stick to the
https://gdn.giants-software.com/documentation_scripting.php?version=script&category=63&class=3342
or
https://gdn.giants-software.com/documentation_scripting.php?version=script&category=63&class=3338
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
end

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


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

Cheers,
Emil

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


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