Time Nick Message 14:36 Bombo hi, i need some help, i'm trying to make my own node/mod: i followed https://rubenwardy.com/minetest_modding_book/en/basics/getting_started.html i get an item now anc can place it 14:37 Bombo i got a sound file in sounds/test_testi.ogg, so i want to play that when the node is placed: sounds = minetest.sound_play("testi"), but that gives me an error 14:38 Bombo 'table expected, got number' 14:38 Bombo this is in minetest.register_node("test:testi", { ... 14:43 sfan5 sound_play is for interactive use in callbacks, to define a node sound there is a different table format 14:56 Bombo ok hm, now i tried sounds = {name = "testi", gain = 0.9, pitch = 1.1}, i get no errors, but no sound too 14:57 sfan5 should be "test_testi" 15:00 Bombo hm nothing 15:00 Bombo sounds/test_testi.ogg: Ogg data, Vorbis audio, mono, 48000 Hz, ~96000 bps, created by: Xiph.Org libVorbis I 15:01 Bombo maybe 44k1 instead of 48k? 15:02 sfan5 which error do you get? 15:03 Bombo none, just silence 15:03 Bombo when placing the node 15:03 sfan5 ah you missed another thing 15:04 sfan5 sounds = { place = { .. } } 15:05 Bombo oh now it works ;) 15:05 Bombo thx 15:07 Bombo what other options are there besides place? i don't see this in https://minetest.gitlab.io/minetest/sounds/ 15:07 Bombo table format 15:11 sfan5 https://minetest.gitlab.io/minetest/definition-tables/#node-definition 15:11 sfan5 under sounds = 15:12 Bombo found it at https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L7794 15:12 MTDiscord There is a pr to increase the documentation on sound options 15:12 Bombo heh 15:12 MTDiscord Not sure how accurate the pr is 15:25 Bombo on_rightclick means 'when item is right clicked with nothing in the hands' 15:26 Bombo right? 15:27 Bombo must be right, it crashes when i do this: on_rightclick = minetest.sound_play("test_testi"), 15:28 MTDiscord depends if your talking about a entity, item, etc 15:28 jonadab I think we're talking about a node in this context. 15:28 MTDiscord you need to wrap it in the function anyways 15:28 Bombo just an item, i just made my first node ;) 15:29 Bombo in what function? 15:29 sfan5 the line you pasted means: call sound_play when the mod loads (before any player joins), then take the return value and stuff it into the 'on_rightclick' field 15:29 sfan5 sounds wrong, doesn't it? 15:31 Bombo well yes 15:34 sfan5 what you want is this -> http://sprunge.us/LsWvTy?lua 15:35 sfan5 the difference is that you say "declare this function and put it into the 'on_rightclick' field", it then gets called by the engine at some point later 15:39 Bombo now that makes sense, thx for explaining :) 15:43 Bombo just one question why ', true' 15:46 sfan5 https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L5623-L5626 15:47 Bombo got it 15:47 sfan5 it's not super important, in fact it'll work without 15:47 sfan5 just good practice 15:49 Bombo i see 15:49 Bombo i got too many tabs open 16:14 Bombo shouldn't this play the sound if leftshift+rightclick at the same time? on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) if clicker:get_player_control().sneak == true then ... end end, 16:22 definitely_a Ah I see the issue on github, I missed the bushes textures, oh well. If I find any more bugs I'll register. 16:26 sfan5 Bombo: I think sneak+rightclick is a special case because that is supposed to allow you to place things regardless of on_rightclick 16:26 sfan5 (imagine placing a node against a chest which normally opens a form) 16:53 Bombo sfan5: ok it worked with .zoom ;)