[Mod] Boost cart [boost_cart]

User avatar
benrob0329
Member
 
Posts: 1233
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
In-game: benrob03
 

User avatar
Krock
Developer
 
Posts: 3920
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: [Mod] Boost cart [boost_cart]

by Krock » Tue Dec 22, 2015 08:14

amadin wrote:Can you add different texture inside and outside cart? I want replace texture with wheels like in minecart.
Can you set contorl by keys (up, down), like in minecraft, or how can i do this by itself?.

Yes. You can replace the "cart.png" texture and "cart.x" model.
The `down´ key decelerates the cart, so it's easy to add the `up´ key to accelerate the cart.
https://github.com/SmallJoker/boost_car ... t.lua#L232
You may try adding the following under the handbrake function:
Code: Select all
if ctrl and ctrl.up then
acc = acc + 0.5
end


Laudrin wrote:I recognized that boost_cart rails have a slightly brighter texture <snip> Nothing serious, but is that an intentional choice?

Some suggestions <snip>: <snip> switch railroad junctions
<snip> when the signal is red, a brake rail would stop the cart (not only decelerate) independent of its speed.

There are still some glitchy situations when there's high lag, so don't expect a smooth ride.
The old textures were not useful after the direction choice feature, so I replaced them to give them a better look.

You can use sticky pistons to destroy the rails, so the cart will stop instantly (or maybe not?).
Brake rails can turned on and off with mesecons already now, so a new type or rail would be required (buffer rail?).

The "forced" switch is a good idea. Mesecon signal on junction = push cart in the opposite direction.
If you know Lua and how to use GitHub, I would like to see a pull request. Otherwise it may take a while until I add new features.

benrob0329 wrote:Would forceloading the rails be possible?

It forceloads specific nodes, if they're not loaded yet. However, this does not work anytime.
https://github.com/SmallJoker/boost_car ... ns.lua#L38
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

Laudrin
New member
 
Posts: 8
Joined: Mon Dec 21, 2015 10:23
IRC: Laudrin
In-game: laudrin

Re: [Mod] Boost cart [boost_cart]

by Laudrin » Tue Dec 22, 2015 16:22

Krock wrote:You can use sticky pistons to destroy the rails, so the cart will stop instantly (or maybe not?).


Hm, I already experimented with those, but as you said, that would mean the rail track would be destroyed and I'd have to repair it manually.

Brake rails can turned on and off with mesecons already now, so a new type or rail would be required (buffer rail?).


Unfortunately brake rails are too unreliable where exactly the cart will stop (at first I tried to slow down the cart via brake rails so it will stop on a longer part of the track containing powered rails, but sometimes the cart would stop on the brake rails, sometimes it won't slow down enough and pass the brake and the powered rails) and I cannot restart the cart via button / powered rails.

Maybe best would be a start/stop rail. When not connected to a power source / powered mesecon the cart would stop (instant brake rail), when powered the rails would act like a powered rail.

The "forced" switch is a good idea. Mesecon signal on junction = push cart in the opposite direction.
If you know Lua and how to use GitHub, I would like to see a pull request. Otherwise it may take a while until I add new features.


I already browsed the code, but I'm neither familiar with Lua nor GitHub. I'll try to understand how programming/modding for Minetest is done in Lua and if I'd succeed I attach / send the code for further testing. :-) But please don't expect results too soon from someone new to Lua like me.

Thanks for taking my suggestions into consideration! :-)
 

Laudrin
New member
 
Posts: 8
Joined: Mon Dec 21, 2015 10:23
IRC: Laudrin
In-game: laudrin

Re: [Mod] Boost cart [boost_cart]

by Laudrin » Wed Dec 23, 2015 00:19

Krock, I created a new kind of rail ("stop rail") which should stop the cart when not powered via mesecon, and accelerate it when powered. Acceleration works fine, but I only can find a way to set an amount of deceleration for the rail, not to stop the cart completely via function or directly setting the carts velocity to zero.

Can you give me a hint how it's done?

If the stop rail works, it can be used to build signals which will stop the cart immediately when signalling red/stop and start them again as soon as the signal turns green/go.
 

User avatar
Krock
Developer
 
Posts: 3920
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: [Mod] Boost cart [boost_cart]

by Krock » Wed Dec 23, 2015 07:42

Laudrin wrote:Can you give me a hint how it's done?

Using the acceleration and deceleration feature is a good start but not the best solution. The cart calculates its velocity each node, this means, it will decelerate and start moving backwards again (like it does on hills).

What I would do is:
- Adding a new meta int "cart_stop" to the new stop rail node
- Checking the meta value near here
- Changing acceleration `acc´ and velocity `vel´ array all to zero and the velocity update flag `update.vel´ to `true´ when the integer "cart_stop" equals 1

