Page 1 of 1

[0.14.1] create_entity() silent fail

Posted: Sat Aug 27, 2016 8:19 pm
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.

Re: [0.14.1] create_entity() silent fail

Posted: Sat Aug 27, 2016 8:28 pm
by Rseding91
"sign-post-2" is a wall. Walls can't be created on top of each other. That's by design.

Re: [0.14.1] create_entity() silent fail

Posted: Sun Aug 28, 2016 3:10 am
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.