12
README.md
@ -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
|
||||
|
2
init.lua
@ -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)
|
||||
|
||||
|
BIN
sounds/ccompass_calibrate.ogg
Normal file
Before Width: | Height: | Size: 485 B After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 492 B After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 499 B After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 499 B After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 490 B After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 487 B After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 499 B After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 492 B After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 484 B After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 492 B After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 495 B After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 487 B After Width: | Height: | Size: 15 KiB |