The problem will be the cart starting. It does not know in which direction it was driving before -> valvulated by velocity.
However, also this can be solved by getting the cart yaw and defining its direction that way.

I hope this explanation was partwise understandable.
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

twoelk
Member
 
Posts: 1214
Joined: Fri Apr 19, 2013 16:19
Location: northern Germany
GitHub: twoelk
IRC: twoelk
In-game: twoelk

Re: [Mod] Boost cart [boost_cart]

by twoelk » Wed Dec 23, 2015 11:34

was playing with the freeze mod some time ago that had a similar problem.
I experimented with teleporting the player/object a zero distance to eleminate any velocity.
btw never got working the way I had hoped.

so with carts, how about the rail detecting the passing cart and teleporting it back to the center of the node and while doing so over riding any direction and velocity information. might have something of a snapback effect on a fast cart on a laggy server though. :-D

you might have the special rail store the movement information for future use if needed.
 

Laudrin
New member
 
Posts: 8
Joined: Mon Dec 21, 2015 10:23
IRC: Laudrin
In-game: laudrin

Re: [Mod] Boost cart [boost_cart]

by Laudrin » Wed Dec 23, 2015 11:51

Krock wrote:The cart calculates its velocity each node, this means, it will decelerate and start moving backwards again (like it does on hills).


Yes, that was my problem, the cart would reverse direction instead of stopping.

- Adding a new meta int "cart_stop" to the new stop rail node
- Checking the meta value near init.lua line 219
- Changing acceleration `acc´ and velocity `vel´ array all to zero and the velocity update flag `update.vel´ to `true´ when the integer "cart_stop" equals 1


Did what you recommended, testing for hours with various variants of the code try to work out lua programming with the tutorials and looking at your mod and other mod's code.

Even with restarting minetest, removing the rails and building them anew I get different results. Sometimes it works: The cart will stop on the stop rail and start again (even in the right direction) when punching the mesecon button connected to the rails. But sometimes the cart will just slow down a bit and then accelerate again, passing the stop rail. :-/

I duplicated the power rail's code and texture, renamed the texture and changed it's color, and replaced parts of the code as follows:

Code: Select all
   after_place_node = function(pos, placer, itemstack)
      if not mesecon then
         minetest.env:get_meta(pos):set_int("cart_stop", "1")
      end
   end,
   
   mesecons = {
      effector = {
         action_on = function(pos, node)
            minetest.env:get_meta(pos):set_int("cart_stop", "0")
            boost_cart:boost_rail(pos, 2)
         end,
         
         action_off = function(pos, node)
            minetest.env:get_meta(pos):set_int("cart_stop", "1")
         end,
      },
   },


I changed the rail and crafting definition, too. That seems to work, I can craft the stop rails and place them on the ground.

Here's the part in the init.lua I added (without the print commands for debug output):

Code: Select all
local stop_mod = tonumber(minetest.get_meta(pos):get_int("cart_stop"))
if stop_mod and stop_mod >= 1 then
   acc = 0
   for _,v in ipairs({"x","y","z"}) do
      vel[v] = 0
      update.vel = true
   end
end


But as I wrote sometimes it works, sometimes the cart won't stop even when the debug message tells me that the stop rail was detected and velocity set to 0.

The problem will be the cart starting. It does not know in which direction it was driving before -> valvulated by velocity.
However, also this can be solved by getting the cart yaw and defining its direction that way.


Thanks, I will look into it as soon as I fixed stopping and starting the cart.
 

User avatar
SaKeL
Member
 
Posts: 458
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: [Mod] Boost cart [boost_cart]

by SaKeL » Tue Jan 12, 2016 23:20

i get stuck in the walls and floor when im driving and punching the cart (not sure if punching it is the reason), is this known issue ? Only logout/login helps to un-stuck myself again :/
Follow my Collection for more Minetest creations found on my server or join the Community for the latest Server updates and news.

SaKeL
 

User avatar
Krock
Developer
 
Posts: 3920
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: [Mod] Boost cart [boost_cart]

by Krock » Sun Jan 17, 2016 09:18

twoelk wrote:how about the rail detecting the passing cart and teleporting it back to the center of the node and while doing so over riding any direction and velocity information

That's what the cart should do when it can't find the next rail - it resets to the last known position. However, this seems not to work everytime.

Laudrin wrote:Even with restarting minetest, removing the rails and building them anew I get different results. Sometimes it works: The cart will stop on the stop rail and start again (even in the right direction) when punching the mesecon button connected to the rails. But sometimes the cart will just slow down a bit and then accelerate again, passing the stop rail. :-/

If the cart moves too fast, it can "skip" a node - it does not check it if it's a rail or not. Using this method, the cart should move a bit smoother. However, the downside is that you might need two or even three nodes until the cart reads one of them when driving on them.

SaKeL wrote:i get stuck in the walls and floor when im driving and punching the cart

