adjust sound files naming, add sounds on place with pick engraved
parent
cf724ee381
commit
a416587a21
29
api.lua
29
api.lua
|
@ -131,7 +131,7 @@ function obsidianmese.fire_sword(itemstack, user, pointed_thing)
|
|||
end
|
||||
|
||||
-- play shoot attack sound
|
||||
minetest.sound_play("throwing_sound", {
|
||||
minetest.sound_play("obsidianmese_throwing", {
|
||||
pos = pos,
|
||||
gain = 1.0, -- default
|
||||
max_hear_distance = 10,
|
||||
|
@ -193,7 +193,7 @@ function obsidianmese.pick_engraved_place(itemstack, placer, pointed_thing)
|
|||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||
local pointed_node = minetest.get_node(pos)
|
||||
|
||||
-- check if have to use default on_place first
|
||||
-- check if we have to use default on_place first
|
||||
if pick_engraved_place_blacklist[pointed_node.name] ~= nil then
|
||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
||||
end
|
||||
|
@ -204,6 +204,7 @@ function obsidianmese.pick_engraved_place(itemstack, placer, pointed_thing)
|
|||
local stack_mod = stack_name_split[1]
|
||||
|
||||
udef = minetest.registered_nodes[stack_name]
|
||||
-- print(dump(udef))
|
||||
|
||||
-- not for farming - that should be part of a hoe
|
||||
if stack_mod ~= "farming" or stack_mod ~= "farming_addons" then
|
||||
|
@ -212,6 +213,14 @@ function obsidianmese.pick_engraved_place(itemstack, placer, pointed_thing)
|
|||
inv:set_stack("main", idx, temp_stack)
|
||||
|
||||
-- itemstack = obsidianmese.add_wear(itemstack)
|
||||
|
||||
-- play sound
|
||||
if udef.sounds then
|
||||
if udef.sounds.place then
|
||||
minetest.sound_play(udef.sounds.place)
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
elseif udef and udef.on_use then
|
||||
temp_stack = udef.on_use(stack, placer, pointed_thing) or stack
|
||||
|
@ -241,12 +250,28 @@ function obsidianmese.pick_engraved_place(itemstack, placer, pointed_thing)
|
|||
inv:set_stack("main", idx, temp_stack)
|
||||
|
||||
-- itemstack = obsidianmese.add_wear(itemstack)
|
||||
|
||||
-- play sound
|
||||
if udef and udef.sounds then
|
||||
if udef.sounds.place then
|
||||
minetest.sound_play(udef.sounds.place)
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
-- if everything else fails use default on_place
|
||||
stack = minetest.item_place(stack, placer, pointed_thing)
|
||||
inv:set_stack("main", idx, stack)
|
||||
|
||||
-- play sound
|
||||
if udef and udef.sounds then
|
||||
if udef.sounds.place then
|
||||
minetest.sound_play(udef.sounds.place)
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ minetest.register_craftitem("obsidianmese:mese_apple", {
|
|||
inventory_image = "obsidianmese_apple.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
minetest.sound_play("apple_eat", {
|
||||
minetest.sound_play("obsidianmese_apple_eat", {
|
||||
pos = user:getpos(),
|
||||
max_hear_distance = 32,
|
||||
gain = 0.5,
|
||||
|
|
Loading…
Reference in New Issue