[0.11.11+] FARL 0.2.8 (Rail Layer)

The raillayer; must have, if you want to play with railway.

Moderator: Choumiko

Locked
User avatar
Cheata
Long Handed Inserter
Long Handed Inserter
Posts: 78
Joined: Sun Aug 17, 2014 6:46 am
Contact:

Re: [0.11.11+] FARL 0.2.3 (Rail Layer)

Post by Cheata »

Part 2 :P

I also like to use the Dytec Warfare mod, this adds 11 new laser turrets and 3 new wall types

thats a lot of additions to a couple of already large if statements, in addition we only want them active when the dytech warfare mod is .. so in addition to my last post here is the code iv used to integrate Dytech Warfare into the previous tweak. It should also be expandable to just about any entity or mod people want to integrate to the FARL blueprint system.

using FARL version 0.2.3
control.lua

Code: Select all

glob.cruiseSpeed = glob.cruiseSpeed or 0.4

--create a global variable (table) for all entity to be recognized in blueprints ~line 200
    glob.bpentitys = {"small-lamp","laser-turret","stone-wall"}
-- add to the above table the additional entity's to be recognized from dytech using laserturret2 because dytech no longer has a warfare interface and the dytech-core to make sure its dytech installed and not another mod
    if game.interfaces["DyTech-Core"] and game.entityprototypes["laser-turret-2"] then
      table.insert(glob.bpentitys, "laser-turret-2")
      table.insert(glob.bpentitys, "laser-turret-3")
      table.insert(glob.bpentitys, "laser-turret-4")
      table.insert(glob.bpentitys, "laser-turret-5")
      table.insert(glob.bpentitys, "laser-turret-6")
      table.insert(glob.bpentitys, "laser-turret-7")
      table.insert(glob.bpentitys, "laser-turret-8")
      table.insert(glob.bpentitys, "laser-turret-9")
      table.insert(glob.bpentitys, "laser-turret-sniper-1")
      table.insert(glob.bpentitys, "laser-turret-sniper-2")
      table.insert(glob.bpentitys, "laser-turret-sniper-3")
      table.insert(glob.bpentitys, "tungsten-wall")
      table.insert(glob.bpentitys, "chitin-wall")
      table.insert(glob.bpentitys, "sandwall")
    end
-- end mod
    for i,farl in ipairs(glob.farl) do
perhaps some of the above should be extracted to the config.lua file for ease of adjustment ... not sure

FARL.lua

Code: Select all

--change cargo manifest update to add the pre-approved entity's from the blueprints ~line 436
updateCargo = function(self)
-- removed all blueprint related entity's from the existing list
    local types = { "straight-rail", "curved-rail","rail-signal",
      "big-electric-pole", "medium-electric-pole", "green-wire", "red-wire"
    }
-- create loop to add entity's from global blueprint list to types table
    for _,bpentity in pairs(glob.bpentitys) do
      table.insert(types, bpentity)
    end
-- end mod

****************

-- added new function just before the parseBlueprints function to check entity names against the preset list ~line 488
checkbpentity = function(self,entity)
   for _,ventity in ipairs(glob.bpentitys) do
     if entity == ventity then
      return true
     end
   end
   return false
  end,
-- end mod

**************************
-- change if statement from multiple and's to a call to the previously created function, if the name of the entity is on the pre-approved list then the entity will be inserted into the lamps table as per original design
-- ~line 510
if self:checkbpentity(e[i].name) == true then
 -- end mod
          table.insert(offsets.lamps, {name = e[i].name, direction = e[i].direction, position = e[i].position})
end

Im fairly sure some of this code could be neater but it works. If someone (or Choumiko) wants to take it further feel free.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.11.11+] FARL 0.2.3 (Rail Layer)

Post by Choumiko »

New Version: FARL 0.2.4

Changes
  • option to disable collecting/droping wood
    place any entity stored in blueprints
I got annoyed by FARL leaving behind hundreds of wood logs when plowing through a forest, so you can now disable it.
Cheata wrote:Im fairly sure some of this code could be neater but it works. If someone (or Choumiko) wants to take it further feel free.
I did :D Instead of whitelisting items i simply ignored poles/rails and saved every other blueprintentity. Should now work with every mod-item, though i only tested it with vanilla laser turrets, walls, chests, inserters and radars
FARL now saves every entity of a blueprint, and tries to place it whenever it places a pole.
Edit: Doesn't work properly for 2x1 entities (gun turrets, splitters) and rail-signals. But at least using splitters at every pole seems silly ;)

User avatar
Cheata
Long Handed Inserter
Long Handed Inserter
Posts: 78
Joined: Sun Aug 17, 2014 6:46 am
Contact:

