[Mod] Tubelib [tubelib]
- joe7575
- Member
- Posts: 851
- Joined: Mon Apr 24, 2017 20:38
- GitHub: joe7575
- In-game: JoSto wuffi
- Location: Germany, in the deep south
[Mod] Tubelib [tubelib]
This mod is now part of the Modpack TechPack
Minetest Tube Mod for item exchange via lumber tubes and wireless message communication between nodes.
The focus for this Mod are:
* minimized server load and thus minimized server lags
* simple and intuitive usage for players
* simple API for programmers
The mod provides:
* lumber tubes to connect 2 blocks
* a Pusher block to pull/push items through tubes
* a Distributor block with 4 output channels to sort incoming items
* a Blackhole block which lets all items disappear (example/template for programmers)
* a Button/switch block to send "switch on/off" messages
* a Lamp block as receiving example for message communication
* support for default blocks: furnace and chests
Code: LGPLv2.1+, textures: CC BY-SA 3.0
Dependencies: default
Minetest Tube Mod for item exchange via lumber tubes and wireless message communication between nodes.
The focus for this Mod are:
* minimized server load and thus minimized server lags
* simple and intuitive usage for players
* simple API for programmers
The mod provides:
* lumber tubes to connect 2 blocks
* a Pusher block to pull/push items through tubes
* a Distributor block with 4 output channels to sort incoming items
* a Blackhole block which lets all items disappear (example/template for programmers)
* a Button/switch block to send "switch on/off" messages
* a Lamp block as receiving example for message communication
* support for default blocks: furnace and chests
Code: LGPLv2.1+, textures: CC BY-SA 3.0
Dependencies: default
Last edited by joe7575 on Sun Mar 11, 2018 17:26, edited 7 times in total.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: [Mod] Minetest-Tubelib [tubelib]
The ancestor of mesecons and pipeworks? it's really sent from your commodore64 then :D
EDIT: seems simpler to use than them.
EDIT: seems simpler to use than them.
Last edited by azekill_DIABLO on Tue Oct 03, 2017 17:08, edited 1 time in total.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
-
- Member
- Posts: 999
- Joined: Sat Aug 19, 2017 21:49
- GitHub: Chemguy99
- In-game: Chem Nyx
- Location: My Basement's Attic
Re: [Mod] Minetest-Tubelib [tubelib]
Looks to be a promising alternative to pipeworks and technic
What is SCP-055?
Re: [Mod] Minetest-Tubelib [tubelib]
Pipeworks alternative, good job! ( I don't like the textures :/ )
Can your read this?
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: [Mod] Minetest-Tubelib [tubelib]
well... they would fit well with HDX 32x32, i agree. 16 pixel textures with the default palette could be nice too. Unfortunatly i can't do them now.cx384 wrote: I don't like the textures :/
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
- joe7575
- Member
- Posts: 851
- Joined: Mon Apr 24, 2017 20:38
- GitHub: joe7575
- In-game: JoSto wuffi
- Location: Germany, in the deep south
Re: [Mod] Minetest-Tubelib [tubelib]
The "retro rustic design" should help do distinguish the mod from others...
and it is unique, I guess.
But of course, it could be changed by means of any texture mod.
But is is not really the ancestor, because the message communication is wireless :D
and it is unique, I guess.
But of course, it could be changed by means of any texture mod.
But is is not really the ancestor, because the message communication is wireless :D
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: [Mod] Minetest-Tubelib [tubelib]
Can it transport through unloaded blocks like pipeworks can?
Every time a mod API is left undocumented, a koala dies.
- joe7575
- Member
- Posts: 851
- Joined: Mon Apr 24, 2017 20:38
- GitHub: joe7575
- In-game: JoSto wuffi
- Location: Germany, in the deep south
Re: [Mod] Minetest-Tubelib [tubelib]
Theoretically YES, but it is unlikely that this happens, because the maximum tube length is currently limited to about 50 blocks. It was no objective to allow the construction of huge plants.Byakuren wrote:Can it transport through unloaded blocks like pipeworks can?
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.
Re: [Mod] Minetest-Tubelib [tubelib]
Could you provide an example for how to enable a node with an inventory to be tubelib-compatible? I've created a lot of mods that provide inventory-bearing nodes and I'm willing to add compatibility to any of these sorts of mods that come along but a cheat sheet would be handy.
- joe7575
- Member
- Posts: 851
- Joined: Mon Apr 24, 2017 20:38
- GitHub: joe7575
- In-game: JoSto wuffi
- Location: Germany, in the deep south
Re: [Mod] Minetest-Tubelib [tubelib]
Yes, of course. This is the code (from legacy_nodes.lua) to make a chest Tubelib compatible:FaceDeer wrote:Could you provide an example for how to enable a node with an inventory to be tubelib-compatible? I've created a lot of mods that provide inventory-bearing nodes and I'm willing to add compatibility to any of these sorts of mods that come along but a cheat sheet would be handy. :)
Code: Select all
tubelib.register_node("default:chest", {"default:chest_open"}, {
on_pull_item = function(pos, side)
local meta = minetest.get_meta(pos)
return tubelib.get_item(meta, "main")
end,
on_push_item = function(pos, side, item)
local meta = minetest.get_meta(pos)
return tubelib.put_item(meta, "main", item)
end,
on_unpull_item = function(pos, side, item)
local meta = minetest.get_meta(pos)
return tubelib.put_item(meta, "main", item)
end,
})
You will find the prototypes for this functions with parameter description in the file "command.lua".
If you need more help, please let me know.
PS: I removed the "on_recv_message" part, because this is not needed for pure item exchange via tubes.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.
Re: [Mod] Minetest-Tubelib [tubelib]
Thanks, looks straightforward. Might want to put this example into the api document, I'm sure this will be something that other modders will want too. I took a peek at command.lua and I take it that having one of those methods return false is how one "rejects" the attempt? Many of my nodes' inventories are picky about what gets put in them (eg, furnaces that only allow burnables to be put in the fuel slot or crafting tables that reject raw materials they don't have recipes to use).
Also, a suggestion; it would be good if those functions also had a "player" parameter to allow for node protection to determine whether a request comes from an authorized player. When I reworked the [hopper] mod a while back to give it a generalized API I made hopper nodes remember the identity of the player that placed them and passed a fake player object with that name as a parameter to the "allow X inventory operation" methods (see the get_placer function), you could perhaps do something similar. That way you could hook up a tube to a locked chest that you owned but not to a chest that someone else owned, and the tube would continue functioning with the correct restrictions after you'd logged off.
Also, a suggestion; it would be good if those functions also had a "player" parameter to allow for node protection to determine whether a request comes from an authorized player. When I reworked the [hopper] mod a while back to give it a generalized API I made hopper nodes remember the identity of the player that placed them and passed a fake player object with that name as a parameter to the "allow X inventory operation" methods (see the get_placer function), you could perhaps do something similar. That way you could hook up a tube to a locked chest that you owned but not to a chest that someone else owned, and the tube would continue functioning with the correct restrictions after you'd logged off.
- ManElevation
- Member
- Posts: 896
- Joined: Tue Aug 02, 2016 22:04
- GitHub: ManElevation
- IRC: ManElevation
- In-game: ManElevation
- Location: Madrid,Spain
Re: [Mod] Minetest-Tubelib [tubelib]
sounds like its a mix of basic_machines basic_robots and technic
+1
+1
My Public Mods! Discord: Rottweiler Games#3368
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: [Mod] Minetest-Tubelib [tubelib]
Don't take a player, take a player name so you don't need to hack about with fake players. Or at least take both.
Every time a mod API is left undocumented, a koala dies.
Re: [Mod] Minetest-Tubelib [tubelib]
You have to hack about with fake players if you're going to call allow_metadata_inventory_put, allow_metadata_inventory_take, or allow_metadata_inventory_move - those require player objects rather than player names. It's just a question of where you put the hackery, I suppose.
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: [Mod] Minetest-Tubelib [tubelib]
Then define a different function for the tube interface. allow_metadata* is meant specifically to handle formspec moves by players.
Every time a mod API is left undocumented, a koala dies.
Re: [Mod] Minetest-Tubelib [tubelib]
That would require every mod that defines nodes with inventories to add a second duplicate player-permissions check to their node defs if they wanted to add pipeworks compatibility. It's rare enough that modders remember to add player-permissions checks to the existing allow_metadata* methods.
In an ideal world I agree, it's not correct to be creating fake player objects. It'd be nicer if you could get legit player objects for players who aren't logged in. But this is the world we are in now and it's not really all that big a hack in the grand scheme of things. Creating fake player objects works fine. If Tubelib passes a player name string rather than a fake player object that's fine, I'll make a fake player object myself when I do the allow_metadata* checks in my mods. I just think it's an unnecessary extra step to place on every modder who wants to do this.
In an ideal world I agree, it's not correct to be creating fake player objects. It'd be nicer if you could get legit player objects for players who aren't logged in. But this is the world we are in now and it's not really all that big a hack in the grand scheme of things. Creating fake player objects works fine. If Tubelib passes a player name string rather than a fake player object that's fine, I'll make a fake player object myself when I do the allow_metadata* checks in my mods. I just think it's an unnecessary extra step to place on every modder who wants to do this.
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: [Mod] Minetest-Tubelib [tubelib]
You shouldn't be able to get player objects for offline players because almost all the ObjectRef methods mean nothing if the player isn't really there. The only method that is really useful for offline players is get_player_name(), so you might as well just use the player name alone.
Every time a mod API is left undocumented, a koala dies.
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: [Mod] Minetest-Tubelib [tubelib]
Also why not reuse the pipeworks interface?
Every time a mod API is left undocumented, a koala dies.
- joe7575
- Member
- Posts: 851
- Joined: Mon Apr 24, 2017 20:38
- GitHub: joe7575
- In-game: JoSto wuffi
- Location: Germany, in the deep south
Re: [Mod] Minetest-Tubelib [tubelib]
Perhaps I have a too simple picture in my mind, but why show I check the player rights for each item going through tubes?
If an item is moved from block A to block B my means of a tube, the placer of the tubes has to have the necessary rights to build the tube. This should always be true in protected areas.
But yes, if we have a locked chest in an unprotected area, it is currently possible to empty this chest by means of the tubelib.
But for this case, the placing of the tube/pusher should be restricted, which has to be done only once and not frequently like the item transfer, or?
Would it not be easier, if a tube/pusher is placed nearby a locked chest or any other locked node, to check the player name against the owner of the chest?
If an item is moved from block A to block B my means of a tube, the placer of the tubes has to have the necessary rights to build the tube. This should always be true in protected areas.
But yes, if we have a locked chest in an unprotected area, it is currently possible to empty this chest by means of the tubelib.
But for this case, the placing of the tube/pusher should be restricted, which has to be done only once and not frequently like the item transfer, or?
Would it not be easier, if a tube/pusher is placed nearby a locked chest or any other locked node, to check the player name against the owner of the chest?
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.
-
- Member
- Posts: 999
- Joined: Sat Aug 19, 2017 21:49
- GitHub: Chemguy99
- In-game: Chem Nyx
- Location: My Basement's Attic
Re: [Mod] Minetest-Tubelib [tubelib]
Checking the owners of the pusher and the locked chest(s) together makes perfect sense.
What is SCP-055?
Re: [Mod] Minetest-Tubelib [tubelib]
The idea is that by passing the player object (or player name, they can make their own player object from that if need be) as a parameter to the on_pull_item functions you give the target node the information it needs to figure out for itself whether it should be "protected" or not via its existing allow_metadata_inventory* methods. If you try to do the locked chest's work for it by using special-case code that specifically checks a default:locked_chest's owner then another mod that wants to add items with protected inventories will have to edit tubelib to add that protection check rather than adding it within their own code.joe7575 wrote: Would it not be easier, if a tube/pusher is placed nearby a locked chest or any other locked node, to check the player name against the owner of the chest?
This allows the modder who's adding tubelib support to make it work right out of the box without having to touch tubelib's code. And it lets them do fancy stuff, like maybe they've created a chest that only allows people with names beginning with a certain letter to access it, or its locked state changes with the time of day, or whatever.
-
- Member
- Posts: 22
- Joined: Tue Oct 03, 2017 08:54
- GitHub: downad
- In-game: downad
- Location: Germany
Re: [Mod] Minetest-Tubelib [tubelib]
Hallo Joe7575,
i tried this and i am very happy.
but i can't fill an furnace with ore and coal
if i try to fill it, the ore or the coal is set in the smelt field.
the coal is not set in the fuel field
can you help me?
gruß
downad
i tried this and i am very happy.
but i can't fill an furnace with ore and coal
if i try to fill it, the ore or the coal is set in the smelt field.
the coal is not set in the fuel field
can you help me?
gruß
downad
-
- Member
- Posts: 999
- Joined: Sat Aug 19, 2017 21:49
- GitHub: Chemguy99
- In-game: Chem Nyx
- Location: My Basement's Attic
Re: [Mod] Minetest-Tubelib [tubelib]
I think the tube carrying coal needs to be inserted into the bottom of the furnace.
What is SCP-055?
- joe7575
- Member
- Posts: 851
- Joined: Mon Apr 24, 2017 20:38
- GitHub: joe7575
- In-game: JoSto wuffi
- Location: Germany, in the deep south
Re: [Mod] Minetest-Tubelib [tubelib]
The furnace adaptation has a table with valid fuels, so that it is independent from which side you push the items in. The "default:coal_lump" was missing.
But it should work now.
But it should work now.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.
Who is online
Users browsing this forum: No registered users and 9 guests