From 5211ec0da2d49fe6a798a0a0b96427e6fa4c3a28 Mon Sep 17 00:00:00 2001 From: addi Date: Sat, 16 Jul 2016 15:43:55 +0200 Subject: [PATCH] Fix Mithril Ball, Fix craft Rezieps, Tidy up --- cannonballs.lua | 4 ++-- init.lua | 24 +++++++++++------------- items.lua | 12 ++++++------ moreores.lua | 33 ++++----------------------------- print_r.lua | 31 ------------------------------- 5 files changed, 23 insertions(+), 81 deletions(-) delete mode 100644 print_r.lua diff --git a/cannonballs.lua b/cannonballs.lua index c018bee..1ad7e1e 100644 --- a/cannonballs.lua +++ b/cannonballs.lua @@ -37,7 +37,7 @@ local exploding={ end, } -if cannons.config:get("enable_explosion") == "true" then +if cannons.config:get_bool("enable_explosion") then cannons.register_muni("cannons:ball_exploding_stack_1",exploding) end local fire={ @@ -73,7 +73,7 @@ local fire={ end, } -if cannons.config:get("enable_fire")=="true" then +if cannons.config:get_bool("enable_fire") then cannons.register_muni("cannons:ball_fire_stack_1",fire) end diff --git a/init.lua b/init.lua index 66cb3aa..a3674dc 100644 --- a/init.lua +++ b/init.lua @@ -7,37 +7,35 @@ local conf_table = cannons.config:to_table() --look into readme.txt how to change settings local defaults = { -enable_explosion = "true", -enable_fire = "true", -convert_old_nodes = "true", + enable_explosion = "true", + enable_fire = "true", + convert_old_nodes = "false", } for k, v in pairs(defaults) do -if conf_table[k] == nil then -cannons.config:set(k, v) -end + if conf_table[k] == nil then + cannons.config:set(k, v) + end end - -dofile(cannons.MODPATH .."/print_r.lua") dofile(cannons.MODPATH .."/functions.lua") dofile(cannons.MODPATH .."/items.lua") dofile(cannons.MODPATH .."/cannonballs.lua") -if cannons.config:get("convert_old_nodes")=="true" then +if cannons.config:get_bool("convert_old_nodes") then dofile(cannons.MODPATH .."/convert.lua") end -if minetest.get_modpath("tnt") ~=nil then +if minetest.get_modpath("tnt") then minetest.log("info","TNT mod is aviable. registering some TNT stuff") dofile(cannons.MODPATH .."/tnt.lua") end -if minetest.get_modpath("locks") ~=nil then -minetest.log("warning","locks mod enabled. dont execute locks.lua because this is an unstable beta version!") +if minetest.get_modpath("locks") then + minetest.log("warning","locks mod enabled. dont execute locks.lua because this is an unstable beta version!") --dofile(cannons.MODPATH .."/locks.lua")--if the locks mod is installed execute this file end -if minetest.get_modpath("moreores") ~=nil then +if minetest.get_modpath("moreores") then minetest.log("info","moreores mod enabled. execute moreores.lua") dofile(cannons.MODPATH .."/moreores.lua")--if the moreores mod is installed execute this file end diff --git a/items.lua b/items.lua index e4def00..cffd833 100644 --- a/items.lua +++ b/items.lua @@ -55,7 +55,7 @@ minetest.register_craft({ -- new crafts -- minetest.register_craft({ - output = 'cannons:cannon', + output = "cannons:cannon_steel", recipe = { {"default:steelblock", "default:steelblock", "default:steelblock"}, {"cannons:gunpowder", "default:mese_block", ""}, @@ -64,7 +64,7 @@ minetest.register_craft({ }) minetest.register_craft({ - output = 'cannons:bronze_canon', + output = "cannons:cannon_bronze", recipe = { {"default:bronzeblock", "default:bronzeblock", "default:bronzeblock"}, {"cannons:gunpowder", "default:mese_block", ""}, @@ -117,7 +117,7 @@ minetest.register_craft({ }, }) -if cannons.config:get("enable_explosion") == "true" then +if cannons.config:get_bool("enable_explosion") then minetest.register_craft({ output = 'cannons:ball_exploding 2', recipe = { @@ -128,7 +128,7 @@ minetest.register_craft({ }) end -if cannons.config:get("enable_fire") == "true" then +if cannons.config:get_bool("enable_fire") then minetest.register_craft({ output = 'cannons:ball_fire 2', recipe = { @@ -372,7 +372,7 @@ cannons.generate_and_register_ball_node("cannons:ball_steel", { }) --explosion cannon ball -if cannons.config:get("enable_explosion") == "true" then +if cannons.config:get_bool("enable_explosion") then cannons.generate_and_register_ball_node("cannons:ball_exploding", { description = "Exploding Cannon Ball", stack_max = 99, @@ -386,7 +386,7 @@ cannons.generate_and_register_ball_node("cannons:ball_exploding", { end --fire cannon ball -if cannons.config:get("enable_fire") == "true" then +if cannons.config:get_bool("enable_fire") then cannons.generate_and_register_ball_node("cannons:ball_fire", { description = "Burning Cannon Ball", stack_max = 99, diff --git a/moreores.lua b/moreores.lua index 54886d7..c2caf4a 100644 --- a/moreores.lua +++ b/moreores.lua @@ -74,7 +74,7 @@ minetest.register_node("cannons:ship_stand_with_cannon_mithril", { }) --craft reziep mithrill cannon minetest.register_craft({ - output = 'cannons:mithril_cannon', + output = "cannons:cannon_mithril", recipe = { {"moreores:mithril_block", "moreores:mithril_block", "moreores:mithril_block"}, {"cannons:gunpowder", "default:mese_block", ""}, @@ -83,7 +83,7 @@ minetest.register_craft({ }) --mithrill ball -minetest.register_node("cannons:ball_mithril", { +cannons.generate_and_register_ball_node("cannons:ball_mithril", { description = "Cannon Ball mithril", stack_max = 9, tiles = {"cannons_mithril_top.png"}, @@ -94,6 +94,7 @@ minetest.register_node("cannons:ball_mithril", { sounds = cannons.sound_defaults(), node_box = cannons.nodeboxes.ball, }) + minetest.register_craft({ output = 'cannons:ball_mithril', recipe = { @@ -101,35 +102,9 @@ minetest.register_craft({ }, }) ---ball mithril stack -minetest.register_node("cannons:ball_mithril_stack", { - description = "Cannon Ball mithril Stack", - stack_max = 9, - tiles = {"cannons_mithril_top.png"}, - drawtype = "nodebox", - drop = 'cannons:ball_mithril 4', - paramtype = "light", - paramtype2 = "facedir", - groups = {cracky=2}, - sounds = cannons.sound_defaults(), - node_box = cannons.nodeboxes.ball_stack, - selection_box = { - type = "fixed", - fixed = { - {-0.4, -0.5, -0.5, 0.5, 0.3, 0.5}, - }, - }, -}) -minetest.register_craft({ - type = "shapeless", - output = 'cannons:ball_mithril_stack', - recipe = { - "cannons:ball_mithril", "cannons:ball_mithril", "cannons:ball_mithril", "cannons:ball_mithril" - }, -}) --mithril ball -cannons.register_muni("cannons:ball_mithril",{ +cannons.register_muni("cannons:ball_mithril_stack_1",{ physical = false, timer=0, textures = {"cannons_ball_mithril.png"}, diff --git a/print_r.lua b/print_r.lua deleted file mode 100644 index f2ff721..0000000 --- a/print_r.lua +++ /dev/null @@ -1,31 +0,0 @@ -function print_r (t, name, indent) - local tableList = {} - function table_r (t, name, indent, full) - local id = not full and name - or type(name)~="number" and tostring(name) or '['..name..']' - local tag = indent .. id .. ' = ' - local out = {} -- result - if type(t) == "table" then - if tableList[t] ~= nil then table.insert(out, tag .. '{} -- ' .. tableList[t] .. ' (self reference)') - else - tableList[t]= full and (full .. '.' .. id) or id - if next(t) then -- Table not empty - table.insert(out, tag .. '{') - for key,value in pairs(t) do - table.insert(out,table_r(value,key,indent .. '| ',tableList[t])) - end - table.insert(out,indent .. '}') - else table.insert(out,tag .. '{}') end - end - else - local val = type(t)~="number" and type(t)~="boolean" and '"'..tostring(t)..'"' or tostring(t) - table.insert(out, tag .. val) - end - return table.concat(out, '\n') - end - return table_r(t,name or 'Value',indent or '') -end - -function pr (t, name) - print(print_r(t,name)) -end \ No newline at end of file