Page 1 of 1

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

Posted: Tue Sep 03, 2019 12:07 pm
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.

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

Posted: Tue Sep 03, 2019 12:16 pm
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.

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

Posted: Tue Sep 03, 2019 12:26 pm
by Mylon
Seems I grossly misunderstood what that property was supposed to be!