[Mod] Minecart [minecart]

User avatar
joe7575
Member
Posts: 851
Joined: Mon Apr 24, 2017 20:38
GitHub: joe7575
In-game: JoSto wuffi
Location: Germany, in the deep south

[Mod] Minecart [minecart]

by joe7575 » Post

Minecart, the lean railway transportation automation system

Image

The mod Minecart has its own cart (called Minecart) in addition to the standard cart.
Minecarts are used for automated item transport on private and public rail networks.
The mod features are:
  • configurable timetables and routes for Minecarts
  • automated loading/unloading of Minecarts by means of a Minecart Hopper
  • rail network protection based on protection blocks called Land Marks
  • protection of minecarts and cargo
  • Minecarts run through unloaded areas (only the stations/hopper have to be loaded)
  • Extra Minecard privs for rail workers
  • Ingame documentation (German and English), based on the mod "doc"


The code is on GitHub.

The manual is here


License
Code: MIT (as the original code)
Textures: CC-0 (as the original textures)

Dependencies
default, carts
optional: doc

Edit: Adapted to v1.0
Attachments
screenshot.png
screenshot.png (153.88 KiB) Viewed 3348 times
Last edited by joe7575 on Sat Feb 25, 2023 14:07, edited 4 times in total.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [Mod] Minecart [minecart]

by Sokomine » Post

Finally! Carts that can travel on their routes even if the area is unloaded. Without that, carts where usually a bit pointless. Thanks for creating the mod!
joe7575 wrote: To get the items back you have to dig the cart (as usual).
Perhaps a mechanism to unload the cart would be helpful. It could empty its content into a chest when punched from the side and not locked (maybe with right-click?). Just imagine those old tipping wagons that where actually used for mining. Removing those from the tracks in order to get their content wouldn't be a very practical approach.
A list of my mods can be found here.

User avatar
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] Minecart [minecart]

by joe7575 » Post

A mechanism to unload the cart is added:
1. Sneak+click the cart to get the items back
2. Dig the empty cart with a second sneak+Click (as usual).
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

R-One
Member
Posts: 160
Joined: Wed Dec 20, 2017 23:06
Location: Nice, France

Re: [Mod] Minecart [minecart]

by R-One » Post

Hi, this mod is really good.

it would be cool to be able to detect the passage of a cart (mesecon rail detector?) and another function to be able to load or unload automatically at the end of the line, can be with a node compatible with pipeworks?

Question: Entities do not destroy themselves when they are in a card after a while?

User avatar
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] Minecart [minecart]

by joe7575 » Post

R-One wrote:it would be cool to be able to detect the passage of a cart (mesecon rail detector?)
That's not so easy. The main feature of Minecart is the handling of carts in unloaded areas. A mesecon detector rail does not work in unloaded areas. To keep all areas loaded by means of forceloading items seems no good solution.
Apart from that, advtrains has all these features...
R-One wrote:and another function to be able to load or unload automatically at the end of the line, can be with a node compatible with pipeworks?
My answer to that is the Signs Bot mod which allows both.
But I could imagine some kind of hopper with cart sensor to be able to load/unload and than push the cart again.
R-One wrote:Question: Entities do not destroy themselves when they are in a card after a while?
If the cart is running, the items are stored in RAM and will not disappear. If the cart is stopped, I guess the entities will disappear after a while.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

R-One
Member
Posts: 160
Joined: Wed Dec 20, 2017 23:06
Location: Nice, France

Re: [Mod] Minecart [minecart]

by R-One » Post

hi,

Signs_bot is a little too futuristic to be put on my server, that's why I thought that a block of loading, unloading could be cool.


another small question?

You have to put a power rails all how many blocks?

User avatar
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] Minecart [minecart]

by joe7575 » Post

R-One wrote:You have to put a power rails all how many blocks?
I don't know but I guess 5 to 8 blocks between two power rails, and 1 to 2 blocks on slopes. You have to test it. But it is identical to the standard carts mod, because the rails and the cart logic are the same.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

User avatar
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] Minecart [minecart]

by joe7575 » Post

Signs_bot is a little too futuristic to be put on my server, that's why I thought that a block of loading, unloading could be cool.
loading, unloading needs some kind of chest or container node on the other side. Due to the lack of a standard API for container nodes, this could become complex and time consuming.

I know what I'm talking about, Signs Bot, tubelib/TechPack and other unfinished mods of mine, but also all other automation mods have their own, incompatible API for that....
The best way would be that your favorite automation mod would add such kind of functionality.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

neoh4x0r
Member
Posts: 82
Joined: Wed Aug 29, 2018 20:16
GitHub: neoh4x0r

Re: [Mod] Minecart [minecart]

by neoh4x0r » Post

joe7575 wrote: loading, unloading needs some kind of chest or container node on the other side. Due to the lack of a standard API for container nodes, this could become complex and time consuming.
The best way would be that your favorite automation mod would add such kind of functionality.
Minetest already provides a standard API for handling inventory.

Code: Select all

local inv1 = minetest:get_inventory(location) -- https://dev.minetest.net/minetest.get_inventory
if inv1 ~= nil then
 -- call methods on inv1
end

