Open LoganDark opened 2 years ago
It might be possible to have some function that generates these description entries for every type on the client.
We could add call kind of E2VguiLib.registerE2HelperDefaultFunctionsForType("xdf")
function that will add the default function entries for that specific type.
e.g.
function E2VguiLib.registerE2HelperDefaultFunctionsForType(type)
E2Helper.Descriptions["setPos(" .. type .. ":nn)"] = "Sets the position."
E2Helper.Descriptions["setPos(" .. type .. ":xv2)"] = "Sets the position."
E2Helper.Descriptions["getPos(" .. type .. ":e)"] = "Returns the position."
E2Helper.Descriptions["setSize(" .. type .. ":nn)"] = "Sets the size."
...
end
Yeah absolutely, that was the plan. Either iterate through all custom types and add the e2helper descriptions for each of them, or have each type's file call a function to register its common methods.
I would prefer the calling method, since the vgui_types
table is only available serverside (see E2VguiCore.RegisterVguiElementType
) so copying/syncing it to the client would be redudant.
This would also make it easier to add specific parameters later, if we need them, on a per-file/per-type basis.
This is an internal maintainability issue but the E2Helper descriptions for the default methods should really be defined in one file. Once my PRs are merged I'll see if I can cook up a solution to this that doesn't require any hardcoding or server->client information transfer.