Fix Mithril Ball, Fix craft Rezieps, Tidy up

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

View File

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

View File

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

View File

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

View File

@ -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"},

View File

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