Define default gunshot sound during gun registration itself
Every minor optimisation matters :)
This commit is contained in:
parent
2b7de3cc9d
commit
1afd0ca267
9
api.lua
9
api.lua
@ -60,9 +60,7 @@ local function fire(stack, player)
|
||||
local def = gunslinger.get_def(stack:get_name())
|
||||
|
||||
-- Play gunshot sound
|
||||
local default_fire_sound = (def.style_of_fire ~= "splash")
|
||||
and "gunslinger_fire1" or "gunslinger_fire2"
|
||||
play_sound(def.fire_sound or default_fire_sound)
|
||||
play_sound(def.fire_sound)
|
||||
|
||||
-- Take aim
|
||||
local eye_offset = {x = 0, y = 1.625, z = 0} --player:get_eye_offset().offset_first
|
||||
@ -267,6 +265,11 @@ function gunslinger.register_gun(name, def)
|
||||
end
|
||||
end
|
||||
|
||||
if not def.fire_sound then
|
||||
def.fire_sound = (def.style_of_fire ~= "splash")
|
||||
and "gunslinger_fire1" or "gunslinger_fire2"
|
||||
end
|
||||
|
||||
if def.zoom and not def.scope then
|
||||
error("gunslinger.register_gun: zoom requires scope to be defined!")
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user