1 --first we join the necessary channels so the mod can "listen" to what the server says
2 weather = minetest.mod_channel_join("weather_nodes")
3 weather_type = minetest.mod_channel_join("weather_type")
4 running_send = minetest.mod_channel_join("running_send")
5 player_movement_state = minetest.mod_channel_join("player.player_movement_state")
8 --we load everything seperately because it's easier to work on individual files than have everything jammed into one file
9 --not into seperate mods because that is unnecessary and cumbersome
10 local path = minetest.get_modpath("crafter_client")
11 dofile(path.."/player_input.lua")
12 dofile(path.."/weather_handling.lua")
15 local in_water = false
16 local old_in_water = false
17 minetest.register_globalstep(function(dtime)
18 if not minetest.localplayer then
22 local vel = minetest.localplayer:get_velocity().y
23 local pos = minetest.localplayer:get_pos()
25 local node = minetest.get_node_or_nil(pos)
27 local name = node.name
28 if name == "main:water" or name == "main:water_flowing" then
30 if in_water == true and old_in_water == false and vel < 0 then
31 minetest.sound_play("splash", {gain = 0.4, pitch = math.random(80,100)/100, gain = 0.05})
39 old_in_water = in_water