Hey all,
while playing with a friend a bobs+Pyanodons run we had an idea: A aether or warp pipe.
What does it do? It transfers a given fluid from point A to point B, but without (underground-) pipes in between them. So with them you could transport fluids from one end of your base to the other without the hassle of building tons of underground pipes through or around it or packing all the fluids up into barrels. For balance reasons this could work with a energy cost, but I could live without it.
I already have a few concept ideas on how it may work, but I'm no programer (altough I have some comprehension of coding) and therefore I''m not sure which would be the best way to implement this:
1. Make it work like the train network. Like you can tell each pipe to which other pipe it should deliver it's input and multiple pipes can deliver their contents to the same outputs.
2. (probably better): A pipe/pump-like entity, let's call it aether pump, which "uncrafts" it's contents and saves each uncraftet material in a variable (the aether, lorewise). Then you can build another aether pump anywhere on the map and tell it to craft the same material out of the aether. Of couse the crafting process would only work if the variable for that material is bigger then zero.
Said aether-variable should:
- be fluid specific (from mods too)
- capped at x per input pipe/pump (so you can't let the variable rise into infinity and can't use the aether as storage room). Lore wise you can only keep track of so many mass per aether pump. 1.000 might be a good start for x.
Question is: Is this possible and can anyone do it?
[Mod Idea] aether/warp pump
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: [Mod Idea] aether/warp pump
I wrote a basic proof of concept, don't really have time to do make it into a proper mod though.
Usage:
Copy the whole blop and paste it into the console. Ignore the achivement warning and just paste it again.
Select a fluid storage tank with your mouse and enter /input into the console to make it an input tank, and /output to make it an output tank. Type /removeaether to remove the script. It will stop working after loading the game so you have to paste it in again (the in/output settings will be stored though, those are only removed if you type /removeaether).
Effect:
Transfers fluids from input tanks to output tanks once per second. The aether can store one tank worth of each fluid type.
Quirks:
You can only transfer to a tank that already has some of the fluid in it (can be 0.00001 but has to be something). Use a barrel for starting it up i guess :P. There's no guarding against making a tank input AND output at the same time. Will also be incompatible with any scenario that already uses on_tick for something else.
License:
CC0 1.0 Universal / Public Domain. Feel free to make your own mod out of this ;p.
Usage:
Copy the whole blop and paste it into the console. Ignore the achivement warning and just paste it again.
Select a fluid storage tank with your mouse and enter /input into the console to make it an input tank, and /output to make it an output tank. Type /removeaether to remove the script. It will stop working after loading the game so you have to paste it in again (the in/output settings will be stored though, those are only removed if you type /removeaether).
Effect:
Transfers fluids from input tanks to output tanks once per second. The aether can store one tank worth of each fluid type.
Quirks:
You can only transfer to a tank that already has some of the fluid in it (can be 0.00001 but has to be something). Use a barrel for starting it up i guess :P. There's no guarding against making a tank input AND output at the same time. Will also be incompatible with any scenario that already uses on_tick for something else.
License:
CC0 1.0 Universal / Public Domain. Feel free to make your own mod out of this ;p.
Code: Select all
/c
if not global.aether then
global.aether = {input={},output={},storage={}}
global.aether.old_ontick = script.get_event_handler(defines.events.on_tick) or function()end
end
function global.aether.ontick(e)
if e.tick % 65 ~= 17 then return end
local I = global.aether.input
local O = global.aether.output
local S = global.aether.storage
for i=#I,1,-1 do
if not I[i].valid then table.remove(I,i) break end
local fb = I[i].fluidbox[1]
if not fb then break end
local n = fb.name
local transfer = math.min(fb.amount-1,26000-S[n])
if transfer > 0 then
fb.amount = fb.amount - transfer
S[n] = S[n] + transfer
I[i].fluidbox[1] = fb
end
end
for i=#O,1,-1 do
if not O[i].valid then table.remove(O,i) break end
local fb = O[i].fluidbox[1]
if not fb then break end
local n = fb.name
local transfer = math.min(O[i].fluidbox.get_capacity(1)-fb.amount-1,S[n])
if transfer > 0 then
fb.amount = fb.amount + transfer
S[n] = S[n] - transfer
O[i].fluidbox[1] = fb
end
end
end
script.on_event(defines.events.on_tick,global.aether.ontick)
for _,f in pairs(game.fluid_prototypes) do
global.aether.storage[f.name] = global.aether.storage[f.name] or 0
end
local function add_tank(e,inout)
local p = game.players[e.player_index]
local s = p.selected
if not s and s.type == 'storage-tank' then return end
table.insert(global.aether[inout],s)
p.print('Designated: '..inout)
end
local function input(e) add_tank(e,'input') end
local function output(e) add_tank(e,'output') end
local function uninstall()
if not global.aether then return end
script.on_event(defines.events.on_tick,global.aether.old_ontick)
global.aether = nil
end
commands.add_command('input','Designates an input tank.',input)
commands.add_command('output','Designates an output tank.',output)
commands.add_command('removeaether','Uninstalls this.',uninstall)
Re: [Mod Idea] aether/warp pump
Wow, thanks for that If someone wants to make this concept into a full blown mod, feel free to do so, since I lack the skill and my friend the time to do so at the moment :/