Re: [0.11.11+] FARL 0.2.3 (Rail Layer)

Post by Cheata »

Choumiko wrote:New Version: FARL 0.2.4

Edit: Doesn't work properly for 2x1 entities (gun turrets, splitters) and rail-signals. But at least using splitters at every pole seems silly ;)
not silly if you setup normal gun turrets and and auto ammo feed......... XD

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by n9103 »

Which isn't a problem since you can't setup turrets anyway :P
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

Kane
Filter Inserter
Filter Inserter
Posts: 666
Joined: Fri Sep 05, 2014 7:34 pm
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by Kane »

Found a new little cute crash. I thought at first this resulted in saving and then loading while in the train and starting up. The old annoying bug where you gotta get in and out I assume the way it enables the script was now causing the crash. But when I got out without starting moved back then forward and then started I was still getting this crash. I wonder if it's a range issue something going derpy because of the amount of signals in the general area.

Screenshot:
http://i.imgur.com/I2hY3LD.jpg

I went ahead and placed more track down the line assuming it would stop crashing and that it did.

Thanks :)

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by n9103 »

If it's that exact spot only, then I would guess it had something to do with the pathfinding, since the direction you're building (south) is against the allowed traffic direction, and one of your engines isn't past that one-way signal yet.
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

Kane
Filter Inserter
Filter Inserter
Posts: 666
Joined: Fri Sep 05, 2014 7:34 pm
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by Kane »

n9103 wrote:If it's that exact spot only, then I would guess it had something to do with the pathfinding, since the direction you're building (south) is against the allowed traffic direction, and one of your engines isn't past that one-way signal yet.
You say against traffic direction. This is a Canadian designed Rail system :P

User avatar
Cheata
Long Handed Inserter
Long Handed Inserter
Posts: 78
Joined: Sun Aug 17, 2014 6:46 am
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by Cheata »

That error is usually caused by trying to do arithmetic on a non numerical value.

Last time i saw it i was trying to divide a table by 4 (strangely enough that was while i was playing with the FARL mod the other day, not related to this instance though)

If possible see if you can replicate the error and upload a save where it still occurs so someone can try and debug it.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by Choumiko »

It looks like the issue could be the curved rail connecting to the straight ones under the FARL. Though FARL ignores curved rails when trying to find a start (or at least it should..).
Signals or pathfinding isn't the reason, signals are ignored, pathfinding is not implemented (yet)
I'll look into it

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by n9103 »

Kane wrote:
n9103 wrote:If it's that exact spot only, then I would guess it had something to do with the pathfinding, since the direction you're building (south) is against the allowed traffic direction, and one of your engines isn't past that one-way signal yet.
You say against traffic direction. This is a Canadian designed Rail system :P
So... Trains in Canada are signaled after they pass, instead of before? You lost me there.
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

Kane
Filter Inserter
Filter Inserter
Posts: 666
Joined: Fri Sep 05, 2014 7:34 pm
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by Kane »

n9103 wrote:
Kane wrote:
n9103 wrote:If it's that exact spot only, then I would guess it had something to do with the pathfinding, since the direction you're building (south) is against the allowed traffic direction, and one of your engines isn't past that one-way signal yet.
You say against traffic direction. This is a Canadian designed Rail system :P
So... Trains in Canada are signaled after they pass, instead of before? You lost me there.
Hi, Sorry about that. I thought it was related to sides like left and right. Could you take the time and show me an example of how to do it right. I'm quite new with trains and doing a large high speed train infrastructure without resorting to roundabouts etc. I use double locomotives front to back for more enjoyment.

Here is a better picture of my intersection.

Screenshot:
http://i.imgur.com/JcVQMf7.jpg

I found this to cause the least jams and slowdowns for other directions etc.

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by n9103 »

