Working positional sounds

This commit is contained in:
Lars 2022-02-11 12:41:08 -08:00
parent 683df80d85
commit ad59ab40e4
10 changed files with 29 additions and 168 deletions

@ -122,7 +122,7 @@ end
end end
minetest.sound_play("default_dig_cracky", {self.object:get_pos(), gain = 1.0}) minetest.sound_play("default_dig_cracky", {pos = self.object:get_pos(), gain = 1.0})
if ignite > 0 then if ignite > 0 then
@ -133,7 +133,7 @@ end
if minetest.get_node(moveresult.collisions[1].node_pos).name == "tnt:tnt" then if minetest.get_node(moveresult.collisions[1].node_pos).name == "tnt:tnt" then
minetest.swap_node(moveresult.collisions[1].node_pos, {name = "tnt:tnt_burning"}) minetest.swap_node(moveresult.collisions[1].node_pos, {name = "tnt:tnt_burning"})
minetest.sound_play("tnt_ignite", {moveresult.collisions[1].node_pos}, true) minetest.sound_play("tnt_ignite", {pos = moveresult.collisions[1].node_pos}, true)
minetest.get_node_timer(moveresult.collisions[1].node_pos):start(3) minetest.get_node_timer(moveresult.collisions[1].node_pos):start(3)
minetest.check_for_falling(moveresult.collisions[1].node_pos) minetest.check_for_falling(moveresult.collisions[1].node_pos)
end end
@ -146,7 +146,7 @@ if string.find(minetest.get_node(moveresult.collisions[1].node_pos).name,"door_w
minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"}) minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"})
minetest.add_item(moveresult.collisions[1].node_pos, "default:wood 5") minetest.add_item(moveresult.collisions[1].node_pos, "default:wood 5")
minetest.sound_play("rangedweapons_woodbreak",{moveresult.collisions[1].node_pos}) minetest.sound_play("rangedweapons_woodbreak",{pos = moveresult.collisions[1].node_pos})
end end end end
@ -156,18 +156,18 @@ local nodeName = minetest.get_node(moveresult.collisions[1].node_pos).name
if nodeName == "default:glass" then if nodeName == "default:glass" then
minetest.swap_node(moveresult.collisions[1].node_pos, {name = "rangedweapons:broken_glass"}) minetest.swap_node(moveresult.collisions[1].node_pos, {name = "rangedweapons:broken_glass"})
minetest.sound_play("glass_break",{moveresult.collisions[1].node_pos}) minetest.sound_play("glass_break",{pos = moveresult.collisions[1].node_pos})
end end
if nodeName == "xpanes:pane" or if nodeName == "xpanes:pane" or
nodeName == "xpanes:pane_flat" then nodeName == "xpanes:pane_flat" then
minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"}) minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"})
minetest.add_item(moveresult.collisions[1].node_pos, "rangedweapons:glass_shards") minetest.add_item(moveresult.collisions[1].node_pos, "rangedweapons:glass_shards")
minetest.sound_play("glass_break",{moveresult.collisions[1].node_pos}) minetest.sound_play("glass_break",{pos = moveresult.collisions[1].node_pos})
end end
if string.find(nodeName,"door_glass") then if string.find(nodeName,"door_glass") then
minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"}) minetest.swap_node(moveresult.collisions[1].node_pos, {name = "air"})
minetest.add_item(moveresult.collisions[1].node_pos, "vessels:glass_fragments 5") minetest.add_item(moveresult.collisions[1].node_pos, "vessels:glass_fragments 5")
minetest.sound_play("glass_break",{moveresult.collisions[1].node_pos}) minetest.sound_play("glass_break",{pos = moveresult.collisions[1].node_pos})
end end
end end
@ -215,7 +215,7 @@ if math.random(1,100) <= nodePen then
glow = 2, glow = 2,
}) })
end end
minetest.sound_play("default_dig_cracky", {self.object:get_pos(), gain = 1.0}) minetest.sound_play("default_dig_cracky", {pos = self.object:get_pos(), gain = 1.0})
self.object:set_properties({collisionbox = {0,0,0,0,0,0}}) self.object:set_properties({collisionbox = {0,0,0,0,0,0}})
--minetest.chat_send_all("hit") --minetest.chat_send_all("hit")
self.object:set_velocity(moveresult.collisions[1].old_velocity) self.object:set_velocity(moveresult.collisions[1].old_velocity)
@ -223,7 +223,7 @@ else
if minetest.get_item_group(minetest.get_node(moveresult.collisions[1].node_pos).name, "leaves") > 0 then if minetest.get_item_group(minetest.get_node(moveresult.collisions[1].node_pos).name, "leaves") > 0 then
minetest.sound_play("default_dig_snappy", {self.object:get_pos(), gain = 1.5}) minetest.sound_play("default_dig_snappy", {pos = self.object:get_pos(), gain = 1.5})
for i = 1,math.random(3,6) do for i = 1,math.random(3,6) do
minetest.add_particle({ minetest.add_particle({
@ -342,7 +342,7 @@ if math.random(1,100) <= mobPen then
glow = 2, glow = 2,
}) })
end end
minetest.sound_play("default_dig_cracky", {self.object:get_pos(), gain = 1.0}) minetest.sound_play("default_dig_cracky", {pos = self.object:get_pos(), gain = 1.0})
self.object:set_properties({collisionbox = {0,0,0,0,0,0}}) self.object:set_properties({collisionbox = {0,0,0,0,0,0}})
self.object:set_velocity(moveresult.collisions[1].old_velocity) self.object:set_velocity(moveresult.collisions[1].old_velocity)
else else

@ -8,8 +8,8 @@ minetest.register_tool("rangedweapons:awp_uld", {
groups = {not_in_creative_inventory = 1}, groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_awp.png", inventory_image = "rangedweapons_awp.png",
weapon_zoom = 7.5, weapon_zoom = 7.5,
on_use = function(user) on_use = function(itemstack, user)
minetest.sound_play("rangedweapons_empty", {user}) minetest.sound_play("rangedweapons_empty", {pos = user:get_pos()})
end, end,
on_secondary_use = function(itemstack, user, pointed_thing) on_secondary_use = function(itemstack, user, pointed_thing)
eject_shell(itemstack,user,"rangedweapons:awp_rld",1.0,"rangedweapons_rifle_reload_a","rangedweapons:empty_shell") eject_shell(itemstack,user,"rangedweapons:awp_rld",1.0,"rangedweapons_rifle_reload_a","rangedweapons:empty_shell")

@ -53,8 +53,8 @@ minetest.register_tool("rangedweapons:benelli_uld", {
description = "" ..core.colorize("#35cdff","benelli m3\n") ..core.colorize("#FFFFFF", "Ranged damage: 2\n") ..core.colorize("#FFFFFF", "projectiles: 5\n") ..core.colorize("#FFFFFF", "Gun gravity: 4\n") ..core.colorize("#FFFFFF", "Accuracy: 48%\n")..core.colorize("#FFFFFF", "knockback: 6\n") ..core.colorize("#FFFFFF", "Critical chance: 6%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.0x\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Pump delay: 0.6\n")..core.colorize("#FFFFFF", "Clip size: 7\n") ..core.colorize("#be0d00", "Right-click, to eject the empty shell!\n") ..core.colorize("#fff21c", "Right-click to load in a bullet!\n") ..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"), description = "" ..core.colorize("#35cdff","benelli m3\n") ..core.colorize("#FFFFFF", "Ranged damage: 2\n") ..core.colorize("#FFFFFF", "projectiles: 5\n") ..core.colorize("#FFFFFF", "Gun gravity: 4\n") ..core.colorize("#FFFFFF", "Accuracy: 48%\n")..core.colorize("#FFFFFF", "knockback: 6\n") ..core.colorize("#FFFFFF", "Critical chance: 6%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.0x\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Pump delay: 0.6\n")..core.colorize("#FFFFFF", "Clip size: 7\n") ..core.colorize("#be0d00", "Right-click, to eject the empty shell!\n") ..core.colorize("#fff21c", "Right-click to load in a bullet!\n") ..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 25"),
inventory_image = "rangedweapons_benelli.png", inventory_image = "rangedweapons_benelli.png",
groups = {not_in_creative_inventory = 1}, groups = {not_in_creative_inventory = 1},
on_use = function(user) on_use = function(itemstack, user)
minetest.sound_play("rangedweapons_empty", {user}) minetest.sound_play("rangedweapons_empty", {pos = user:get_pos()})
end, end,
on_secondary_use = function(itemstack, user, pointed_thing) on_secondary_use = function(itemstack, user, pointed_thing)
eject_shell(itemstack,user,"rangedweapons:benelli_rld",0.6,"rangedweapons_shotgun_reload_a","rangedweapons:empty_shell") eject_shell(itemstack,user,"rangedweapons:benelli_rld",0.6,"rangedweapons_shotgun_reload_a","rangedweapons:empty_shell")

@ -79,7 +79,7 @@ if player:get_wielded_item():get_definition().loaded_gun ~= nil then
local itemstack = player:get_wielded_item() local itemstack = player:get_wielded_item()
if player:get_wielded_item():get_definition().loaded_sound ~= nil then if player:get_wielded_item():get_definition().loaded_sound ~= nil then
minetest.sound_play(itemstack:get_definition().loaded_sound, {player}) minetest.sound_play(itemstack:get_definition().loaded_sound, {pos = player:get_pos()})
end end
itemstack:set_name(player:get_wielded_item():get_definition().loaded_gun) itemstack:set_name(player:get_wielded_item():get_definition().loaded_gun)
player:set_wielded_item(itemstack) player:set_wielded_item(itemstack)
@ -88,7 +88,7 @@ end
if player:get_wielded_item():get_definition().rw_next_reload ~= nil then if player:get_wielded_item():get_definition().rw_next_reload ~= nil then
local itemstack = player:get_wielded_item() local itemstack = player:get_wielded_item()
if itemstack:get_definition().load_sound ~= nil then if itemstack:get_definition().load_sound ~= nil then
minetest.sound_play(itemstack:get_definition().load_sound, {player}) minetest.sound_play(itemstack:get_definition().load_sound, {pos = player:get_pos()})
end end
gunMeta = itemstack:get_meta() gunMeta = itemstack:get_meta()
u_meta:set_float("rw_cooldown",gunMeta:get_float("RW_reload_delay")) u_meta:set_float("rw_cooldown",gunMeta:get_float("RW_reload_delay"))

@ -56,7 +56,7 @@ then
end end
gtimer = 0 gtimer = 0
minetest.sound_play("rangedweapons_reload_a", {user}) minetest.sound_play("rangedweapons_reload_a", {pos = user:get_pos()})
itemstack = "rangedweapons:hand_grenade_nopin" itemstack = "rangedweapons:hand_grenade_nopin"
local pos = user:get_pos() local pos = user:get_pos()
pos.y = pos.y + 1.5 pos.y = pos.y + 1.5

@ -23,7 +23,7 @@ minetest.register_node("rangedweapons:antigun_block", {
---- ----
make_sparks = function(pos) make_sparks = function(pos)
minetest.sound_play("rengedweapons_ricochet", {pos, gain = 0.75}) minetest.sound_play("rengedweapons_ricochet", {pos = pos, gain = 0.75})
for i=1,9 do for i=1,9 do
minetest.add_particle({ minetest.add_particle({
pos = pos, pos = pos,
@ -62,7 +62,7 @@ if GunCaps ~= nil then
gun_unload_sound = GunCaps.gun_unload_sound or "" gun_unload_sound = GunCaps.gun_unload_sound or ""
end end
minetest.sound_play(gun_unload_sound, {player}) minetest.sound_play(gun_unload_sound, {pos = player:get_pos()})
local gun_reload = 0.25 local gun_reload = 0.25
@ -169,7 +169,7 @@ if GunCaps ~= nil then
gun_unload_sound = GunCaps.gun_unload_sound or "" gun_unload_sound = GunCaps.gun_unload_sound or ""
end end
minetest.sound_play(gun_unload_sound, {player}) minetest.sound_play(gun_unload_sound, {pos = player:get_pos()})
local gun_reload = 0.25 local gun_reload = 0.25
@ -351,7 +351,7 @@ rangedweapons_shoot_gun = function(itemstack, player)
if minetest.find_node_near(player:getpos(), 10,"rangedweapons:antigun_block") if minetest.find_node_near(player:getpos(), 10,"rangedweapons:antigun_block")
then then
minetest.sound_play("rangedweapons_empty", {player}) minetest.sound_play("rangedweapons_empty", {pos = player:get_pos()})
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Guns are prohibited in this area!")) minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Guns are prohibited in this area!"))
else else
@ -546,7 +546,7 @@ rangedweapons_shoot_powergun = function(itemstack, player)
if minetest.find_node_near(player:getpos(), 10,"rangedweapons:antigun_block") if minetest.find_node_near(player:getpos(), 10,"rangedweapons:antigun_block")
then then
minetest.sound_play("rangedweapons_empty", {player}) minetest.sound_play("rangedweapons_empty", {pos = player:get_pos()})
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Guns are prohibited in this area!")) minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Guns are prohibited in this area!"))
else else
local power_cooldown = 0 local power_cooldown = 0
@ -661,7 +661,7 @@ rangedweapons_launch_projectile = function(player,projNum,projDmg,projEnt,visual
local svertical = player:get_look_vertical() local svertical = player:get_look_vertical()
if pos and dir and yaw then if pos and dir and yaw then
minetest.sound_play(shoot_sound, {player}) minetest.sound_play(shoot_sound, {pos = pos, max_hear_distance = 500})
pos.y = pos.y + 1.45 pos.y = pos.y + 1.45
if has_shell > 0 then if has_shell > 0 then
@ -739,8 +739,8 @@ local gunMeta = itemstack:get_meta()
local bulletStack = ItemStack({name = gunMeta:get_string("RW_ammo_name")}) local bulletStack = ItemStack({name = gunMeta:get_string("RW_ammo_name")})
minetest.sound_play(rldsound, {player})
local pos = player:get_pos() local pos = player:get_pos()
minetest.sound_play(rldsound, {pos = pos})
local dir = player:get_look_dir() local dir = player:get_look_dir()
local yaw = player:get_look_yaw() local yaw = player:get_look_yaw()
if pos and dir and yaw then if pos and dir and yaw then

@ -1,139 +0,0 @@
minetest.register_craftitem("rangedweapons:thrown_javelin", {
wield_scale = {x=2.0,y=2.0,z=1.0},
inventory_image = "rangedweapons_thrown_javelin.png",
})
minetest.register_craftitem("rangedweapons:javelin", {
description = "" ..core.colorize("#35cdff","Javelin\n") ..core.colorize("#FFFFFF", "Mele damage: 9\n") ..core.colorize("#FFFFFF", "Mele range: 5\n")..core.colorize("#FFFFFF", "Full punch interval: 1.25\n") ..core.colorize("#FFFFFF", "Ranged damage: 4-16\n") ..core.colorize("#FFFFFF", "Accuracy: 100%\n") ..core.colorize("#FFFFFF", "Mob knockback: 10\n") ..core.colorize("#FFFFFF", "Critical chance: 15%\n") ..core.colorize("#FFFFFF", "Critical damage: 25-45\n") ..core.colorize("#FFFFFF", "javelin survival rate: 95%\n")..core.colorize("#FFFFFF", "Projectile gravity: 4\n") ..core.colorize("#FFFFFF", "Projectile velocity: 20\n")..core.colorize("#ffc000", "Right-click to throw, Left-click to stab") ,
wield_scale = {x=2.0,y=2.0,z=1.0},
range = 5,
stack_max= 10,
inventory_image = "rangedweapons_javelin.png",
on_secondary_use = function(itemstack, user, pointed_thing)
if not minetest.setting_getbool("creative_mode") then itemstack:take_item()
end
if pointed_thing.type ~= "nothing" then
local pointed = minetest.get_pointed_thing_position(pointed_thing)
if vector.distance(user:getpos(), pointed) < 8 then
return itemstack
end
end
local pos = user:getpos()
local dir = user:get_look_dir()
local yaw = user:get_look_yaw()
if pos and dir then
pos.y = pos.y + 1.5
local obj = minetest.add_entity(pos, "rangedweapons:javelin")
if obj then
minetest.sound_play("rangedweapons_throw", {object=obj})
obj:setvelocity({x=dir.x * 20, y=dir.y * 20, z=dir.z * 20})
obj:setacceleration({x=dir.x * -1, y=-4, z=dir.z * -1})
obj:setyaw(yaw + math.pi)
local ent = obj:get_luaentity()
if ent then
ent.player = ent.player or user
end
end
end
return itemstack
end,
tool_capabilities = {
full_punch_interval = 1.25,
max_drop_level = 0,
groupcaps = {
stabby = {times={[1]=0.25, [2]=0.50, [3]=0.75}, uses=0, maxlevel=1},
},
damage_groups = {fleshy=9,knockback=10},
}
})
local rangedweapons_javelin = {
physical = false,
timer = 0,
visual = "wielditem",
visual_size = {x=0.5, y=0.5,},
textures = {"rangedweapons:thrown_javelin"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_javelin.on_step = function(self, dtime)
self.timer = self.timer + dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.15 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "rangedweapons:javelin" and obj:get_luaentity().name ~= "__builtin:item" then
if math.random(1, 100) <= 15 then
local damage = math.random(25,45)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage, knockback=20},
}, nil)
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
self.object:remove()
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
minetest.add_item(self.lastpos, "rangedweapons:javelin")
end
else
local damage = math.random(4,16)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage, knockback=10},
}, nil)
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
minetest.add_item(self.lastpos, "rangedweapons:javelin")
end
end
end
else
if math.random(1, 100) <= 15 then
local damage = math.random(25,45)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
self.object:remove()
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
minetest.add_item(self.lastpos, "rangedweapons:javelin")
end
else
local damage = math.random(4,16)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
minetest.add_item(self.lastpos, "rangedweapons:javelin")
end
end
end
end
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
if not minetest.setting_getbool("creative_mode") and math.random(1, 100) <= 95 then
minetest.add_item(self.lastpos, "rangedweapons:javelin")
end
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("rangedweapons:javelin", rangedweapons_javelin)

@ -8,8 +8,8 @@ minetest.register_tool("rangedweapons:m200_uld", {
groups = {not_in_creative_inventory = 1}, groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_m200.png", inventory_image = "rangedweapons_m200.png",
weapon_zoom = 7.5, weapon_zoom = 7.5,
on_use = function(user) on_use = function(itemstack, user)
minetest.sound_play("rangedweapons_empty", {user}) minetest.sound_play("rangedweapons_empty", {pos = user:get_pos()})
end, end,
on_secondary_use = function(itemstack, user, pointed_thing) on_secondary_use = function(itemstack, user, pointed_thing)
eject_shell(itemstack,user,"rangedweapons:m200_rld",1.0,"rangedweapons_rifle_reload_a","rangedweapons:empty_shell") eject_shell(itemstack,user,"rangedweapons:m200_rld",1.0,"rangedweapons_rifle_reload_a","rangedweapons:empty_shell")

@ -53,8 +53,8 @@ minetest.register_tool("rangedweapons:spas12_uld", {
description = "" ..core.colorize("#35cdff","spas-12\n") ..core.colorize("#FFFFFF", "Ranged damage: 2\n") ..core.colorize("#FFFFFF", "projectiles: 6\n") ..core.colorize("#FFFFFF", "Gun gravity: 3\n") ..core.colorize("#FFFFFF", "Accuracy: 52%\n")..core.colorize("#FFFFFF", "knockback: 7\n") ..core.colorize("#FFFFFF", "Critical chance: 7%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.1x\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Pump delay: 0.45\n")..core.colorize("#FFFFFF", "Clip size: 8\n") ..core.colorize("#be0d00", "Right-click, to eject the empty shell!\n") ..core.colorize("#fff21c", "Right-click to load in a bullet!\n") ..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 28"), description = "" ..core.colorize("#35cdff","spas-12\n") ..core.colorize("#FFFFFF", "Ranged damage: 2\n") ..core.colorize("#FFFFFF", "projectiles: 6\n") ..core.colorize("#FFFFFF", "Gun gravity: 3\n") ..core.colorize("#FFFFFF", "Accuracy: 52%\n")..core.colorize("#FFFFFF", "knockback: 7\n") ..core.colorize("#FFFFFF", "Critical chance: 7%\n") ..core.colorize("#FFFFFF", "Critical efficiency: 2.1x\n") ..core.colorize("#FFFFFF", "Ammunition: 12 gauge shells\n") ..core.colorize("#FFFFFF", "Pump delay: 0.45\n")..core.colorize("#FFFFFF", "Clip size: 8\n") ..core.colorize("#be0d00", "Right-click, to eject the empty shell!\n") ..core.colorize("#fff21c", "Right-click to load in a bullet!\n") ..core.colorize("#FFFFFF", "Gun type: shotgun\n") ..core.colorize("#FFFFFF", "Bullet velocity: 28"),
inventory_image = "rangedweapons_spas12.png", inventory_image = "rangedweapons_spas12.png",
groups = {not_in_creative_inventory = 1}, groups = {not_in_creative_inventory = 1},
on_use = function(user) on_use = function(itemstack, user)
minetest.sound_play("rangedweapons_empty", {user}) minetest.sound_play("rangedweapons_empty", {pos = user:get_pos()})
end, end,
on_secondary_use = function(itemstack, user, pointed_thing) on_secondary_use = function(itemstack, user, pointed_thing)
eject_shell(itemstack,user,"rangedweapons:spas12_rld",0.6,"rangedweapons_shotgun_reload_a","rangedweapons:empty_shell") eject_shell(itemstack,user,"rangedweapons:spas12_rld",0.6,"rangedweapons_shotgun_reload_a","rangedweapons:empty_shell")

@ -8,8 +8,8 @@ minetest.register_tool("rangedweapons:svd_uld", {
groups = {not_in_creative_inventory = 1}, groups = {not_in_creative_inventory = 1},
inventory_image = "rangedweapons_svd.png", inventory_image = "rangedweapons_svd.png",
weapon_zoom = 9, weapon_zoom = 9,
on_use = function(user) on_use = function(itemstack, user)
minetest.sound_play("rangedweapons_empty", {user}) minetest.sound_play("rangedweapons_empty", {pos = user:get_pos()})
end, end,
on_secondary_use = function(itemstack, user, pointed_thing) on_secondary_use = function(itemstack, user, pointed_thing)
eject_shell(itemstack,user,"rangedweapons:svd_rld",1.0,"rangedweapons_rifle_reload_a","rangedweapons:empty_shell") eject_shell(itemstack,user,"rangedweapons:svd_rld",1.0,"rangedweapons_rifle_reload_a","rangedweapons:empty_shell")