Fix Mithril Ball, Fix craft Rezieps, Tidy up

This commit is contained in:
addi 2016-07-16 15:43:55 +02:00
parent 0283ddf099
commit 5211ec0da2
5 changed files with 23 additions and 81 deletions

@ -37,7 +37,7 @@ local exploding={
end, 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) cannons.register_muni("cannons:ball_exploding_stack_1",exploding)
end end
local fire={ local fire={
@ -73,7 +73,7 @@ local fire={
end, 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) cannons.register_muni("cannons:ball_fire_stack_1",fire)
end end

@ -7,37 +7,35 @@ local conf_table = cannons.config:to_table()
--look into readme.txt how to change settings --look into readme.txt how to change settings
local defaults = { local defaults = {
enable_explosion = "true", enable_explosion = "true",
enable_fire = "true", enable_fire = "true",
convert_old_nodes = "true", convert_old_nodes = "false",
} }
for k, v in pairs(defaults) do for k, v in pairs(defaults) do
if conf_table[k] == nil then if conf_table[k] == nil then
cannons.config:set(k, v) cannons.config:set(k, v)
end end
end end
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")
dofile(cannons.MODPATH .."/cannonballs.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") dofile(cannons.MODPATH .."/convert.lua")
end 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") minetest.log("info","TNT mod is aviable. registering some TNT stuff")
dofile(cannons.MODPATH .."/tnt.lua") dofile(cannons.MODPATH .."/tnt.lua")
end end
if minetest.get_modpath("locks") ~=nil then if minetest.get_modpath("locks") then
minetest.log("warning","locks mod enabled. dont execute locks.lua because this is an unstable beta version!") 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 --dofile(cannons.MODPATH .."/locks.lua")--if the locks mod is installed execute this file
end end
if minetest.get_modpath("moreores") ~=nil then if minetest.get_modpath("moreores") then
minetest.log("info","moreores mod enabled. execute moreores.lua") minetest.log("info","moreores mod enabled. execute moreores.lua")
dofile(cannons.MODPATH .."/moreores.lua")--if the moreores mod is installed execute this file dofile(cannons.MODPATH .."/moreores.lua")--if the moreores mod is installed execute this file
end end

@ -55,7 +55,7 @@ minetest.register_craft({
-- new crafts -- -- new crafts --
minetest.register_craft({ minetest.register_craft({
output = 'cannons:cannon', output = "cannons:cannon_steel",
recipe = { recipe = {
{"default:steelblock", "default:steelblock", "default:steelblock"}, {"default:steelblock", "default:steelblock", "default:steelblock"},
{"cannons:gunpowder", "default:mese_block", ""}, {"cannons:gunpowder", "default:mese_block", ""},
@ -64,7 +64,7 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = 'cannons:bronze_canon', output = "cannons:cannon_bronze",
recipe = { recipe = {
{"default:bronzeblock", "default:bronzeblock", "default:bronzeblock"}, {"default:bronzeblock", "default:bronzeblock", "default:bronzeblock"},
{"cannons:gunpowder", "default:mese_block", ""}, {"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({ minetest.register_craft({
output = 'cannons:ball_exploding 2', output = 'cannons:ball_exploding 2',
recipe = { recipe = {
@ -128,7 +128,7 @@ minetest.register_craft({
}) })
end end
if cannons.config:get("enable_fire") == "true" then if cannons.config:get_bool("enable_fire") then
minetest.register_craft({ minetest.register_craft({
output = 'cannons:ball_fire 2', output = 'cannons:ball_fire 2',
recipe = { recipe = {
@ -372,7 +372,7 @@ cannons.generate_and_register_ball_node("cannons:ball_steel", {
}) })
--explosion cannon ball --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", { cannons.generate_and_register_ball_node("cannons:ball_exploding", {
description = "Exploding Cannon Ball", description = "Exploding Cannon Ball",
stack_max = 99, stack_max = 99,
@ -386,7 +386,7 @@ cannons.generate_and_register_ball_node("cannons:ball_exploding", {
end end
--fire cannon ball --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", { cannons.generate_and_register_ball_node("cannons:ball_fire", {
description = "Burning Cannon Ball", description = "Burning Cannon Ball",
stack_max = 99, stack_max = 99,

@ -74,7 +74,7 @@ minetest.register_node("cannons:ship_stand_with_cannon_mithril", {
}) })
--craft reziep mithrill cannon --craft reziep mithrill cannon
minetest.register_craft({ minetest.register_craft({
output = 'cannons:mithril_cannon', output = "cannons:cannon_mithril",
recipe = { recipe = {
{"moreores:mithril_block", "moreores:mithril_block", "moreores:mithril_block"}, {"moreores:mithril_block", "moreores:mithril_block", "moreores:mithril_block"},
{"cannons:gunpowder", "default:mese_block", ""}, {"cannons:gunpowder", "default:mese_block", ""},
@ -83,7 +83,7 @@ minetest.register_craft({
}) })
--mithrill ball --mithrill ball
minetest.register_node("cannons:ball_mithril", { cannons.generate_and_register_ball_node("cannons:ball_mithril", {
description = "Cannon Ball mithril", description = "Cannon Ball mithril",
stack_max = 9, stack_max = 9,
tiles = {"cannons_mithril_top.png"}, tiles = {"cannons_mithril_top.png"},
@ -94,6 +94,7 @@ minetest.register_node("cannons:ball_mithril", {
sounds = cannons.sound_defaults(), sounds = cannons.sound_defaults(),
node_box = cannons.nodeboxes.ball, node_box = cannons.nodeboxes.ball,
}) })
minetest.register_craft({ minetest.register_craft({
output = 'cannons:ball_mithril', output = 'cannons:ball_mithril',
recipe = { 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 --mithril ball
cannons.register_muni("cannons:ball_mithril",{ cannons.register_muni("cannons:ball_mithril_stack_1",{
physical = false, physical = false,
timer=0, timer=0,
textures = {"cannons_ball_mithril.png"}, textures = {"cannons_ball_mithril.png"},

@ -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