moved cannons settings into world dir

read readme.md how to change the settings
This commit is contained in:
adrido 2014-07-27 09:24:33 +02:00
parent 2e871346ab
commit 31c458a156
5 changed files with 41 additions and 27 deletions

@ -37,7 +37,7 @@ local exploding={
end, end,
} }
if cannons.enable_explosion then if cannons.config:get("enable_explosion") == "true" then
cannons.register_muni("cannons:ball_exploding",exploding) cannons.register_muni("cannons:ball_exploding",exploding)
end end
local fire={ local fire={
@ -73,7 +73,7 @@ local fire={
end, end,
} }
if cannons.enable_fire then if cannons.config:get("enable_fire")=="true" then
cannons.register_muni("cannons:ball_fire",fire) cannons.register_muni("cannons:ball_fire",fire)
end end

@ -3,9 +3,23 @@
cannons = {} cannons = {}
cannons.MODPATH = minetest.get_modpath(minetest.get_current_modname()) cannons.MODPATH = minetest.get_modpath(minetest.get_current_modname())
local worldpath = minetest.get_worldpath()
cannons.config = Settings(worldpath.."/cannons.conf")
local conf_table = cannons.config:to_table()
--look into readme.txt how to change settings
local defaults = {
enable_explosion = "true",
enable_fire = "true",
}
for k, v in pairs(defaults) do
if conf_table[k] == nil then
cannons.config:set(k, v)
end
end
dofile(cannons.MODPATH .."/settings.txt")
dofile(cannons.MODPATH .."/print_r.lua") dofile(cannons.MODPATH .."/print_r.lua")
dofile(cannons.MODPATH .."/functions.lua") dofile(cannons.MODPATH .."/functions.lua")
dofile(cannons.MODPATH .."/items.lua") dofile(cannons.MODPATH .."/items.lua")

@ -138,7 +138,7 @@ minetest.register_craft({
}, },
}) })
if cannons.enable_explosion then if cannons.config:get("enable_explosion") == "true" then
minetest.register_craft({ minetest.register_craft({
output = 'cannons:ball_exploding 2', output = 'cannons:ball_exploding 2',
recipe = { recipe = {
@ -149,7 +149,7 @@ minetest.register_craft({
}) })
end end
if cannons.enable_fire then if cannons.config:get("enable_fire") == "true" then
minetest.register_craft({ minetest.register_craft({
output = 'cannons:ball_fire 2', output = 'cannons:ball_fire 2',
recipe = { recipe = {
@ -288,7 +288,7 @@ minetest.register_node("cannons:ball_steel", {
}) })
--explosion cannon ball --explosion cannon ball
if cannons.enable_explosion then if cannons.config:get("enable_explosion") == "true" then
minetest.register_node("cannons:ball_exploding", { minetest.register_node("cannons:ball_exploding", {
description = "Exploding Cannon Ball", description = "Exploding Cannon Ball",
stack_max = 99, stack_max = 99,
@ -303,7 +303,7 @@ minetest.register_node("cannons:ball_exploding", {
end end
--fire cannon ball --fire cannon ball
if cannons.enable_fire then if cannons.config:get("enable_fire") == "true" then
minetest.register_node("cannons:ball_fire", { minetest.register_node("cannons:ball_fire", {
description = "Burning Cannon Ball", description = "Burning Cannon Ball",
stack_max = 99, stack_max = 99,

@ -1,4 +1,4 @@
# Welcome to the cannons mod # Welcome to the cannons mod #
cannons is a mod for the game minetest written by Kingarthurs Team cannons is a mod for the game minetest written by Kingarthurs Team
(Semmett9, eythen, and addi) (Semmett9, eythen, and addi)
@ -7,11 +7,27 @@ you can shot the cannon if you punch it with a torch.
the cannonball will damage the other players. the cannonball will damage the other players.
if it wears armor the damage will be calculated. if it wears armor the damage will be calculated.
## configure cannons
if you dont want exploding or burning muni you can dissable it in the settings.txt ## configure cannons ##
create a file caled cannons.conf in your world dir.
add the folowing lines to it:
```
#!conf
enable_explosion = "true"
enable_fire = "true"
```
now you can change it. eg. if you want to disable fire then cange
*enable_fire = "true"*
to
*enable_fire = "false"*
thats all :-)
## Dependencies ## Dependencies
@ -116,4 +132,4 @@ cannons.register_muni("cannons:ball_wood",ball_wood)
Have fun! Have fun!

@ -1,16 +0,0 @@
------------------------------------------------------------------------------
------------------------------ CONFIGURATION ---------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-------- Change settings by changing the values after the "=". ---------------
------------------------------------------------------------------------------
-- enable/disable the muni wich makes things burning if it hit them.
-- if you want to dissable it just set it to false:
cannons.enable_fire = true
-- enable/disable the muni wich destroyes nodesif it hit them.
-- if you want to dissable it just set it to false:
cannons.enable_explosion = true