Page 1 of 1

Floating wood node?

PostPosted: Mon Jul 06, 2015 14:20
by petra2201
Any suggestions to make a floating wood node? Like if you threw a piece of wood on some water what would I need to do to make a subtype of wood that would always stay on the top of water. Like if the water level rose or fell it would follow the top of the water.

Re: Floating wood node?

PostPosted: Mon Jul 06, 2015 19:33
by ABJ
You mean like how we throw? Drop or place?

Re: Floating wood node?

PostPosted: Mon Jul 06, 2015 19:44
by Calinou
You can use WorldEdit to place floating nodes.

  • Enable all WorldEdit mods (except GUI, you don't need it).
  • Type //1 then //2 while staying at the same location.
  • Type //set default:wood.

Re: Floating wood node?

PostPosted: Mon Jul 06, 2015 19:48
by petra2201
What I was thinking was making a new type of wood that you could place on water and if the water level rose, the wood node would always stay on top of the water. Like the way the boat behaves.

Re: Floating wood node?

PostPosted: Mon Jul 06, 2015 21:47
by petra2201
This is it what I had in mind but I'm hoping to expand it to a node type and not just an object.
viewtopic.php?f=9&t=12442&hilit=float+on+water

Re: Floating wood node?

PostPosted: Mon Jul 06, 2015 23:46
by kaeza
You could simply take the "floating" code from the boats mod, and replace the boat model with whatever you want (a full block, some kind of log, etc).

Re: Floating wood node?

PostPosted: Tue Jul 07, 2015 00:10
by petra2201
Will is be all lua code?

Re: Floating wood node?

PostPosted: Tue Jul 07, 2015 00:13
by kaeza

Re: Floating wood node?

PostPosted: Tue Jul 07, 2015 01:19
by petra2201
Cool, ill compare that with the floaty mod I linked to above and see if I can copy it to a wood node.

Re: Floating wood node?

PostPosted: Tue Jul 07, 2015 14:15
by Evergreen
You could probably make a "floating" wood node that always moves up to the surface when under water. (and make it move any non water nodes above it upwards as well)

Re: Floating wood node?

PostPosted: Tue Jul 07, 2015 18:09
by ABJ
That would be funny.
/me floods MrGr8Builder's water bungalow.
:p

EDIT: Easy fountain in teh middle of teh ocean.

Re: Floating wood node?

PostPosted: Tue Jul 07, 2015 18:20
by petra2201
Well it would let us build huge floating ships that we could build stuff inside of. That's what I'm aiming towards.

Re: Floating wood node?

PostPosted: Tue Jul 07, 2015 19:06
by petra2201
I teased this out of the float mod, It uses a lua entity, that makes me think I can't apply it to a single node the way I'm thinking. In Minetest when we place two blocks beside each other they are seen as separate entities and unless we mark them as one entity they would all behave and float differently (I think). If you made a large wooden boat wouldn't it fall apart if the front hit water that was flowing in a different direction? Here's the code in case I'm wrong.

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
--make it float
   if minetest.get_item_group(node.name, "water") ~= 0 and y == 0 then
      if object:get_luaentity().in_water == false then
         --do sounds and particles for water bounces
         if velocity.y < 0 and velocity.y > -3 then
            minetest.sound_play("soft_splash", {
               pos = {object:getpos()},
               max_hear_distance = 20,
               gain = 0.01,
            })
            minetest.add_particlespawner({
               amount = 10,
               time = 1,
               minpos = {x=realpos.x-1, y=realpos.y, z=realpos.z-1},
               maxpos = {x=realpos.x+1, y=realpos.y, z=realpos.z+1},
               minvel = {x=0, y=0, z=0},
               maxvel = {x=0, y=0, z=0},
               minacc = {x=0, y=0, z=0},
               maxacc = {x=0, y=1, z=0},
               minexptime = 1,
               maxexptime = 1,
               minsize = 1,
               maxsize = 1,
               collisiondetection = false,
               vertical = false,
               texture = "bubble.png",
            })


         elseif velocity.y <= -3 and velocity.y > -10 then
            minetest.sound_play("medium_splash", {
               pos = {object:getpos()},
               max_hear_distance = 20,
               gain = 0.05,
            })
            minetest.add_particlespawner({
               amount = 15,
               time = 1,
               minpos = {x=realpos.x-1, y=realpos.y, z=realpos.z-1},
               maxpos = {x=realpos.x+1, y=realpos.y, z=realpos.z+1},
               minvel = {x=0, y=0, z=0},
               maxvel = {x=0, y=0, z=0},
               minacc = {x=0, y=0, z=0},
               maxacc = {x=0, y=2, z=0},
               minexptime = 1,
               maxexptime = 1,
               minsize = 1,
               maxsize = 1,
               collisiondetection = false,
               vertical = false,
               texture = "bubble.png",
            })

         elseif velocity.y <= -10 then
            minetest.sound_play("big_splash", {
               pos = {object:getpos()},
               max_hear_distance = 20,
               gain = 0.07,
            })
            minetest.add_particlespawner({
               amount = 20,
               time = 0.5,
               minpos = {x=realpos.x-1, y=realpos.y, z=realpos.z-1},
               maxpos = {x=realpos.x+1, y=realpos.y, z=realpos.z+1},
               minvel = {x=0, y=0, z=0},
               maxvel = {x=0, y=0, z=0},
               minacc = {x=0, y=0, z=0},
               maxacc = {x=0, y=3, z=0},
               minexptime = 1,
               maxexptime = 1,
               minsize = 1,
               maxsize = 1,
               collisiondetection = false,
               vertical = false,
               texture = "bubble.png",
            })
         
         end
      end
      object:get_luaentity().in_water = true
      object:setacceleration({x=x,y=4,z=z})
      --slow down boats that fall into water smoothly
      if velocity.y < 0 then
         object:setacceleration({x=x,y=10,z=z})
      end
   end

Re: Floating wood node?

PostPosted: Sun Jul 12, 2015 15:01
by ABJ
Boat?
Ohhhhhh this is getting interesting.
I actually at first thought this was actually rather dumb.

Re: Floating wood node?

PostPosted: Thu Jan 19, 2017 23:15
by texmex
Also looking for this. Perhaps a simpler version that checks for water above a new type of buoyant block, and rises it until water is not above it anymore. I can't program but I've seen the mechanic in other mods such as vines and also the builtin falling.lua feature.

Re: Floating wood node?

PostPosted: Wed Feb 08, 2017 14:04
by Fred Brighton
I have just recently gotten on board MineTest. I am 67 years old, retired drafting tech and ex-Norse recreationist, used to making things like armor, chainmail, kilns etc as I love to duplicate old tech. Years ago I built a clinker-built boat in the style of the Norse karfi... basically a small version of the dragon ship. I loved that thing and now that I have moved out of the desert to upstate NY I have lots of lakes and rivers which would have been great for building a bigger one. But I am now disabled with broken back parts and fibronyalgia. So it is I decided that building a dragonship in Minetest would be a fine project. I do a lot of time on the raft exploring my worlds in single player mode... I love the design and build aspects but have no interest in combat, engagement, monsters etc. I use it as a clunky CADD program. I am also a sculptor in ceramics/stone/wood/metals and want to be able to sculpt the wood in such a way as to create credible dragon heads for the prow of the boat, given the chunky nature of the blocks. So, with floating wood knitted together to form ship sides and sculpted heads/tails, we should be able to produce a decent ship.

Re: Floating wood node?

PostPosted: Wed Feb 08, 2017 14:42
by ABJ
Sculpting blocks? Not needed. You've got a 20 by 20 by 20 mile world - why not just build the ship on a gigantic scale?

Re: Floating wood node?

PostPosted: Wed Feb 08, 2017 17:40
by twoelk
in the "moving attached nodes" section of Vehicle Mods we list:
some of these should contain some ideas how to code a collection of attached nodes on water.
The biggest problem would probably be how to handle displacing water nodes.
When you would build some thing bigger that actually swims in the water and not only floats right on top, you would want to replace the water nodes that are under the waterline with nodes of your structure so that you might indeed be able to venture under deck. Once you move your structure the nodes behind you will of course have to turn to water again. So how will you manage that when your ship makes a nice smooth turn with all them in between angles? Sounds like some heavy calculating to me, at least for a voxel based game.

Re: Floating wood node?

PostPosted: Wed Feb 08, 2017 18:42
by petra2201
Based on the behavior of water I've seen before I'd think that the water would take care of itself. We'd have to use an abm to remove the water. The original mod I linked to the node just always positioned itself on the top of the water. Now that I think about it it would only work to make a flat bottom boat.

Re: Floating wood node?

PostPosted: Thu Feb 09, 2017 08:45
by ABJ
turning the ship would cause holes in the floor.

Re: Floating wood node?

PostPosted: Thu Feb 09, 2017 15:40
by petra2201
So we'd need deeper oceans and maybe an if block for collision detection with not water nodes?

Re: Floating wood node?

PostPosted: Fri Feb 10, 2017 22:00
by Wuzzy
Are you looking for something like walkable lily pads from MineClone 2?

For coders who are interested, here is the relevant code section:
http://repo.or.cz/MineClone/MineClone2. ... t.lua#l279

I'm pretty sure this can be turned to floating wooden planks or whatever with little modifications.

Re: Floating wood node?

PostPosted: Fri Mar 03, 2017 14:48
by texmex
texmex wrote:Also looking for this. Perhaps a simpler version that checks for water above a new type of buoyant block, and rises it until water is not above it anymore. I can't program but I've seen the mechanic in other mods such as vines and also the builtin falling.lua feature.

This now exists in the pontoons mod, but the whole featureset is not finished yet.

Re: Floating wood node?

PostPosted: Sun Mar 05, 2017 20:44
by Sergey
Floating wood node?

Sorry for off-topic, but "wood node" reminded me Mr. Woodnote and this.

https://www.youtube.com/watch?v=WhBoR_tgXCI

Mr. Woodnote with saxophone