You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extend this API to allow registering custom chat commands for tools, for example
localmytool=metatool:register_tool("mytool", {
do_apocalypse=function(style) {
ifstyle==nilorstyle=="local" then-- here we should start just small and simple apocalypse, maybe only destroy earth or moon?elseifstyle=="global" then-- here we should probably loop through players, maybe kill them all and then start replacing air with lavaelse-- invalid apocalypse style givenend
}
...otherstuffrequiredfortoolregistrationgoesaroundhere...
}
-- Chat command registration:mytool:register_command(
"apocalypse",
"Initiates apocalypse, usage:\n/${cmd} [local|global]",
"do_apocalypse"
)
Above should then add chat command /mytool:apocalypse that parses arguments and calls defined method do_apocalypse.
Some frames and same format for all registered commands with automated argument parsing / forwarding for predefined tool method.
Probably keep it simple and straightforward other than above preprocessing. Actual tool definition method should still be responsible for actual functionality and argument checks.
Possible extra arguments for registration method:
Required privileges?
Possible extra arguments for callback method:
Include coordinates / position?
Include pointed node and coords for that node?
The text was updated successfully, but these errors were encountered:
Allow registering custom chat commands for tools through MetaTool API.
There's already basic chat command API available (https://github.com/S-S-X/metatool/blob/master/metatool/command.lua) but currently it only implements single command
/metatool:give
which is automatically applied for administrative tools that require some predefined privileges (https://github.com/S-S-X/metatool/blob/master/metatool/api.lua#L91).Extend this API to allow registering custom chat commands for tools, for example
Above should then add chat command
/mytool:apocalypse
that parses arguments and calls defined methoddo_apocalypse
.Some frames and same format for all registered commands with automated argument parsing / forwarding for predefined tool method.
Probably keep it simple and straightforward other than above preprocessing. Actual tool definition method should still be responsible for actual functionality and argument checks.
Possible extra arguments for registration method:
Possible extra arguments for callback method:
The text was updated successfully, but these errors were encountered: