[Mod] Minecart [minecart]

[Mod] Minecart [minecart]

Postby joe7575 » Sun Apr 21, 2019 9:50 pm

A minecart running through unloaded areas for Minetest v5.0+

Image

Minecart is based on carts.
The minecart can "run" through unloaded areas. This is done by means of stored routes. If the area is unloaded the cart will simply follow the predefined route until an area is loaded again.
In this case the cart will be spawned and run as usual.

The main use of the Minecart is for item transport from mines to warehouses, ideally by means of an automation mod like Signs Bot: https://github.com/joe7575/signs_bot


Introduction

  1. Place your rails and build a route with two ends. Junctions are allowed as long as each route has its own start and end point.
  2. Place a Railway Buffer at both ends.
  3. Drive the route in both directions (route recording), starting at the Railway Buffers.
  4. Now you can drop items into the Minecart and punch der cart to get started.
  5. To get the items back you have to dig the cart (as usual).

The code is on GitHub.

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

Dependencies
default, carts
optional: signs_bot
joe7575
Member
 
Posts: 306
Joined: Mon Apr 24, 2017 8:38 pm
In-game: JoSto

Re: [Mod] Minecart [minecart]

Postby BuckarooBanzay » Mon Apr 22, 2019 8:56 pm

Oh, that looks nice, i do like the concept.
Any chance you have an api hook or variable to read out the current positions of the carts?

I added the trains from the advtrains mod a few weeks ago to my mapserver (viewtopic.php?f=14&t=21999)
I think the carts will be a great addition too..
BuckarooBanzay
Member
 
Posts: 226
Joined: Tue Apr 24, 2018 5:58 am
GitHub: thomasrudin-mt
In-game: BuckarooBanzai

Re: [Mod] Minecart [minecart]

Postby Festus1965 » Mon Apr 22, 2019 10:53 pm

joe7575 wrote:A minecart running through unloaded areas for Minetest v5.0+
If the area is unloaded the cart will simply follow the predefined route until an area is loaded again.


hmm to automatic load, the blocks it passes ?
but load does not mean activate,
but anyway - that can bring a lot of additional work for the server - fight between player loads and keep, and now loading blocks just for the cart ...
Festus1965
Member
 
Posts: 975
Joined: Sun Jan 03, 2016 11:58 am
GitHub: Minetest-One
In-game: Thomas Explorer

Re: [Mod] Minecart [minecart]

Postby gpcf » Tue Apr 23, 2019 5:20 am

There is also an abandoned carts mod based on advtrains. It should not be too hard to port this to the new version of advtrains, since advtrains is prepared to run this kind of stuff.
gpcf
Member
 
Posts: 303
Joined: Fri May 27, 2016 10:48 am
In-game: gabriel

Re: [Mod] Minecart [minecart]

Postby joe7575 » Tue Apr 23, 2019 7:35 am

BuckarooBanzay wrote:Any chance you have an api hook or variable to read out the current positions of the carts?

Sure, I have to maintain a list of running carts anyway. I could make this global or provide an API function to retrieve the running carts with position and speed.
But as gpcf already wrote, if you already have advtrains, why using this approach in addition?

Festus1965 wrote:... that can bring a lot of additional work for the server - fight between player loads and keep, and now loading blocks just for the cart ...

No, its the other way round. Carts reaching an anloaded block will be removed from the map. If a cart would reach a loaded block, it will be spawned again.
joe7575
Member
 
Posts: 306
Joined: Mon Apr 24, 2017 8:38 pm
In-game: JoSto

Re: [Mod] Minecart [minecart]

Postby joe7575 » Tue Apr 23, 2019 6:03 pm

I have added an API function minecart.get_cart_list() which returns a list with elements {pos = <pos>, speed = <speed>}
Not sure if that's what you expect...
v0.03 is on GitHub and in Content DB (if it has been approved)
joe7575
Member
 
Posts: 306
Joined: Mon Apr 24, 2017 8:38 pm
In-game: JoSto

Re: [Mod] Minecart [minecart]

Postby joe7575 » Thu Apr 25, 2019 8:53 pm

Update:
v0.04 is available with the following additions:
- The Minecart is now protected and can only be removed by the owner or with "minecart" privs.
- Additional landmarks are used to protect the rail network (to be placed at least every 16 blocks).

Image
joe7575
Member
 
Posts: 306
Joined: Mon Apr 24, 2017 8:38 pm
In-game: JoSto



Return to WIP Mods



Who is online

Users browsing this forum: Yandex Bot [Bot] and 0 guests