[0.17.66] LuaSurface.create_entity{resource} does not set initial_amount

Bugs that are actually features.
Post Reply
User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

[0.17.66] LuaSurface.create_entity{resource} does not set initial_amount

Post by Mylon »

Observed behavior:

Code: Select all

/c game.player.surface.create_entity{name="stone", position=game.player.position, amount=500}
/c game.print(game.player.selected.initial_amount)
> nil
Expected behavior:

Code: Select all

/c game.player.surface.create_entity{name="stone", position=game.player.position, amount=500}
/c game.print(game.player.selected.initial_amount)
> 500
Initial amount ought to be bet to the amount specified at creation. Perhaps it could be an optional parameter specified in create_entity if non-default behavior is desired.

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.17.66] LuaSurface.create_entity{resource} does not set initial_amount

Post by Bilka »

https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.initial_amount wrote:Note: If this is not an infinite resource reading will give nil and writing will give an error.
Stone is not an infinite resource.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: [0.17.66] LuaSurface.create_entity{resource} does not set initial_amount

Post by Mylon »

Seems I grossly misunderstood what that property was supposed to be!

Post Reply

Return to “Not a bug”