abstract pipe lib

foxz
Member
 
Posts: 36
Joined: Sun Feb 07, 2016 11:58
GitHub: foxzoolm
In-game: foxz

abstract pipe lib

by foxz » Thu Feb 25, 2016 14:59

Hi,

I'm rewriting a pipe system, but abstracted one :
this lib, can be use to write pipe/tube system like pipework, digiline, mesecon, technic electric cable...
(can replace it of all)

git : https://github.com/FoxZOolm/astas

at 2016y/02m/2016d
- pipe connection
- propagation

how it works ?

pipes:add("<name>",{
<... same declaration as minetest.register_node...>,
pipe={
on_check_pipe=function(pos,dest)
<return true if pipe pos and dest are compatible (exemple & helper soon)>
end,

set_faces=function(pos,faces)
<swap the node with good node> (exemple & helper soon)
end,

on_propagation=function(pos,from,msg) <--- receive a message from neightbore pipe
<-- do ur fk -->
local gates=pipes.get_gate(pos,from) <--- return a list of connected pipe (except from)
for dest in pairs(gates) do
pipes.propagate:push(pos,dest,msg) <--- push msg to connected pipe
end
end
})

msg can be a itemstack, mesecon, digiline, technic energy etc...

next job :
- callback when msg reach all pipes connected (with path)
- activation (global_step + forceload etc)

futur plan:
- autocrafting machine (like AE2)
 

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 11 guests

cron