Page 1 of 1
Request for scripting, how to turn off indestructible
Posted: Wed Sep 04, 2019 9:43 pm
by Dark_star
Request for scripting, how to turn off indestructible
Is it possible to put a script into control.lau to change map items from indestructible to normal destructible?
thanks
P.S. opening editor for each and on turning it off is a drag
Re: Request for scripting, how to turn off indestructible
Posted: Wed Sep 04, 2019 9:47 pm
by Adamo
Depending what you're doing, maybe. From
https://lua-api.factorio.comlatest/LuaEntity.html:
Code: Select all
destructible :: boolean [Read-Write]
When the entity is not destructible it can't be damaged.
Note: An indestructible entity can still be mined.
Note: Entities that are indestructible naturally (they have no health, like smoke, resource etc) can't be set to be destructible.
Re: Request for scripting, how to turn off indestructible
Posted: Wed Sep 04, 2019 9:52 pm
by eradicator
Code: Select all
/c for _,entity in pairs(game.surfaces.nauvis.find_entities()) do entity.destructible = true end
Will be really slow on large maps. Might also break some mods if they rely on hidden entities. If you know *what* kind of entity you want to change you can use find_entities_filtered(). Depending on what you're dealing with you might also want to set minable = true.
Re: Request for scripting, how to turn off indestructible
Posted: Wed Sep 04, 2019 10:04 pm
by Koub
[Koub] Moved to Technical Help.