[1.1.76] LuaControl.mine_entity(entity, force?) doesn't check if mined_result can't be added to inventory if force=false
Posted: Sat Jan 28, 2023 1:10 am
LuaControl.mine_entity(entity, force?) mentions it will fail if it can't place the items of the entity into the inventory of the LuaControl when force is set to false. (Or at least, that behaviour is implied by the description of when force is true).
These items it checks do not include the mined_result of the entity, only its inventories.
How to reproduce:
Run this in the console with a full inventory while standing near some mineable entities.
Expected behaviour is that an entity is not mined if their mined result can not be stored in the player inventory, and the method returns false.
Current behaviour is that the entity is mined, if the mined result can not be stored in the player inventory it is spilled on the ground (the expected behaviour of when force is set to true).
It does seem to work as expected for item-on-ground entities, it returns false for them and doesn't reshuffle them around like what happens when force is true. (But they are already on the ground anyway, so doesn't really matter for that entity.)
These items it checks do not include the mined_result of the entity, only its inventories.
How to reproduce:
Run this in the console with a full inventory while standing near some mineable entities.
Code: Select all
/c for _, entity in pairs(game.player.surface.find_entities_filtered{position=game.player.position, radius=10}) do
game.player.mine_entity(entity, false)
end
Current behaviour is that the entity is mined, if the mined result can not be stored in the player inventory it is spilled on the ground (the expected behaviour of when force is set to true).
It does seem to work as expected for item-on-ground entities, it returns false for them and doesn't reshuffle them around like what happens when force is true. (But they are already on the ground anyway, so doesn't really matter for that entity.)