Detecting editor mode

Place to get help with not working mods / modding interface.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1654
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Detecting editor mode

Post by Pi-C »

Is there a way to detect whether a game is currently running in /editor mode? A user reported a crash with GCKI:

Code: Select all

Error while running event GCKI::on_player_driving_changed_state (ID 26)
LuaPlayer doesn't contain key player.
Trying out the editor mode for the first time, I got another crash:

Code: Select all

Error while running event GCKI::on_built_entity (ID 6)
No character.
Both crashes seem to be related in that there is no character or player entity in the editor mode, so I think it would help if my mod would ignore any events that get triggered in this mode. Can that be done?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Detecting editor mode

Post by Klonan »

You can just check if the character is nil

Pi-C
Smart Inserter
Smart Inserter
Posts: 1654
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Detecting editor mode

Post by Pi-C »

Right. Guess that was a bit too obvious. Thanks! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Modding help”