Over Riding Game Commands

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Cooldude2606
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Sat Sep 16, 2017 9:04 pm
Contact:

Over Riding Game Commands

Post 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)
--- Developer for Explosive Gaming factorio community. Find our code on GitHub. Please contact me via our Discord. ---

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Over Riding Game Commands

Post by eradicator »

And what do you suppose should happen if more than one mod tries to overwrite the same command?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Over Riding Game Commands

Post 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.

User avatar
Cooldude2606
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Sat Sep 16, 2017 9:04 pm
Contact:

Re: Over Riding Game Commands

Post 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.
--- Developer for Explosive Gaming factorio community. Find our code on GitHub. Please contact me via our Discord. ---

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Over Riding Game Commands

Post 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?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
Cooldude2606
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Sat Sep 16, 2017 9:04 pm
Contact:

Re: Over Riding Game Commands

Post 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.
--- Developer for Explosive Gaming factorio community. Find our code on GitHub. Please contact me via our Discord. ---

Post Reply

Return to “Modding interface requests”