I’m trying to forward calls to gmod_tool:GetViewModelPosition() to the stool object, like this:
local gmod_tool = weapons.GetStored("gmod_tool")
local old_getviewmodelposition = gmod_tool.GetViewModelPosition
function gmod_tool:GetViewModelPosition(...)
local t = self:GetToolObject()
if t and t.GetViewModelPosition then
return t:GetViewModelPosition(...)
else
return old_getviewmodelposition(self, ...)
end
end
This doesn’t work. The function is never called. No changes in that gmod_tool table get reflected in actual toolgun instances. getmetatable(a_toolgun_instance) returns the Weapon metatable.
So my question is, how would I make this work?