Yes, sometimes it doesn't reset the cart position. I haven't found a way to fix this yet. Early versions of boost_cart had more bugs in that area - make sure you have the latest version from GitHub.
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

amadin
Member
 
Posts: 506
Joined: Tue Jun 16, 2015 16:23

Re: [Mod] Boost cart [boost_cart]

by amadin » Mon Jan 18, 2016 18:50

ATTENTION!!! Mod have bug: if you put cart and then disconnect and connect again - cart will not work.
 

User avatar
Fixer
Member
 
Posts: 841
Joined: Sun Jul 31, 2011 11:23
Location: Ukraine
IRC: Fixer
In-game: Fixer

Re: [Mod] Boost cart [boost_cart]

by Fixer » Wed Jun 29, 2016 17:20

ATTENTION!!! Mod have bug: if you put cart and then disconnect and connect again - cart will not work.


That bug was fixed :) Enjoy your railways! Works nice for me.
 

222
New member
 
Posts: 4
Joined: Thu Mar 24, 2016 03:35

Re: [Mod] Boost cart [boost_cart]

by 222 » Fri Jul 01, 2016 09:36

Krock wrote:
amadin wrote:You may try adding the following under the handbrake function:
Code: Select all
if ctrl and ctrl.up then
acc = acc + 0.5
end


I've tried adding it after
Code: Select all
if ctrl and ctrl.down and math.abs(vel.x + vel.z) > 1.2 then
            acc = acc - 1.2
         end

and I'm not seeing a difference. Did I put it in the wrong place?
Thanks.
 

User avatar
Krock
Developer
 
Posts: 3920
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: [Mod] Boost cart [boost_cart]

by Krock » Sat Jul 02, 2016 11:57

222 wrote:and I'm not seeing a difference. Did I put it in the wrong place?

No, you added it correctly. To make the difference bigger, try changing the value to 1 instead of 0.5:
Code: Select all
acc = acc + 1

When you did everything correctly, it should work properly.
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

luewind
New member
 
Posts: 8
Joined: Thu Mar 12, 2015 20:19
In-game: luewind

Re: [Mod] Boost cart [boost_cart]

by luewind » Fri Aug 12, 2016 15:58

Decided to try this mod because the base carts mode was too buggy and so far have like it. I have found two possible issues; I have a rather large square mine under my base and wanted to use rails to easily get up and down. he going down isn't the issue but going up is the issue. I currently have boost rails every other rail but just using the power of the boost rails to move the cart forward its only able to climb ~24 block before is slows down too much and heads back down. The only reason i can gather that the cart slows down is that dir.y gets too large, a dir.y value of 3 or greater will negate any acc from the boost rails.

the other issue is that this code:
Code: Select all
if mesecon then
      boost_cart:signal_detector_rail(vector.round(pos))
end

still throws a nil exception. the fix you recently made on github to line 27 of the init file will fix it. What is odd is that i have mesecons installed but the detector rail is not available.
 

User avatar
Krock
Developer
 
Posts: 3920
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: [Mod] Boost cart [boost_cart]

by Krock » Fri Aug 12, 2016 18:45

luewind wrote:still throws a nil exception. the fix you recently made on github to line 27 of the init file will fix it. What is odd is that i have mesecons installed but the detector rail is not available.

Thanks for the report. This bug was fixed in the most recent commit: 7d6132

If it still doesn't work after this commit, check if you enabled the mod "mesecons" or reinstall the complete modpack if required.
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

User avatar
ExeterDad
Member
 
Posts: 1633
Joined: Sun Jun 01, 2014 20:00
Location: New Hampshire U.S.A
In-game: ExeterDad

Re: [Mod] Boost cart [boost_cart]

by ExeterDad » Sun Aug 14, 2016 02:03

Today it just occurred to me that the arrow keys are not working for me. I assumed it was a laptop thing. I tried with a real keyboard as well. I can not use the arrows to turn at crossings, nor can I brake with the down arrow key. I tried on our server and also in singleplayer.
Minetest does see my arrow keys as I can toggle through command history in chat. That said... is it possible the new chat could be affecting this for boost carts? Can anyone replicate this behavior? Or am I missing something?
Love the mod by the way.
 

User avatar
Krock
Developer
 
Posts: 3920
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: [Mod] Boost cart [boost_cart]

by Krock » Sun Aug 14, 2016 07:23

ExeterDad wrote:Today it just occurred to me that the arrow keys are not working for me.

Using Lua it's not possible to check the <- ^ v -> arrow keys, thus you must use A and D to switch the rails.
Surely it works in the chat, because it's a client side thing ;)
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

User avatar
ExeterDad
Member
 
Posts: 1633
Joined: Sun Jun 01, 2014 20:00
Location: New Hampshire U.S.A
In-game: ExeterDad

Re: [Mod] Boost cart [boost_cart]

by ExeterDad » Sun Aug 14, 2016 17:32

Thanks Krock. I completely misunderstood. I took it as literal that the < ^ v > keys were used in this mod. Can't believe I never thought to try the WASD keys *headsmack

I'll check it out later when we play again.
 

Jesseman1
Member
 
Posts: 49
Joined: Fri Dec 12, 2014 21:32
Location: My huge fortress or power plant.
In-game: Jesseman1 or Plant_Operator

Re: [Mod] Boost cart [boost_cart]

by Jesseman1 » Thu Sep 15, 2016 20:22

Quick question: I've never updated a mod before, so is the link found on the first page changed with every update, or do I need to scroll through the list of replies to find it?
 

User avatar
ExeterDad
Member
 
Posts: 1633
Joined: Sun Jun 01, 2014 20:00
Location: New Hampshire U.S.A
In-game: ExeterDad

Re: [Mod] Boost cart [boost_cart]

by ExeterDad » Thu Sep 15, 2016 20:34

The links in his first post are linked to his GitHub. Those kind of links are the latest code.
 

User avatar
Krock
Developer
 
Posts: 3920
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: [Mod] Boost cart [boost_cart]

by Krock » Sun Nov 27, 2016 11:51

Update time


There is now a slightly modified version of this boost_cart mod in the official minetest_game. Thus, you will most likely not need this mod anymore after the release of Minetest 0.4.15.
However, there are some differences:

Mesecons
When enabled, they are used to turn the acceleration of power- and brake-rails on and off. In the MTG (minetest_game) version you won't be able to turn them off again: all rails have a pre-defined acceleration value, which cannot be changed per node (yet).

Additional rails
The start/stop and detector rails, which depend on mesecons, are only available in this mod. They will result in unknown nodes when disabling boost_cart.

Other..
Also the people people who use a different subgame can still use carts without the effort to copy & paste the carts mod out of MTG. All subgames which contain the default mod (= almost all of them) are fully supported.

Latest changes (in boost_cart)
New rail textures, the T junction rails now show the default choosen direction, when no key is pressed to move the cart in the opposite direction.
Image

Don't forget to report bugs and ask questions - bring the development along!
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

ABJ
Member
 
Posts: 3015
Joined: Sun Jan 18, 2015 13:02
Location: In Earth orbit, with a perigee of 1048 km and an apogee of 1337 km and an inclination of 69 degrees.
GitHub: ABJ-MV
In-game: ABJ
 

redblade7
Member
 
Posts: 194
Joined: Sun Feb 15, 2015 07:14
IRC: redneonglow redblade7
In-game: redblade7 redblade7_owner

Re: [Mod] Boost cart [boost_cart]

by redblade7 » Fri Dec 09, 2016 06:22

There is a big problem with the included carts mod now: you can't punch a side to change the direction, it just keeps going and going until you pick it up. So on my server I moved carts out of games/minetest_game/mods while leaving boost_cart there.

There is a bug a player discovered: /home does not work when you are inside a cart.
-redblade7, admin of: THE CREATIVE GARDENS (creative), THE VALLEYS (sandbox), and THE DIGITAL FARMS (farming/hunger/shops)
 

User avatar
Krock
Developer
 
Posts: 3920
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: [Mod] Boost cart [boost_cart]

by Krock » Fri Dec 09, 2016 19:45

ABJ wrote:Hey why the change?

Because I can. \o/

redblade7 wrote:you can't punch a side to change the direction, it just keeps going and going until you pick it up.

I tested this with the latest version of MTG's carts on a Windows in-development build and couldn't reproduce this issue. Please download/pull the newest version from GitHub and try again.
redblade7 wrote:/home does not work when you are inside a cart.

/teleport does not work then aswell. Mods that use attachments like beds, boats and planes have the same behaviour. It would mess up these mods when the players would be force teleported, thus this is not a bug and logically won't be fixed.
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

redblade7
Member
 
Posts: 194
Joined: Sun Feb 15, 2015 07:14
IRC: redneonglow redblade7
In-game: redblade7 redblade7_owner

Re: [Mod] Boost cart [boost_cart]

by redblade7 » Fri Dec 09, 2016 20:04

Krock wrote:
redblade7 wrote:you can't punch a side to change the direction, it just keeps going and going until you pick it up.

I tested this with the latest version of MTG's carts on a Windows in-development build and couldn't reproduce this issue. Please download/pull the newest version from GitHub and try again.


MTG's powered rails without mesecons power plants are as fast as your powered rails with mesecons power plants. So there's no "in-between speed" for rail systems already built.
-redblade7, admin of: THE CREATIVE GARDENS (creative), THE VALLEYS (sandbox), and THE DIGITAL FARMS (farming/hunger/shops)
 

PreviousNext

Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 8 guests