Page 2 of 3

Re: [Mod] Boost cart [boost_cart]

PostPosted: Fri Apr 24, 2015 08:52
by ABJ
Thank you very much lightonflux :)
Only problem? The commits needed for CiaranG's railcarts mod has mysteriously disappeared :'( But that's not your fault tho :)

Re: [Mod] Boost cart [boost_cart]

PostPosted: Sun May 17, 2015 06:49
by ABJ
I am making my own version of this. Is it OK if I release? And what else do I have to do?

Image
Image
Image

Re: [Mod] Boost cart [boost_cart]

PostPosted: Sun May 17, 2015 07:25
by Krock
Splizard wrote:We need upside down rails so we can make rollercoasters!

That would require a rotation function for the vertical axis.

ABJ wrote:I am making my own version of this. Is it OK if I release? And what else do I have to do?

You can release it whenever you want but I suggest to change more things. It's nonsense to have +/- the same mod 3 times on this forum.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Sun May 17, 2015 08:53
by ABJ
Yes Krock that is just a small demo of what I'm planning for. And is it OK if I keep the same name? I want this mod to replace the default one and the crafting recipes are also same as I don't want to change.

TODO:
-Fancy gold/silver/glowing rails
-Maybe giving the cart a makeover?
-Changing this mod A LOT.

EDIT: And what do you think of this mod's current progress? Is it looking better or worse?

Re: [Mod] Boost cart [boost_cart]

PostPosted: Mon May 18, 2015 08:38
by ABJ
Here it is!
Hicarts
It's very different from this mod. Notably in that it has collision detection :)

Re: [Mod] Boost cart [boost_cart]

PostPosted: Mon May 18, 2015 20:49
by arifsaha
Unfortunately I consistently experience server crashing whenever I right-click the cart. The log shows this:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
May 18 14:34:20 2013lr minetestserver[11467]: 14:34:20: ACTION[ServerThread]: MYUSER right-clicks object 2: LuaEntitySAO at (-14,19,-64)
May 18 14:34:21 2013lr minetestserver[11467]: 14:34:21: ERROR[main]: ERROR: An unhandled exception occurred: /var/lib/minetest/.minetest/mods/boost_cart/init.lua:47: attempt to index field 'player_attached' (a nil value)
May 18 14:34:21 2013lr minetestserver[11467]: 14:34:21: ERROR[main]: stack traceback:
May 18 14:34:21 2013lr minetestserver[11467]: 14:34:21: ERROR[main]: #011/var/lib/minetest/.minetest/mods/boost_cart/init.lua:47: in function </var/lib/minetest/.minetest/mods/boost_cart/init.lua:37>
May 18 14:34:21 2013lr minetestserver[11467]: In thread 7f7b8d498880:
May 18 14:34:21 2013lr minetestserver[11467]: /builddir/build/BUILD/minetest-0.4.9/src/main.cpp:1860: int main(int, char**): Assertion '0' failed.
May 18 14:34:21 2013lr minetestserver[11467]: Debug stacks:
May 18 14:34:21 2013lr minetestserver[11467]: DEBUG STACK FOR THREAD 7f7b8d498880:
May 18 14:34:21 2013lr minetestserver[11467]: #0  int main(int, char**)
May 18 14:34:21 2013lr minetestserver[11467]: (Leftover data: #1  Dedicated server branch)
May 18 14:34:21 2013lr minetestserver[11467]: (Leftover data: #2  virtual void ServerMap::save(ModifiedState))
May 18 14:34:21 2013lr minetestserver[11467]: (Leftover data: #3  virtual void Database_SQLite3::saveBlock(MapBlock*))


Any thought?

Thanks!

Re: [Mod] Boost cart [boost_cart]

PostPosted: Fri Jun 05, 2015 18:36
by Krock
Today is an update day!

arifsaha wrote:Unfortunately I consistently experience server crashing whenever I right-click the cart. The log shows this:
<snip>

Fixed.

New detector rails for mesecons, added by numberZero:

Image

Re: [Mod] Boost cart [boost_cart]

PostPosted: Tue Sep 29, 2015 11:12
by uind_w
I read "detector.lua" and find...
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_craft({
   output = "boost_cart:detectorrail 6",
   recipe = {
      {"default:steel_ingot", "mesecon:mesecon", "default:steel_ingot"},
      {"default:steel_ingot", "group:stick", "default:steel_ingot"},
      {"default:steel_ingot", "mesecon:mesecon", "default:steel_ingot"},
   },

(Line 43-49)
"mesecon:mesecon" is should be "mesecons:mesecon"?

Re: [Mod] Boost cart [boost_cart]

PostPosted: Tue Sep 29, 2015 16:22
by Krock
uind_w wrote:"mesecon:mesecon" is should be "mesecons:mesecon"?

Thanks for pointing this out. I shouldn't use creative mode to test the new features :)
https://github.com/SmallJoker/boost_cart/commit/ddb6
The recipe will also work when "mesecons_alias" isn't activated.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Sat Oct 17, 2015 15:16
by tomlukeywood
i get the error /home/tom/MinetestGame/bin../mods/carts_mod/init.lua:2: attempt to concatenate a nil value

:(

any ideas?

Re: [Mod] Boost cart [boost_cart]

PostPosted: Sat Oct 17, 2015 17:03
by TenPlus1
tomlukeywood: rename carts_mod directory to just carts.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Wed Nov 11, 2015 23:58
by katsukitty
TenPlus1 wrote:tomlukeywood: rename carts_mod directory to just carts.


"2015-11-11 18:57:11: ERROR[Main]: ...e/katsu/Programs/minetest/bin/../mods/carts/init.lua:16: attempt to concatenate field 'modpath' (a nil value)"

I get the same error when it's named "carts". Possible bug?

Re: [Mod] Boost cart [boost_cart]

PostPosted: Thu Nov 12, 2015 09:08
by Ivà
katsukitty wrote:"2015-11-11 18:57:11: ERROR[Main]: ...e/katsu/Programs/minetest/bin/../mods/carts/init.lua:16: attempt to concatenate field 'modpath' (a nil value)"

I get the same error when it's named "carts". Possible bug?


It should be boost_cart, as the title says.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Fri Nov 13, 2015 22:13
by Krock
katsukitty wrote:I get the same error when it's named "carts". Possible bug?

Here's the early XMAS gift for everybody who can't rename mod directories correctly.
I hope this is an understandable error for everybody with this problem.

EDIT: Post #3100

Re: [Mod] Boost cart [boost_cart]

PostPosted: Sat Nov 14, 2015 07:51
by TenPlus1
Nicely done Krock... btw sorry for typing wrong folder name folks.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Sun Nov 29, 2015 19:15
by Alienant1
is the power rail/mesecons compatibility now part of the standard download or do I still need to download separately?

Re: [Mod] Boost cart [boost_cart]

PostPosted: Mon Dec 21, 2015 13:36
by amadin
Can you add stop cart by punching against the moving direction to last commit? I saw it in old commit.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Mon Dec 21, 2015 16:40
by Krock
Alienant1 wrote:is the power rail/mesecons compatibility now part of the standard download or do I still need to download separately?

Sorry for the late reply. The mesecons compatibility is there with the standard download.

amadin wrote:Can you add stop cart by punching against the moving direction to last commit? I saw it in old commit.

It's already now possible to slow down the cart by punching in the opposite direction. Just move slowly (or press the back/down key) to make it stop.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Mon Dec 21, 2015 17:56
by amadin
It's already now possible to slow down the cart by punching in the opposite direction. Just move slowly (or press the back/down key) to make it stop.

If cart drive on power rails only it don't stop by punching in the opposite direction or pressing back key.

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?.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Mon Dec 21, 2015 18:24
by Laudrin
Thank you Krock, for your awesome addition to the carts mod. It eliminates some of the restrictions. Now I can build a rail network in my world. :-)

I recognized that boost_cart rails have a slightly brighter texture then the original cart mod rails I build before installing your mod. Nothing serious, but is that an intentional choice?

Some suggestions if you should plan to develop more features: It would be great to have the ability to switch railroad junctions i. e. via mesecon singnal or digiline bus or something like that. And signals would be great, when the signal is red, a brake rail would stop the cart (not only decelerate) independent of its speed.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Mon Dec 21, 2015 18:25
by benrob0329
Would forceloading the rails be possible?

Re: [Mod] Boost cart [boost_cart]

PostPosted: Tue Dec 22, 2015 08:14
by Krock
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:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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

Re: [Mod] Boost cart [boost_cart]

PostPosted: Tue Dec 22, 2015 16:22
by Laudrin
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! :-)

Re: [Mod] Boost cart [boost_cart]

PostPosted: Wed Dec 23, 2015 00:19
by Laudrin
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.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Wed Dec 23, 2015 07:42
by Krock
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.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Wed Dec 23, 2015 11:34
by twoelk
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.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Wed Dec 23, 2015 11:51
by Laudrin
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:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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):

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Tue Jan 12, 2016 23:20
by SaKeL
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 :/

Re: [Mod] Boost cart [boost_cart]

PostPosted: Sun Jan 17, 2016 09:18
by Krock
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.

Re: [Mod] Boost cart [boost_cart]

PostPosted: Mon Jan 18, 2016 18:50
by amadin
ATTENTION!!! Mod have bug: if you put cart and then disconnect and connect again - cart will not work.