Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create bind script #15

Open
JayFoxRox opened this issue Jan 27, 2019 · 2 comments · May be fixed by #47
Open

Create bind script #15

JayFoxRox opened this issue Jan 27, 2019 · 2 comments · May be fixed by #47

Comments

@JayFoxRox
Copy link
Collaborator

I'm not sure if this might be a feature of VC-MP already, but we should consider a key-binding script.

So /bind P v 191 would bind /v 191 to the P key.

This should be trivial to implement if we extend the script-loader so that scripts can inject their own commands.

We could then create default bindings by also manually injecting bind commands, which would make the overall system cleaner, as all keybinds would be located in one central script (although it might make context-sensitive key-reuse a lot harder).

@dracc
Copy link
Owner

dracc commented Feb 15, 2019

I could take a stab at this - if events are callable?

@JayFoxRox
Copy link
Collaborator Author

Sort of, it's a bit tricky to be honest, because if the bind even has its own OnPlayerCommand, how would we differentiate between the global OnPlayerCommand and the modules own OnPlayerCommand?

I believe scripts currently run their own OnPlayerCommand. You'd have to add a hack to run the global one, which would invoke all others. You should be able to find the global one like this: getroottable()["OnPlayerCommand"].

We could basically switch it on startup, but it creates a lot of inconsistency, so I'm not sure if it's really a good idea.
Overall, this module-loader / scripts.nut idea doesn't work out too great, and I consider getting rid of it.
The hack would be fine for now.

@dracc dracc linked a pull request Feb 27, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants