Creating a workaround
Learn to code your own workaround
Last updated
Learn to code your own workaround
Last updated
A workaround is a system which can be toggled on & off (in the Base
's page menu). Its purpose is mainly to allow users to choose to fix issues & conflicts with external addons. A workaround can be targeted for a specific realm (server, client or both) in order to fix all eventual issues.
All workarounds (except during hot reload) are initialized during the GM:InitPostEntity
hook, assuming that during this time, all fixable hooks should be defined.
See these two examples from the base:
There are multiple ways of setting up the file structure to define the workarounds:
creating the Lua file in lua/autorun/
creating the Lua file in lua/guthscp/base/workarounds/
creating the Lua file in a folder of your module and add it to your requires
(recommended)
The workaround must be defined as shared (both for server & client)
Open your script and start by creating a WORKAROUND
local table which you register as follow:
The WORKAROUND
table is what defines your workaround, it will contains properties like the name, the targeted realm & methods that you will define. You also have to specify the identifier of your workaround yourself in the registering function call: choose a unique & recognizable name so it doesn't conflict with any other workarounds.
Now, you should fill the required properties:
This is the bare minimum to make a workaround register in the system and to see it in the guthscpbase
menu. Of course, edit them as you'll like.
TODO
For more information about the workaround class, read this .