Fix crash caused by previous commit

This commit is contained in:
stujones11 2019-03-26 18:08:16 +00:00
parent 182f50daa8
commit 78007fa332
2 changed files with 3 additions and 4 deletions

View file

@ -122,8 +122,8 @@ API Documentation
### Methods
* `shooter.register_weapon(name, definition)`: Register a shooting weapon. -- See "Weapon Definition"
* `shooter.get_weapon_spec(player, weaponname)`: Gets the spec for a particular weapon.
Override to add support for per-player specs.
* `shooter.get_weapon_spec(player, weaponname)`: Gets the spec for a particular weapon
* Override to add support for per-player specs.
* `shooter.get_configuration(config)`: Loads matching config settings into a table ref `config`
* `shooter.spawn_particles(pos, particles)`: Adds particles at the specified position
* `particles` is an optional table of overrides for `shooter.default_particles`

View file

@ -83,7 +83,7 @@ shooter.register_weapon = function(name, def)
itemstack = def.on_use(itemstack, user, pointed_thing)
end
if itemstack then
local spec = shooter.get_weapon_spec(name)
local spec = shooter.get_weapon_spec(nil, name)
if shooter.fire_weapon(user, itemstack, spec) then
itemstack:add_wear(def.spec.wear)
if itemstack:get_count() == 0 then
@ -123,7 +123,6 @@ shooter.get_weapon_spec = function(_, name)
if not def then
return nil
end
return table.copy(def.spec)
end