Fix shooter.get_weapon_spec

This commit is contained in:
rubenwardy 2020-03-14 20:59:55 +00:00
parent cfb3818b09
commit 5593df448f

View file

@ -93,9 +93,8 @@ shooter.register_weapon = function(name, def)
itemstack = def.on_use(itemstack, user, pointed_thing) itemstack = def.on_use(itemstack, user, pointed_thing)
end end
if itemstack then if itemstack then
local spec = shooter.get_weapon_spec(nil, name) or local spec = shooter.get_weapon_spec(user, name)
table.copy(def.spec) if spec and shooter.fire_weapon(user, itemstack, spec) then
if shooter.fire_weapon(user, itemstack, spec) then
itemstack:add_wear(def.spec.wear) itemstack:add_wear(def.spec.wear)
if itemstack:get_count() == 0 then if itemstack:get_count() == 0 then
itemstack:replace(def.unloaded_item.name) itemstack:replace(def.unloaded_item.name)