Hi,
I'd like to check the number of items of the player.
There is the call "get_inventory(defines.inventory.player_main)" that gives access and number of items.
But when the player selects items from that, taking it in hand that amount is removed from the inventory.
Is there a way to get the items "in hand" ?
Items in hand
Re: Items in hand
http://lua-api.factorio.com/latest/LuaC ... rsor_stack
http://lua-api.factorio.com/latest/LuaPlayer.html
http://lua-api.factorio.com/latest/LuaItemStack.html
http://lua-api.factorio.com/latest/LuaPlayer.html
http://lua-api.factorio.com/latest/LuaItemStack.html
Code: Select all
script.on_event(defines.events.on_player_cursor_stack_changed, function(event)
if(player.cursor_stack.valid_for_read and player.cursor_stack.name == 'iron-ore') then
local player = game.players[event.player_index]
global.player_cursor_stack[event.player_index] = {name = player.cursor_stack.name, type - player.cursor_stack.type, count = player.cursor_stack.count, health = player.cursor_stack.health}
end
end)
Re: Items in hand
Thanks,
Works great. I missed the "cursor" teminology
Works great. I missed the "cursor" teminology