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
|
end
|
||||||
|
|
||||||
-- play shoot attack sound
|
-- play shoot attack sound
|
||||||
minetest.sound_play("throwing_sound", {
|
minetest.sound_play("obsidianmese_throwing", {
|
||||||
pos = pos,
|
pos = pos,
|
||||||
gain = 1.0, -- default
|
gain = 1.0, -- default
|
||||||
max_hear_distance = 10,
|
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 pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||||
local pointed_node = minetest.get_node(pos)
|
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
|
if pick_engraved_place_blacklist[pointed_node.name] ~= nil then
|
||||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
return minetest.item_place(itemstack, placer, pointed_thing)
|
||||||
end
|
end
|
||||||
|
@ -204,6 +204,7 @@ function obsidianmese.pick_engraved_place(itemstack, placer, pointed_thing)
|
||||||
local stack_mod = stack_name_split[1]
|
local stack_mod = stack_name_split[1]
|
||||||
|
|
||||||
udef = minetest.registered_nodes[stack_name]
|
udef = minetest.registered_nodes[stack_name]
|
||||||
|
-- print(dump(udef))
|
||||||
|
|
||||||
-- not for farming - that should be part of a hoe
|
-- not for farming - that should be part of a hoe
|
||||||
if stack_mod ~= "farming" or stack_mod ~= "farming_addons" then
|
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)
|
inv:set_stack("main", idx, temp_stack)
|
||||||
|
|
||||||
-- itemstack = obsidianmese.add_wear(itemstack)
|
-- 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
|
return itemstack
|
||||||
elseif udef and udef.on_use then
|
elseif udef and udef.on_use then
|
||||||
temp_stack = udef.on_use(stack, placer, pointed_thing) or stack
|
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)
|
inv:set_stack("main", idx, temp_stack)
|
||||||
|
|
||||||
-- itemstack = obsidianmese.add_wear(itemstack)
|
-- 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
|
return itemstack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- if everything else fails use default on_place
|
-- if everything else fails use default on_place
|
||||||
stack = minetest.item_place(stack, placer, pointed_thing)
|
stack = minetest.item_place(stack, placer, pointed_thing)
|
||||||
inv:set_stack("main", idx, stack)
|
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
|
return itemstack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ minetest.register_craftitem("obsidianmese:mese_apple", {
|
||||||
inventory_image = "obsidianmese_apple.png",
|
inventory_image = "obsidianmese_apple.png",
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
|
||||||
minetest.sound_play("apple_eat", {
|
minetest.sound_play("obsidianmese_apple_eat", {
|
||||||
pos = user:getpos(),
|
pos = user:getpos(),
|
||||||
max_hear_distance = 32,
|
max_hear_distance = 32,
|
||||||
gain = 0.5,
|
gain = 0.5,
|
||||||
|
|
Loading…
Reference in New Issue