Improve config loading and other fixes
This commit is contained in:
parent
cb922eaafd
commit
cf6122ca0c
5 changed files with 36 additions and 17 deletions
|
@ -5,6 +5,18 @@ Depends: shooter, wool, dye
|
|||
|
||||
Adds a crossbow with colored arrows.
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Override the following default settings by adding them to your minetest.conf file
|
||||
|
||||
* `shooter_crossbow_uses = 50`: Number of crossbow uses
|
||||
* `shooter_arrow_lifetime = 180`: Arrow exipiry time in seconds
|
||||
* `shooter_arrow_fleshy = 2`: Arrow 'fleshy' damage level
|
||||
* `shooter_arrow_object_attach = false`: Attach arrows to objects when hit
|
||||
* Experimental, currently does not work well with oversized selection boxes!
|
||||
|
||||
|
||||
Crafting
|
||||
========
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
local config = {
|
||||
crossbow_uses = 50,
|
||||
arrow_lifetime = 180,
|
||||
arrow_fleshy = 2,
|
||||
arrow_object_attach = false,
|
||||
}
|
||||
|
||||
|
@ -30,13 +31,13 @@ for name, _ in pairs(config) do
|
|||
if minetest.global_exists(global) then
|
||||
config[name] = _G[global]
|
||||
end
|
||||
local setting = minetest.settings:get("shooter_"..name)
|
||||
if type(setting) == "string" then
|
||||
config[name] = tonumber(setting)
|
||||
end
|
||||
end
|
||||
|
||||
local arrow_tool_caps = {damage_groups={fleshy=2}}
|
||||
-- Load configuration
|
||||
|
||||
config = shooter.get_configuration(config)
|
||||
|
||||
local arrow_tool_caps = {damage_groups={fleshy=config.arrow_fleshy}}
|
||||
if minetest.global_exists("SHOOTER_ARROW_TOOL_CAPS") then
|
||||
arrow_tool_caps = table.copy(SHOOTER_ARROW_TOOL_CAPS)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue