Walking in water sound converter

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

Walking in water sound converter

by TumeniNodes » Post

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,
})
A Wonderful World

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

Re: Walking in water sound converter

by TumeniNodes » Post

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,
})
A Wonderful World

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

Re: Walking in water sound converter

by TumeniNodes » Post

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

I am missing some ifs and thens... :P
A Wonderful World

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

Re: Walking in water sound converter

by TumeniNodes » Post

no takers eh?
A Wonderful World

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

Re: Walking in water sound converter

by Nathan.S » Post

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, and brand new Minetest Modding Course

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

Re: Walking in water sound converter

by TumeniNodes » Post

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.
A Wonderful World

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

Re: Walking in water sound converter

by paramat » Post

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

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

Re: Walking in water sound converter

by TumeniNodes » Post

ok.
sorry for two diff posts on this
A Wonderful World

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

Re: Walking in water sound converter

by TumeniNodes » Post

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
A Wonderful World

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

Re: Walking in water sound converter

by azekill_DIABLO » Post

i think abms are not the way to solve this... but i don't have better solutions...
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

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

Re: Walking in water sound converter

by xeranas » Post

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: 2943
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Walking in water sound converter

by TumeniNodes » Post

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.
A Wonderful World

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 5 guests