diff --git a/cannonballs.lua b/cannonballs.lua index bc4d805..a55aff2 100644 --- a/cannonballs.lua +++ b/cannonballs.lua @@ -37,7 +37,7 @@ local exploding={ end, } -if cannons.enable_explosion then +if cannons.config:get("enable_explosion") == "true" then cannons.register_muni("cannons:ball_exploding",exploding) end local fire={ @@ -73,7 +73,7 @@ local fire={ end, } -if cannons.enable_fire then +if cannons.config:get("enable_fire")=="true" then cannons.register_muni("cannons:ball_fire",fire) end diff --git a/init.lua b/init.lua index d87c0e8..b21e4b0 100644 --- a/init.lua +++ b/init.lua @@ -3,9 +3,23 @@ cannons = {} 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 .."/functions.lua") dofile(cannons.MODPATH .."/items.lua") diff --git a/items.lua b/items.lua index 1b517ce..9b85c05 100644 --- a/items.lua +++ b/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({ output = 'cannons:ball_exploding 2', recipe = { @@ -149,7 +149,7 @@ minetest.register_craft({ }) end -if cannons.enable_fire then +if cannons.config:get("enable_fire") == "true" then minetest.register_craft({ output = 'cannons:ball_fire 2', recipe = { @@ -288,7 +288,7 @@ minetest.register_node("cannons:ball_steel", { }) --explosion cannon ball -if cannons.enable_explosion then +if cannons.config:get("enable_explosion") == "true" then minetest.register_node("cannons:ball_exploding", { description = "Exploding Cannon Ball", stack_max = 99, @@ -303,7 +303,7 @@ minetest.register_node("cannons:ball_exploding", { end --fire cannon ball -if cannons.enable_fire then +if cannons.config:get("enable_fire") == "true" then minetest.register_node("cannons:ball_fire", { description = "Burning Cannon Ball", stack_max = 99, diff --git a/readme.md b/readme.md index c41d639..dfa701e 100644 --- a/readme.md +++ b/readme.md @@ -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 (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. 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 @@ -116,4 +132,4 @@ cannons.register_muni("cannons:ball_wood",ball_wood) -Have fun! +Have fun! \ No newline at end of file diff --git a/settings.txt b/settings.txt deleted file mode 100644 index 31aefc9..0000000 --- a/settings.txt +++ /dev/null @@ -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 \ No newline at end of file