Apply parameter to all entities in type
Posted: Fri Jan 27, 2023 2:21 pm
Trying to change collision mask of any entities of chosen type, but my code works in only half.
If write "or" then it applies only for furnace entities, if "and" then only for storage tanks, if "," then error on launch. I don't know what need to change for good work with all chosen.
If write "or" then it applies only for furnace entities, if "and" then only for storage tanks, if "," then error on launch. I don't know what need to change for good work with all chosen.
Code: Select all
local entity_array = (
data.raw["furnace"] or
data.raw["solar-panel"] or
data.raw["burner-generator"] or
data.raw["generator"] or
data.raw["electric-pole"] or
data.raw["container"] or
data.raw["boiler"] or
data.raw["assembling-machine"] or
data.raw["turret"] or
data.raw["transport-belt"] or
data.raw["underground-belt"] or
data.raw["splitter"] or
data.raw["inserter"] or
data.raw["reactor"] or
data.raw["heat-pipe"] or
data.raw["pipe"] or
data.raw["pipe-to-ground"] or
data.raw["radar"] or
data.raw["lamp"] or
data.raw["storage-tank"]
)
for e_name, entity in next, entity_array do entity.collision_mask = {"object-layer", "layer-40", "player-layer"} end