mirror of
https://github.com/minetest-mods/throwing.git
synced 2025-01-08 01:00:28 +01:00
Ensure Minetest 5.7.0 compatibility
The enforced type checking in Minetest revealed this incorrect API use.
This commit is contained in:
parent
31f0cf5f86
commit
dfc724fa06
8
init.lua
8
init.lua
@ -380,6 +380,10 @@ function throwing.register_bow(name, def)
|
||||
def.strength = 20
|
||||
end
|
||||
|
||||
local throw_sound = def.sound
|
||||
-- Reserved field by Minetest. Prevent leaking irrelevant data to the registration API
|
||||
def.sound = nil
|
||||
|
||||
def.on_use = function(itemstack, user, pointed_thing)
|
||||
-- Cooldown
|
||||
local meta = itemstack:get_meta()
|
||||
@ -398,8 +402,8 @@ function throwing.register_bow(name, def)
|
||||
end
|
||||
|
||||
-- Sound
|
||||
if def.sound then
|
||||
minetest.sound_play(def.sound, {to_player=user:get_player_name()})
|
||||
if throw_sound then
|
||||
minetest.sound_play(throw_sound, {to_player=user:get_player_name()})
|
||||
end
|
||||
|
||||
meta:set_int("delay", os.time() + (def.delay or 0))
|
||||
|
Loading…
Reference in New Issue
Block a user