Garry's Mod

Garry's Mod

Constraint Information Tool
Thomas 10 Jan, 2015 @ 2:13pm
Incompatibility due to Wiremod
Currently, if your server has Wiremod along with Constraint Info, trying to left-click or right-click any constrained entities will generate a serverside error because net.WriteTable on line 202 is trying to write a function added by Wiremod.

To see what I mean, put PrintTable( constraint.GetTable( target ) ) before line 202, install Wiremod, weld 2 props together, and then left/right-click and you'll see a bunch of junk and then an inner table like this:

OnDieFunctions:
undo3:
Function = function: 0x2447ddb0
Name = undo3
Args:
1 = 3
2 = Player [1][[IJWTB] Thomas]

OnDieFunctions.undo<X>.Function is the root of the problem.

If you were to separate the constraintdata.Type and .Constraint fields into net.WriteString and net.WriteEntity, and then only net.WriteTable the constraintdata.Entity table, it might work. Something like this in both TOOL:LeftClick() and TOOL:RightClick():

local constraintdata = constraint.GetTable( target )

net.Start( "constraintinfo_update" )
net.WriteEntity( target )
net.WriteString( constraintdata.Type )
net.WriteEntity( constraintdata.Constraint )
net.WriteTable( constraintdata.Entity )
net.WriteBit( false ) -- do not show detailed info
net.Send( self:GetOwner() )

But you'll have to rewrite your menu a bit in ShowInfo() and Update() to reflect the changes, which means sorting them in a different manner in ShowInfo() and getting rid of the outermost loop in Update().

If this was on GitHub, I could propose a pull request, but I don't see one anywhere. :/