mirror of
https://codeberg.org/AntumLuanti/mod-cleaner.git
synced 2025-03-21 15:41:22 +00:00
Use sounds mod for playing sounds
This commit is contained in:
parent
0098ef5da4
commit
45e59dbf8b
9 changed files with 16 additions and 7 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -1,2 +1 @@
|
||||||
.* export-ignore
|
.* export-ignore
|
||||||
sounds_src/ export-ignore
|
|
||||||
|
|
|
@ -10,9 +10,6 @@ A [Minetest][] mod that can be used to remove/replace unknown entities, nodes, &
|
||||||
|
|
||||||
- Code: [MIT](LICENSE.txt)
|
- Code: [MIT](LICENSE.txt)
|
||||||
- Textures: CC0
|
- Textures: CC0
|
||||||
- Sounds:
|
|
||||||
- cleaner_pencil_write: [CC0](https://freesound.org/people/NachtmahrTV/sounds/571800/)
|
|
||||||
- cleaner_pencil_erase: [CC0](https://freesound.org/people/damsur/sounds/443241/)
|
|
||||||
|
|
||||||
### Requirements:
|
### Requirements:
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
|
||||||
|
next
|
||||||
|
----
|
||||||
|
- use sounds mod for sounds
|
||||||
|
|
||||||
|
|
||||||
v1.2
|
v1.2
|
||||||
----
|
----
|
||||||
- added API
|
- added API
|
||||||
|
|
|
@ -151,6 +151,7 @@ local tool = {
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local use_sounds = core.global_exists("sounds")
|
||||||
local sound_handle
|
local sound_handle
|
||||||
|
|
||||||
tool.on_use = function(stack, user, pointed_thing)
|
tool.on_use = function(stack, user, pointed_thing)
|
||||||
|
@ -175,17 +176,23 @@ tool.on_use = function(stack, user, pointed_thing)
|
||||||
|
|
||||||
if mode == "erase" then
|
if mode == "erase" then
|
||||||
core.remove_node(npos)
|
core.remove_node(npos)
|
||||||
sound_handle = core.sound_play("cleaner_pencil_erase", {object=user})
|
if use_sounds then
|
||||||
|
local sound_handle = sounds.pencil_erase({object=user})
|
||||||
|
end
|
||||||
return stack
|
return stack
|
||||||
elseif core.registered_nodes[new_node_name] then
|
elseif core.registered_nodes[new_node_name] then
|
||||||
if mode == "swap" then
|
if mode == "swap" then
|
||||||
core.swap_node(npos, {name=new_node_name})
|
core.swap_node(npos, {name=new_node_name})
|
||||||
sound_handle = core.sound_play("cleaner_pencil_write", {object=user})
|
if use_sounds then
|
||||||
|
local sound_handle = sounds.pencil_write({object=user})
|
||||||
|
end
|
||||||
elseif mode == "write" then
|
elseif mode == "write" then
|
||||||
local node_above = core.get_node_or_nil(pointed_thing.above)
|
local node_above = core.get_node_or_nil(pointed_thing.above)
|
||||||
if not node_above or node_above.name == "air" then
|
if not node_above or node_above.name == "air" then
|
||||||
core.set_node(pointed_thing.above, {name=new_node_name})
|
core.set_node(pointed_thing.above, {name=new_node_name})
|
||||||
sound_handle = core.sound_play("cleaner_pencil_write", {object=user})
|
if use_sounds then
|
||||||
|
local sound_handle = sounds.pencil_write({object=user})
|
||||||
|
end
|
||||||
else
|
else
|
||||||
core.chat_send_player(pname, S("Can't place node there."))
|
core.chat_send_player(pname, S("Can't place node there."))
|
||||||
end
|
end
|
||||||
|
|
1
mod.conf
1
mod.conf
|
@ -4,3 +4,4 @@ version = 1.2
|
||||||
license = MIT
|
license = MIT
|
||||||
author = PilzAdam, Jordan Irwin (AntumDeluge)
|
author = PilzAdam, Jordan Irwin (AntumDeluge)
|
||||||
min_minetest_version = 5.0
|
min_minetest_version = 5.0
|
||||||
|
optional_depends = sounds
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue