entity.minable not changeable?
Posted: Tue Aug 30, 2016 11:43 pm
hi,
trying to use entity.minable with player.selected to disable an entity from being mined.
The api say its a read/write variable, but I can only read, changing it does nothing.
here a simplified version of my code, that you can paste in a control.lua to test
it should turn any entity that you're pointing at non minable and print false, but it just always print true and things stay minable.
Thanks
trying to use entity.minable with player.selected to disable an entity from being mined.
The api say its a read/write variable, but I can only read, changing it does nothing.
here a simplified version of my code, that you can paste in a control.lua to test
it should turn any entity that you're pointing at non minable and print false, but it just always print true and things stay minable.
Code: Select all
script.on_event(defines.events.on_tick,
function(event)
for player_index, player in pairs(game.players) do
if player.selected ~= nil then
log(tostring(player.selected.name))
log(tostring(player.selected.minable))
player.selected.minable = "false"
log(tostring(player.selected.minable))
end
end
end
)
function log(message)
if game ~= nil then
for index, player in pairs(game.players) do
player.print(message)
end
end
end