Fix crash caused by previous commit
This commit is contained in:
parent
182f50daa8
commit
78007fa332
2 changed files with 3 additions and 4 deletions
|
@ -122,8 +122,8 @@ API Documentation
|
||||||
### Methods
|
### Methods
|
||||||
|
|
||||||
* `shooter.register_weapon(name, definition)`: Register a shooting weapon. -- See "Weapon Definition"
|
* `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.
|
* `shooter.get_weapon_spec(player, weaponname)`: Gets the spec for a particular weapon
|
||||||
Override to add support for per-player specs.
|
* Override to add support for per-player specs.
|
||||||
* `shooter.get_configuration(config)`: Loads matching config settings into a table ref `config`
|
* `shooter.get_configuration(config)`: Loads matching config settings into a table ref `config`
|
||||||
* `shooter.spawn_particles(pos, particles)`: Adds particles at the specified position
|
* `shooter.spawn_particles(pos, particles)`: Adds particles at the specified position
|
||||||
* `particles` is an optional table of overrides for `shooter.default_particles`
|
* `particles` is an optional table of overrides for `shooter.default_particles`
|
||||||
|
|
|
@ -83,7 +83,7 @@ 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(name)
|
local spec = shooter.get_weapon_spec(nil, name)
|
||||||
if 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
|
||||||
|
@ -123,7 +123,6 @@ shooter.get_weapon_spec = function(_, name)
|
||||||
if not def then
|
if not def then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
return table.copy(def.spec)
|
return table.copy(def.spec)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue