Page 1 of 1

Over Riding Game Commands

Posted: Sun Nov 19, 2017 6:34 pm
by Cooldude2606
After reading about the kick ban and other methods being added for use by game scripts I started to see if I could over ride the game commands for ban and kick so I could add more to them (eg custom rank requirements or log to a different file**) but I found that I was unable to do so, please correct me if you are able to, as I would much rather have a player be banned via /ban rather than needing to make a custom command by a different name (eg /ban-player) I see no reason why this would not be possible for you to do and I can't see any way this would effect the game if not used.

So my request is: Can you allow us to make a custom command which as the same name as a game command as use it as an over ride over the game command and only use the game command as a fall back if the custom command was removed.

* game commands (commands.game_commands) and custom commands (commands.commands)
** we have a log file which only logs certain things to our discord via a json format currently missing game commands (the reason why I want this request to be added)

Re: Over Riding Game Commands

Posted: Sun Nov 19, 2017 11:17 pm
by eradicator
And what do you suppose should happen if more than one mod tries to overwrite the same command?

Re: Over Riding Game Commands

Posted: Mon Nov 20, 2017 7:21 am
by darkfrei
eradicator wrote:And what do you suppose should happen if more than one mod tries to overwrite the same command?
If not exist then error, if exists then the last mod has priority. Like now with other prototypes.

Re: Over Riding Game Commands

Posted: Sat Nov 25, 2017 10:40 pm
by Cooldude2606
eradicator wrote:And what do you suppose should happen if more than one mod tries to overwrite the same command?
If diffrent mods over write the same command than the do commands could both run. The two mods would have no effect on each other or on how the other mod responds to the command. Thinking of this it would possibly be easier for game commands to raise an event once the game has ran the code it has needed to, this way two diffrent mods would work in the same way two mods would to on_player_join_game or on_tick where it calls the handler for each script.

Re: Over Riding Game Commands

Posted: Sat Nov 25, 2017 10:53 pm
by eradicator
Cooldude2606 wrote:Thinking of this it would possibly be easier for game commands to raise an event once the game has ran the code it has needed to, this way two diffrent mods would work in the same way two mods would to on_player_join_game or on_tick where it calls the handler for each script.
How is that different from the current implementation of on_console_command?

Re: Over Riding Game Commands

Posted: Sat Nov 25, 2017 11:33 pm
by Cooldude2606
eradicator wrote:How is that different from the current implementation of on_console_command?
I did not notice that this event existed but it would still be helpful if we were able to replace/remove the default game commands to avoid unwanted conflicts with the base game, i.e. if you want to block a ban from happening - the script would need to unban after the player was banned and on the user end they would see both messages (ban and unban) in the chat.