Walking in water sound converter

User avatar
TumeniNodes
Member
 
Posts: 2119
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Walking in water sound converter

by TumeniNodes » Thu Jun 15, 2017 22:50

Perhaps I should have posted this here, rather than in general discussion?

I am trying to fix the annoying, walking in water issue... (if sand is underwater, walking in water gives sand sounds, etc)

I read a little last night on abms but as I have stated in the past, unfortunately I have great difficulty retaining information I read... and then end up confusing myself from frustration...

So, while it would be ideal (in my mind) to have someone who is fluent with coding, to whip up some quick code to test this... I am trying to see if I can do it myself.
It is very embarrassing for me to have this learning curve : /

I know what I want to do..., which is to set nodes which are under a water node, to switch to using the default.node_sound_water_defaults

I think I have the first step ok? (probably not)
but I also know that I have to create a situation where the nodes below water are being checked?

I need help please..., I feel like a complete idiot if things get beyond copy & paste for the most part : /
It's frustrating personally, and it sucks
I am not even sure if abm can be used to substitute the audio of a node only?

Code: Select all
--
-- Convert default sounds for nodes under water
--

minetest.register_abm({
   nodenames = {"default:water_source"},
   neighbors = {
      "group:grass",
      "group:dry_grass",
      "default:sand",
        "default:dirt",
        "group:stone",
   },
   interval = 1,
   chance = 100,
   catch_up = false,
   action = function(sounds)
      minetest.set_node(sounds, {name = "default:water_source"})
         return
      end,
})
 

User avatar
TumeniNodes
Member
 
Posts: 2119
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: Walking in water sound converter

by TumeniNodes » Thu Jun 15, 2017 23:58

my newest blunder :P
Code: Select all
--
-- Convert default sounds for nodes under water
--

minetest.register_abm({
   nodenames = {"default:water_source"},
   neighbors = {
      "group:grass",
      "group:dry_grass",
      "default:sand",
        "default:dirt",
   },
   interval = 1,
   chance = 100,
   catch_up = false,
   action = function ()default.node_sound_water_defaults(table)
   table = table or {}
   table.footstep = table.footstep or
         {name = "default_water_footstep", gain = 0.2}
   default.node_sound_defaults(table)
   return table
      end,
})
 

User avatar
TumeniNodes
Member
 
Posts: 2119
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: Walking in water sound converter

by TumeniNodes » Sun Jun 18, 2017 18:31

How do I make water nodes check for other node types under?

I am missing some ifs and thens... :P
 

User avatar
TumeniNodes
Member
 
Posts: 2119
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
 

User avatar
Nathan.S
Member
 
Posts: 749
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Walking in water sound converter

by Nathan.S » Tue Jun 20, 2017 12:24

I think the abm may need to be on the dirt and sand while checking for water nearby. Right now it looks like the abm is changing the sound of the water.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
TumeniNodes
Member
 
Posts: 2119
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: Walking in water sound converter

by TumeniNodes » Tue Jun 20, 2017 12:38

The abm isn't doing anything right now actually :P
I was unsure which would be more efficient..., water looking for nodes below, or nodes below looking for water above...,
I think the first choice as so many various types of nodes can show up under water, especially if placed by the user.

juhdanad feels this might be better done on the c++ side so, I will wait to see what he comes up with.

I am unsure how well that will go over as a pr though...
I might poke at it a bit more as an abm later in the week, then the two resulting solutions can be tested to see which is best.
 

paramat
Developer
 
Posts: 2918
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: Walking in water sound converter

by paramat » Wed Jun 21, 2017 22:24

Should be done in the engine, and we have considered this, maybe open an issue?
 

User avatar
TumeniNodes
Member
 
Posts: 2119
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
 

User avatar
TumeniNodes
Member
 
Posts: 2119
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: Walking in water sound converter

by TumeniNodes » Thu Jun 22, 2017 16:44

paramat,
I forgot to mention, juhdanad mentioned he will try to implement this in the engine as time permits so, will wait to see what he comes up with.
It would be nice to see in the bugfix release
 

User avatar
azekill_DIABLO
Member
 
Posts: 6293
Joined: Wed Oct 29, 2014 20:05
Location: Pixelator
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: Walking in water sound converter

by azekill_DIABLO » Fri Jun 23, 2017 13:36

i think abms are not the way to solve this... but i don't have better solutions...
 

User avatar
xeranas
Member
 
Posts: 136
Joined: Fri Feb 05, 2016 11:06
GitHub: xeranas

Re: Walking in water sound converter

by xeranas » Sat Jun 24, 2017 06:46

TumeniNodes wrote:I was unsure which would be more efficient..., water looking for nodes below, or nodes below looking for water above...,
I think the first choice as so many various types of nodes can show up under water, especially if placed by the user.

Agree with paramat, should be in engine.
As for ABM general rule is target as less frequent node as posible. Current grass transforming ABM is quite simple as it target grass nodes only. Normally underwater could be any kind of nodes and your conveter would have potential risk break existing world nodes if you try switch with modified sounds version. Than again your converter would need not only add water sounds but remove them as well (in case water was removed). From my point of view ABM in this situation is no go.
 

User avatar
TumeniNodes
Member
 
Posts: 2119
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: Walking in water sound converter

by TumeniNodes » Sat Jun 24, 2017 13:55

xeranas wrote:Agree with paramat, should be in engine.
As for ABM general rule is target as less frequent node as posible. Current grass transforming ABM is quite simple as it target grass nodes only. Normally underwater could be any kind of nodes and your conveter would have potential risk break existing world nodes if you try switch with modified sounds version. Than again your converter would need not only add water sounds but remove them as well (in case water was removed). From my point of view ABM in this situation is no go.


Yes, as I have looked more into it, after speaking with juhdanad the abm idea went South.
Coding this into the engine makes perfect sense. There are too many ifs.
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 3 guests