Rail switch, when you build it, spawn lamp near.
To use the circuit condition you have to connect a wire to the lamp. Then configure like you would a normal lamp.
Do note that the lamp require power.
If lamp is on, rail will be placed and connect to other rails. When lamp is off, rail will be removed and disconnect other rails.
You can use it to create a train that will be sent only when perform logistic network condition (for example send train when at base out of ore).
Train detector
Place train detector near rails.
Right click and set in gui signal to output.
When train move or stay near, detector will output signal to logistic network.
Cargo inventory reader
Place cargo inventory reader near rails.
When train move or stay near, reader will output inventory contents to logistic network.
Rail signal reader
Place rail signal reader near rail signal.
Right click and set in gui signal to output.
When signal will be red, reader output selected signal to logistic network.
Train GOTO station
Place Train goto controller at rails.
Set logic condition and station name on which the train will send.
When condition activeted train wll be send to selected station.
Mod updated for 0.13!
Some features removed because reading and setting rail signals added intro base game, but train cargo reader and station goto controller remains and updated.
Re: [0.12.X] Rail Logic Arrows
Posted: Sun Jul 26, 2015 11:37 am
by billw
Sorry, but what is a rail arrow?
Re: [0.12.X] Rail Logic Arrows
Posted: Sun Jul 26, 2015 1:00 pm
by DeamonEngineer
im guessing from the description that it will either add or remove a rail when a certain logic is achieved. therefor creating a dynamic track condition and controls where trains path to
Re: [0.12.X] Rail logic system
Posted: Sun Jul 26, 2015 3:04 pm
by craftoBot
I am very sorry for thease 4 people's who had downloaded it already, but i fully changed naming of mod and it's contents, so why prev version made uncompatiable
Re: [0.12.X] Rail logic system
Posted: Sun Jul 26, 2015 10:04 pm
by craftoBot
I had added two new features, so i will made how-to for it next day
Re: [0.12.X][0.0.4] Rail logic system
Posted: Wed Jul 29, 2015 9:04 am
by mrdormouse
Hi,
I'm having some problems with 0.0.4; when i try to start a new game i get
Unknown key: "Error while running the on_init: __RailLogicSystem__/control.lua:252:attempt to index field 'railLogicSystem' (a nil value)
0.0.3 worked fine, and also very very very much useful, can't wait to try these new objects
Re: [0.12.X][0.0.4] Rail logic system
Posted: Wed Jul 29, 2015 10:12 am
by craftoBot
I'am very sorry for this problem, i had already found it and working about fixing, some bug fix build will be available in few days (est 1 or 2)
Re: [0.12.X][0.0.5] Rail logic system
Posted: Wed Jul 29, 2015 3:50 pm
by craftoBot
to update from 0.0.3 to 0.0.5 you need to destroy all placed entities and place it again
craftoBot wrote:to update from 0.0.3 to 0.0.5 you need to destroy all placed entities and place it again
Confirming 0.0.5 to work fine, after destroying all old entities. Seems to be working in MP too!
Re: [0.12.X][0.0.6] Rail logic system
Posted: Sat Aug 01, 2015 1:30 am
by craftoBot
I'am very sorry, but i not disgner, so may by someone can draw icons/textures for our mod
Re: [0.12.X][0.0.6] Rail logic system
Posted: Sat Aug 01, 2015 1:37 am
by Devildog
really cool mod
Re: [0.12.X][0.0.6] Rail logic system
Posted: Sun Aug 09, 2015 10:00 am
by thewd
Excellent mod, I thought about writing something similar myself
craftoBot, I`ve found two little bugs, first - when you load, some of cargo detectors are signaling, but there`s no train at all. Or when it`s too much kinds of things in train (I use bob`s mods, so there are always many kind of things)
Second - well,it`s not a bug at all, you use onTick event and make some validity checkings.
fix
So,I`ve fixed both (I`m not a pro in Lua - so it`s messy code inside).
First is fixed by adding signal clearing to onTick on each 10th tick
and second is fixed by adding "if game.tick % 2 = 0 then ..." into your onTick - no slowdown at all.
Re: [0.12.X][0.0.6] Rail logic system
Posted: Sun Aug 09, 2015 12:26 pm
by craftoBot
Thank you for report, will be fixed in 0.0.7, cargo detectors can only detect 15 kind of things in train because this is limit os constant-combintaor output, so you can try to use cargo detector mk1 to read each cargo unit, if this can help)
Re: [0.12.X][0.0.6] Rail logic system
Posted: Sun Aug 09, 2015 1:12 pm
by thewd
Well, I needed only a empty\no empty train signal,not using exact items count by type
And one question- when I used A/M train mode switcher,it switch the train at station,but inserters aren't working:(
Re: [0.12.X][0.0.6] Rail logic system
Posted: Sun Aug 09, 2015 4:22 pm
by craftoBot
@thewd Strange, i will test it
Re: [0.12.X][0.0.6] Rail logic system
Posted: Mon Aug 10, 2015 11:21 am
by Choumiko
thewd wrote:And one question- when I used A/M train mode switcher,it switch the train at station,but inserters aren't working:(
I had the same issue with SmartTrains. If i remember correctly i solved it by putting the train into manual mode 5 ticks after it arrived. I guess the inserters need time to wake up/recognize a train.
craftoBot wrote:cargo detectors can only detect 15 kind of things in train because this is limit os constant-combintaor output, so you can try to use cargo detector mk1 to read each cargo unit, if this can help)
You can change item_slot_count in the prototype definition of the combinator.
Re: [0.12.X][0.0.6] Rail logic system
Posted: Mon Aug 10, 2015 1:43 pm
by craftoBot
Choumiko wrote:
thewd wrote:And one question- when I used A/M train mode switcher,it switch the train at station,but inserters aren't working:(
I had the same issue with SmartTrains. If i remember correctly i solved it by putting the train into manual mode 5 ticks after it arrived. I guess the inserters need time to wake up/recognize a train.
craftoBot wrote:cargo detectors can only detect 15 kind of things in train because this is limit os constant-combintaor output, so you can try to use cargo detector mk1 to read each cargo unit, if this can help)
You can change item_slot_count in the prototype definition of the combinator.
I already sloved first problem , thank you for suggestion in second)
Re: [0.12.X][0.0.6] Rail logic system
Posted: Wed Aug 12, 2015 1:27 pm
by thewd
report from the fields
go-to controller seems not working on vertical rails (
UPDATE
ow sry, I forgot to add station,at which train goes, in its schedule ^^
Re: [0.12.X][0.0.6] Rail logic system
Posted: Fri Aug 21, 2015 1:30 am
by theit8514
Thanks for the great mod. I wanted to use the rail switch with the concreted rail tracks mod for my stations, but the rail switch lamp would not detect those as proper rails. I updated your code to detect any type of rail (including curved rail). If no rail is found, it defaults to a regular straight rail.
classes["rail-switch-lamp"]={
onPlace=function(entity)
debugLog("Placed switch")
local position = entity.position
local rails = entity.surface.find_entities_filtered({area = getArea(position, 0.5), type = "rail"})
local rail = rails[1]
if rail ~= nil then
return {entity=entity,rail=rail,position=rail.position,railname=rail.name,active=true}
else
return {entity=entity,rail=nil,position=entity.position,railname="straight-rail",active=false}
end
end,
onDestroy=function(data)
local rail = data.rail
debugLog("Removed switch")
if rail and rail.valid then
rail.destroy()
end
end,
onTick=function(data)
local entity = data.entity
local r=entity.get_circuit_condition(1).fulfilled and entity.energy > 0.5
if r~=data.active then -- circuit condition and energy condition not the same as stored active value.
if r then -- activate
local position = data.position
local rails = entity.surface.find_entities_filtered({area = getArea(position, 0.5), type = "rail"})
local rail = rails[1]
if rail then
data.rail = rail
else
data.rail = entity.surface.create_entity({name=data.railname,position=data.position,force=entity.force,direction=data.direction})
end
else -- deactivate
if data.rail and data.rail.valid then
data.direction=data.rail.direction
data.rail.destroy()
data.rail=nil
else
local position = data.position
local rails = entity.surface.find_entities_filtered({area = getArea(position, 0.5), type = "rail"})
local rail = rails[1]
if rail then
data.direction=rail.direction
data.railname=rail.name
rail.destroy()
else
entity.die()
end
end
end
data.active=r
end
end
}