Surface and creating entities
Posted: Sun Sep 13, 2015 5:17 pm
Hi fellow modders,
I just came back to factorio and witnessed the changes in 0.12, create_entity now belongs to LuaSurface instead of LuaGame
The thing is I usually created entities at map generation near the player spawn with the event on_init and game.createentity
But now surface requires another entity to create one, eg: game.player.surface.create_entity{}
But on the event on_init, the player is not yet created, resulting in an error.
Is there a more appropriate way to call surface and create_entity without the help of the player ?
or is there another event called after the player initial spawn ?
(or should I monitor the how many times players have spawned and only call this on number one ?)
Thanks for the answers.
I just came back to factorio and witnessed the changes in 0.12, create_entity now belongs to LuaSurface instead of LuaGame
The thing is I usually created entities at map generation near the player spawn with the event on_init and game.createentity
But now surface requires another entity to create one, eg: game.player.surface.create_entity{}
But on the event on_init, the player is not yet created, resulting in an error.
Is there a more appropriate way to call surface and create_entity without the help of the player ?
or is there another event called after the player initial spawn ?
(or should I monitor the how many times players have spawned and only call this on number one ?)
Thanks for the answers.