[mod] Sneak Sounds [sneak]

User avatar
jas
Member
 
Posts: 216
Joined: Mon Jul 24, 2017 18:15
GitHub: jastevenson303
IRC: jas_
In-game: jas

[mod] Sneak Sounds [sneak]

by jas » Wed Jan 24, 2018 09:09

License: LGPL 2.1+

This mod cancels any footstep sounds the player makes while sneaking. I don't know if it works for two players, however.

https://github.com/jastevenson303/sneak

Code: Select all
sneak = {}

minetest.register_on_joinplayer(function(player)
   local name = player:get_player_name()
   sneak[name] = false
end)

minetest.register_on_leaveplayer(function(player)
   local name = player:get_player_name()
   sneak[name] = nil
end)

minetest.register_globalstep(function(dtime)
   for _, player in ipairs(minetest.get_connected_players()) do
      local control = player:get_player_control()
      local name = player:get_player_name()
      if control.sneak ~= sneak[name] then
         local c = control.sneak
         if c then
            player:set_properties{makes_footstep_sound = false}
         else
            player:set_properties{makes_footstep_sound = true}
         end
         sneak[name] = c
      end
   end
end)


Related GitHub tracker issue (comment): https://github.com/minetest/minetest/is ... -359946198
Attachments
sneak-master (1).zip
(9.85 KiB) Downloaded 6 times
Last edited by jas on Thu Apr 19, 2018 12:09, edited 1 time in total.
 

User avatar
jas
Member
 
Posts: 216
Joined: Mon Jul 24, 2017 18:15
GitHub: jastevenson303
IRC: jas_
In-game: jas

Re: [mod] Sneak Sounds [sneak]

by jas » Thu Apr 19, 2018 12:08

The GitHub repo for this mod has been deleted, but the code remains. This feature has been incorporated into the sneak_jump mod: viewtopic.php?f=9&t=19861
 


Return to WIP Mods



Who is online

Users browsing this forum: Jordach, sorcerykid and 4 guests