local meta = minetest:get_meta(pos) -- https://dev.minetest.net/minetest.get_meta
if meta ~= nil then
 local inv2 = meta:get_inventory()
  if inv2 ~= nil then
   -- call methods on inv2
 end
end
To implement loading/unloading you would simply call those methods on a nearby node (say within 1 node).
Obviously checking if the returned value is nil before continuing.

That would allow you to implement a "standard" way of doing things.

NOTE: inv1 and 2 are copies of item stack -- changed made won't be updated in the inventory unless
a call is made to a method that updates the inventory (ie set_stack, etc)

User avatar
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] Minecart [minecart]

by joe7575 » Post

Sorry, my post was not precise enough.
It is not only the access to the inventory. You have to handle the following in addition:
* the name of the inventory list has to be known
* some nodes have several lists like furnaces, which you have to distinguish
* some nodes do not even have a real inventory, they store the items in RAM or elsewhere
* some nodes have locked or protected inventories, which you have to handle in an appropriate way
* some nodes have special connection sides, which have to be considered
and so on...

There is one lib called node_io which tries to solve these issues, but the number of mods with support for node_io are rare.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

User avatar
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] Minecart [minecart]

by joe7575 » Post

Contrary to my statement one higher ( :-) ), I decided to add further features, so that Minecart is useful by its own:
- a simple Hopper to load/unload carts
- a cart stop time for each buffer. Carts start after that time automatically.

Now, Minecarts can be used as a "lean railway transportation automation system".

More info here: readme.md
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

N0RVLL
Member
Posts: 18
Joined: Sat Feb 08, 2020 17:19

Re: [Mod] Minecart [minecart]

by N0RVLL » Post

I may be missing something here, but I set up a cart, a hopper, and a chest per the .png in the folder, and the hopper pulls from the chest, but does not deposit the items in the cart-- when the cart leaves, the items are there on the ground.

What did I do wrong here?

User avatar
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] Minecart [minecart]

by joe7575 » Post

Did you use the special Minecart or a standard cart?
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

N0RVLL
Member
Posts: 18
Joined: Sat Feb 08, 2020 17:19

Re: [Mod] Minecart [minecart]

by N0RVLL » Post

The minecart specifically-- not standard cart

User avatar
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] Minecart [minecart]

by joe7575 » Post

Did you arranged it like this: https://vimeo.com/390201539
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

N0RVLL
Member
Posts: 18
Joined: Sat Feb 08, 2020 17:19

Re: [Mod] Minecart [minecart]

by N0RVLL » Post

Mine looks the same as yours. I had put a brake rail on either end of my track, but I don't see how that should matter...

User avatar
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] Minecart [minecart]

by joe7575 » Post

The rail type doesn't matter.
Do you use Minetest 5.0 or newer?
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

N0RVLL
Member
Posts: 18
Joined: Sat Feb 08, 2020 17:19

Re: [Mod] Minecart [minecart]

by N0RVLL » Post

5.1.1... something I noticed-- on one end 'a' is connected to 'b'; but the other end says 'a' connected to none. Would that affect anything?

N0RVLL
Member
Posts: 18
Joined: Sat Feb 08, 2020 17:19

Re: [Mod] Minecart [minecart]

by N0RVLL » Post

5.1.1... something I noticed-- on one end 'a' is connected to 'b'; but the other end says 'a' connected to none. Would that affect anything?

N0RVLL
Member
Posts: 18
Joined: Sat Feb 08, 2020 17:19

Re: [Mod] Minecart [minecart]

by N0RVLL » Post

5.1.1... something I noticed-- on one end 'a' is connected to 'b'; but the other end says 'a' connected to none. Would that affect anything?

N0RVLL
Member
Posts: 18
Joined: Sat Feb 08, 2020 17:19

Re: [Mod] Minecart [minecart]

by N0RVLL » Post

Sorry phone was being dumb, didn't mean to duplicate responses.

User avatar
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] Minecart [minecart]

by joe7575 » Post

No, this missing connection has no impact on the loading of the carts
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

N0RVLL
Member
Posts: 18
Joined: Sat Feb 08, 2020 17:19

Re: [Mod] Minecart [minecart]

by N0RVLL » Post

I wouldn't think so... just throwing out ideas

[img]Screenshot%20from%202020-02-08%2015-06-03.png[/img]
Attachments
Screenshot from 2020-02-08 15-06-03.png
Screenshot from 2020-02-08 15-06-03.png (396.7 KiB) Viewed 3348 times

N0RVLL
Member
Posts: 18
Joined: Sat Feb 08, 2020 17:19

Re: [Mod] Minecart [minecart]

by N0RVLL » Post

..another
Attachments
Screenshot from 2020-02-08 15-14-11.png
Screenshot from 2020-02-08 15-14-11.png (289.75 KiB) Viewed 3348 times

N0RVLL
Member
Posts: 18
Joined: Sat Feb 08, 2020 17:19

Re: [Mod] Minecart [minecart]

by N0RVLL » Post

last one.
Attachments
Screenshot from 2020-02-08 15-14-17.png
Screenshot from 2020-02-08 15-14-17.png (324.78 KiB) Viewed 3348 times

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 17 guests