Calibration sound

This commit is contained in:
tacotexmex 2017-06-14 23:00:18 +02:00
parent 1d3a3fb191
commit 9c7f8565a4
3 changed files with 8 additions and 6 deletions

View File

@ -1,14 +1,14 @@
# ccompass
This minetest mod adds a calibratable compass to the minetest.
This minetest mod adds a calibratable compass to the minetest. Original mod [here](https://forum.minetest.net/viewtopic.php?f=11&t=3785)
- License - as the original mod (https://forum.minetest.net/viewtopic.php?f=11&t=3785): Code: WTFPL, textures: CC BY-SA
- License: Code: WTFPL, textures: CC BY-SA, sound: CC0.
- Dependencies to other mods: none
- Forum: https://forum.minetest.net/viewtopic.php?f=9&t=17881
## For Players:
<TODO: nice screenshot>
<TODO: nice screenshot>
1. Craft the compass as before using the crafting recipe.
The new compass points to the origin / Zero point and is already usable.
2. Punch the compass to a compatible node (all by default) and enter the target name
@ -51,7 +51,7 @@ The mod support the next settings:
4. Each time the compass is updated, a hook is called, if defined in other mod. The hook is usefull to implement wear or any other compass manipulation logic.
```
function ccompass.usage_hook(compass_stack, player)
function ccompass.usage_hook(compass_stack, player)
--do anything with compasS_stack
return modified_compass_stack
end

View File

@ -120,6 +120,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local stack=player:get_wielded_item()
local meta=stack:get_meta()
local pos_string = meta:get_string("tmp_target_pos")
local pos = player:getpos()
meta:set_string("target_pos", pos_string)
meta:set_string("tmp_target_pos", "")
if fields.name == "" then
@ -129,6 +130,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
player:set_wielded_item(stack)
minetest.chat_send_player(player:get_player_name(), "Calibration done to "..fields.name.." "..pos_string)
minetest.sound_play({ name = "ccompass_calibrate", gain = 1 }, { pos = pos, max_hear_distance = 3 })
end
end)

Binary file not shown.