[0.14.1] create_entity() silent fail

Bugs that are actually features.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

[0.14.1] create_entity() silent fail

Post by Adil »

Ok, this one is difficult to pinpoint for me:
if create_entity() is used to place entity of type "tree" at coordinates, where entity of same name is already present, then the command fails and returns nil.
It didn't do so in previous versions, and seems to works as usual for all other entities.
Now, the trick is: vanilla trees can be placed so.
I've encountered the problem while updating one of my mods.
It weights only a few kilobytes, so I'll put it in work-in-progress state here.
To reproduce the issue, use the folowing command (three times):

Code: Select all

/c e=game.player.surface.create_entity{name="sign-post-2",position={0,0}}
Only one puff will be seen and if previous entity is destroyed, no other is seen under it.

I've found workaround for me, but this inconsistency seems weird.
Attachments
SignPosts_0.3.7.zip
(66.1 KiB) Downloaded 61 times
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15912
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.14.1] create_entity() silent fail

Post by Rseding91 »

"sign-post-2" is a wall. Walls can't be created on top of each other. That's by design.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: [0.14.1] create_entity() silent fail

Post by Adil »

So, shouldn't this be mentioned somewhere? I'm not sure lua error would be a good solution here, but maybe a second return which would be an explanation string could reduce confusion with such occurrences.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Post Reply

Return to “Not a bug”