Fully Automated Rail Layer


Fully automated rail-layer

Content
3 years ago
0.13 - 1.1
47.6K
Trains

g Bio Industries: Powered Rail

6 years ago
(updated 6 years ago)

Hey Choumiko,

I see you have not been on the forums is some time, hope to see you back soon!

I've added a Powered Rail to my mod Bio Industries: https://mods.factorio.com/mod/Bio_Industries
It does not seem to work as intended with FARL.

The way it works is that when a rail is placed, I also place a hidden power pole to act as the power rail.
This is the code I use:
[code]

if (entity.valid and entity.name == "bi-straight-rail-power") or (entity.valid and entity.name == "bi-curved-rail-power") then


local rail_track = entity
local pole_name = "bi-rail-hidden-power-pole"       
local create_rail_pole = surface.create_entity({name = pole_name, position = position, force = force})

create_rail_pole.minable = false
create_rail_pole.destructible = false


global.bi_power_rail_table[rail_track.unit_number] = {base=rail_track, pole=create_rail_pole}

if global.bi_power_rail_table[rail_track.unit_number].pole.valid then

    local radius = 4        
    local area = {{position.x - radius, position.y - radius}, {position.x + radius, position.y + radius}}
    local power_rail_poles = {}
    power_rail_poles = surface.find_entities_filtered{area = area, name="bi-rail-hidden-power-pole", force = force}

    if power_rail_poles ~= nil and  #power_rail_poles >= 1 then                     
        for i=1, #power_rail_poles do               
            for _,neighbour in pairs(power_rail_poles[i].neighbours.copper) do                  
                if neighbour.name == "bi-rail-hidden-power-pole" or neighbour.name == "bi-power-to-rail-pole" then                      
                        power_rail_poles[i].connect_neighbour(neighbour)                        
                else                    
                        power_rail_poles[i].disconnect_neighbour(neighbour)
                    end                             
                end                 
            end         
        end

    end

end

[/code]

I am selecting that on the FARL settings:
https://i.imgur.com/ghPAzLQ.png

Hope you can tell me what I need to change in my mod to make it compatible, or if it's on your end, if you could please release an update.
I use your mod for all my Rail laying, so I really need it :)

Thanks Choumiko! Again, please let me know if there is anything I need to do.

Later,
TheSAguy.

6 years ago

See the PM in the forums

New response