Add lockpick sounds

This commit is contained in:
Wuzzy 2019-09-21 19:18:39 +02:00
parent 927427d663
commit 150c0a5627
6 changed files with 9 additions and 2 deletions

View File

@ -8,5 +8,7 @@ Media file license: CC BY-SA 4.0
Source code license: LGPLv2.1
Sound credits:
* locks_unlock.ogg: qubodup
* locks_unlock.ogg: qubodup (CC0)
Source: <https://freesound.org/people/qubodup/sounds/160215/>
* locks_pick.1.ogg to locks_pick.4.ogg: SpaceJoe (CC0)
Source: <https://freesound.org/people/SpaceJoe/sounds/342621/>

View File

@ -73,7 +73,9 @@ minetest.register_tool(
if minetest.get_item_group(node.name, "locked") == 0 then
return itemstack
end
-- Attempt to pick lock
if math.random(1, 5) <= 1 then
-- Success!
local meta = minetest.get_meta(pos)
meta:set_float("last_lock_pick", minetest.get_gametime() + picked_time)
@ -100,7 +102,10 @@ minetest.register_tool(
burglar,
minetest.colorize("#0f0", S("You have broken the lock!")))
end
minetest.sound_play({name="locks_unlock",gain=0.5},{pos=pos, max_hear_distance=8})
minetest.sound_play({name="locks_unlock",gain=0.8},{pos=pos, max_hear_distance=16})
else
-- Failure!
minetest.sound_play({name="locks_pick",gain=0.5},{pos=pos, max_hear_distance=16})
end
if not minetest.settings:get_bool("creative_mode") then

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.