Ah, I wasn't making an assumption of left vs right, but looking at the train signal's direction... though, it seems I was mistaken on which way they face for a given light orientation. (I reeeeally can't wait for the devs to pick a stable version so I can get back into this :|)

As for the layout critique, it's a good bit off-topic, but I'll address it for a post.
Roundabouts are your friend, and are the only way to avoid potential deadlock.
Your rails themselves are a pretty good setup for a non-roundabout junction. (The uneven curves irk me, but that's a personal problem ;))
With this kind of junction there's not much room for improving the signals and still maintaining reliability.

Due to the current implementation of Factorio's signals, throughput/non-delay is roughly inverse to the avoidance of deadlock. I would attribute most of this to the fact there's no way to signal a path is clear, without also signalling that a train can stop at that signal's location. (e.g. there's no signal that only tells when one side of a block is clear)

Generally speaking, I avoid placing any signals where a train that stops at that signal would be in the way of other trains.
By only having one train in a junction at a time, you strongly avoid any situations that could cause a deadlock. Limiting the junction to one at a time will undoubtedly cause delays for bypassing trains however.
Personally, I'll sacrifice a reasonable level of throughput for never having to look at the junction ever again.

For reference, the "single train in junction" signal setup I refer to is a single signal at each entrance to the junction, and a single signal on each exit at [the maximum train length] away from the junction. Distance from junction depends on how large a train you're ever going to run on that line.

Only real improvement to this would be a roundabout, so it's not a bad layout for what it is. :)
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by ssilk »

This junction can be made nearly deadlock-free, if you remove some signals.

- left track: remove signal between the top and down signal
- Keep signals between the two tracks!
- right track: Remove all between top and down
- Remove the two signals leading into the track into right direction.
- remove the two signals on track coming from right direction

There should be now eight signals left in this crossing area. I use this layout very often, because it has a much higher throughput, than deadlock-free circle. It is no guarantee, that it cannot deadlock, but then it is coming from "outside" of this screen. :)

To increase throughput, you can eventually carefully keep three signals: on the track coming from right and between them.

Note, that this is not useful design for a 4-way intersection!

There should be minimum two or more trains space between this 3-way intersections to avoid deadlocks.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

SvenDee
Inserter
Inserter
Posts: 25
Joined: Sun Mar 15, 2015 2:23 pm
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by SvenDee »

I got an error when trying to build a bridge with the landfill mod:

Error while running the event handler: _ _ FARL _ _/FARL.lua:177: attempt to compare number with nil

but maybe i just made something wrong. i put biglandfills and small landfills into the waggon.

11.18 Factorio
Landfill_2.1.2
FARL_0.2.4

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by Choumiko »

Could you post a screenshot before it happens? Not at home right now, so I can't tell what's going wrong. In my tests I drove from land on a big lake, did a few circles, back on land, return to water etc. Without problems. The used versions seem ok

User avatar
Cheata
Long Handed Inserter
Long Handed Inserter
Posts: 78
Joined: Sun Aug 17, 2014 6:46 am
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by Cheata »

line 177... thats to do with the number of water tiles converted to land....

Code: Select all

if godmode or self["landfill2by2"] > lfills then
not sure why either of these values would be set to nill

screen shot or upload of save file would defiantly help :)

FYI SvenDee at the moment FARL only uses the small landfills for the time being but putting the large in the wagon shouldn't cause a problem.

User avatar
Cheata
Long Handed Inserter
Long Handed Inserter
Posts: 78
Joined: Sun Aug 17, 2014 6:46 am
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by Cheata »

just did a couple of tests and have confirmed error placing rail only with bridging turned on ... as of 0.2.4 unfortunately i don't have time to look at it myself this morning

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.11.11+] FARL 0.2.4 (Rail Layer)

Post by Choumiko »

New version: FARL 0.2.5

Changes
  • fixed landfills not being counted
Cheata wrote:not sure why either of these values would be set to nill
That's because i checked whether landfill is installed after using the variable to add the landfill to the table of used items. I just never noticed because i use godmode, so i don't have to fill wagons with stuff. Guess i won't do that in the future :D

waduk
Filter Inserter
Filter Inserter
Posts: 372
Joined: Tue Feb 10, 2015 5:44 pm
Contact:

Re: [0.11.11+] FARL 0.2.5 (Rail Layer)

Post by waduk »

I've become so dependent on this mod (and landfill), to the point i think they were a default feature on vanilla games :D
TBH, I think this is the absolute feature that the dev must included in whatever future version.
I think the dev at the very least give us a "plower" (the current tank is too weak for the trees), and come on..it's a tank; it's meant to do battle, not farming.

I'm always worried about mod, even more with the Factorio constant update, will the mod will be updated ?
So Choumiko and Cheata, thank you for bringing the two absolute best mod in Factorio to work together, and keeping it updated.

Kane
Filter Inserter
Filter Inserter
Posts: 666
Joined: Fri Sep 05, 2014 7:34 pm
Contact:

Re: [0.11.11+] FARL 0.2.5 (Rail Layer)

Post by Kane »

Choumiko has been amazing. I actually wish Choumiko had more time to make even more rail like mods out there :) I love rail anything I actually wish and hope the devs push more into rails in the future. Mix this with RSO and I'm in love with factorio.

Hes supported me in almost every rail mod I used so far and always offers great support :)

Big thanks :)

Locked

Return to “F.A.R.L”