mirror of
https://bitbucket.org/kingarthursteam/cannons.git
synced 2024-07-15 11:39:28 +02:00
code cleanup
This commit is contained in:
parent
cb62aeac32
commit
b455f3466b
125
functions.lua
125
functions.lua
@ -73,6 +73,7 @@ cannons.allow_metadata_inventory_put = function(pos, listname, index, stack, pla
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
cannons.allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
cannons.allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -91,15 +92,30 @@ cannons.allow_metadata_inventory_move = function(pos, from_list, from_index, to_
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
cannons.can_dig = function(pos,player)
|
||||||
|
local meta = minetest.get_meta(pos);
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
if not inv:is_empty("gunpowder") then
|
||||||
|
return false
|
||||||
|
elseif not inv:is_empty("muni") then
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
cannons.formspec =
|
cannons.formspec =
|
||||||
"size[8,9]"..
|
"size[8,9]"..
|
||||||
"list[current_name;muni;0,1;1,1;] label[0,0.5;Muni:]"..
|
"list[current_name;muni;0,1;1,1;] label[0,0.5;Muni:]"..
|
||||||
"list[current_name;gunpowder;0,3;1,1;] label[0,2.5;Gunpowder:]"..
|
"list[current_name;gunpowder;0,3;1,1;] label[0,2.5;Gunpowder:]"..
|
||||||
"list[current_player;main;0,5;8,4;]"
|
"list[current_player;main;0,5;8,4;]"
|
||||||
|
|
||||||
cannons.disabled_formspec =
|
cannons.disabled_formspec =
|
||||||
"size[8,9]"..
|
"size[8,9]"..
|
||||||
"label[2,0.5;Cannon is Disabled. Place it on a cannonstand to activate it]"..
|
"label[2,0.5;Cannon is Disabled. Place it on a cannonstand to activate it]"..
|
||||||
"list[current_player;main;0,5;8,4;]"
|
"list[current_player;main;0,5;8,4;]"
|
||||||
|
|
||||||
cannons.on_construct = function(pos)
|
cannons.on_construct = function(pos)
|
||||||
local node = minetest.get_node({x = pos.x ,y = pos.y-1, z = pos.z})
|
local node = minetest.get_node({x = pos.x ,y = pos.y-1, z = pos.z})
|
||||||
if minetest.registered_nodes[node.name].groups.cannonstand then
|
if minetest.registered_nodes[node.name].groups.cannonstand then
|
||||||
@ -115,6 +131,7 @@ cannons.on_construct = function(pos)
|
|||||||
meta:set_string("infotext", "Cannon is out of order")
|
meta:set_string("infotext", "Cannon is out of order")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
cannons.on_construct_locks = function(pos)
|
cannons.on_construct_locks = function(pos)
|
||||||
local node = minetest.get_node({x = pos.x ,y = pos.y-1, z = pos.z})
|
local node = minetest.get_node({x = pos.x ,y = pos.y-1, z = pos.z})
|
||||||
if minetest.registered_nodes[node.name].groups.cannonstand then
|
if minetest.registered_nodes[node.name].groups.cannonstand then
|
||||||
@ -132,37 +149,7 @@ cannons.on_construct_locks = function(pos)
|
|||||||
meta:set_string("infotext", "Cannon is out of order")
|
meta:set_string("infotext", "Cannon is out of order")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
cannons.nodebox = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, 0.2, -0.7, 0.2, -0.2, 0.9}, -- barrle --
|
|
||||||
{0.53, -0.1, 0.1, -0.53, 0.1, -0.1}, -- plinth --
|
|
||||||
|
|
||||||
-- side , top hight , depth , side , bottom, side,
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cannons.stand_nodebox = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, -- bottom --
|
|
||||||
{-0.5, -0.5, -0.5, -0.35, 1.0, 0.5}, -- side left --
|
|
||||||
{0.35, -0.5, -0.5, 0.5, 1.0, 0.5}, -- side right --
|
|
||||||
{0.35, -0.5, -0.2, 0.5, 1.2, 0.5}, -- side right --
|
|
||||||
{-0.5, -0.5, -0.2, -0.35, 1.2, 0.5}, -- side left --
|
|
||||||
|
|
||||||
-- side , top , side , side , bottom, side,
|
|
||||||
|
|
||||||
},
|
|
||||||
}
|
|
||||||
cannons.rules =
|
|
||||||
{{x = 1, y = 0, z = 0},
|
|
||||||
{x =-1, y = 0, z = 0},
|
|
||||||
{x = 0, y = 0, z = 1},
|
|
||||||
{x = 0, y = 0, z =-1}}
|
|
||||||
function cannons.meseconsfire(pos,node)
|
|
||||||
cannons.fire(pos,node)
|
|
||||||
end
|
|
||||||
function cannons.nodehitparticles(pos,node)
|
function cannons.nodehitparticles(pos,node)
|
||||||
if type(minetest.registered_nodes[node.name]) == "table" and type(minetest.registered_nodes[node.name].tiles) == "table" and type(minetest.registered_nodes[node.name].tiles[1])== "string" then
|
if type(minetest.registered_nodes[node.name]) == "table" and type(minetest.registered_nodes[node.name].tiles) == "table" and type(minetest.registered_nodes[node.name].tiles[1])== "string" then
|
||||||
local texture = minetest.registered_nodes[node.name].tiles[1]
|
local texture = minetest.registered_nodes[node.name].tiles[1]
|
||||||
@ -291,6 +278,82 @@ end
|
|||||||
function cannons.get_settings(node)
|
function cannons.get_settings(node)
|
||||||
return cannons.registered_muni[node].entity
|
return cannons.registered_muni[node].entity
|
||||||
end
|
end
|
||||||
|
--++++++++++++++++++++++++++++++++++++
|
||||||
|
--+ mesecons stuff +
|
||||||
|
--++++++++++++++++++++++++++++++++++++
|
||||||
|
cannons.rules ={
|
||||||
|
{x = 1, y = 0, z = 0},
|
||||||
|
{x =-1, y = 0, z = 0},
|
||||||
|
{x = 0, y = 0, z = 1},
|
||||||
|
{x = 0, y = 0, z =-1}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cannons.meseconsfire(pos,node)
|
||||||
|
cannons.fire(pos,node)
|
||||||
|
end
|
||||||
|
|
||||||
|
cannons.supportMesecons = {
|
||||||
|
effector = {
|
||||||
|
rules = cannons.rules,
|
||||||
|
action_on = cannons.meseconsfire,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
--++++++++++++++++++++++++++++++++++++
|
||||||
|
--+ cannons.nodeboxes +
|
||||||
|
--++++++++++++++++++++++++++++++++++++
|
||||||
|
cannons.nodeboxes = {}
|
||||||
|
cannons.nodeboxes.ball = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
||||||
|
|
||||||
|
-- side , top , side , side , bottom, side,
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
cannons.nodeboxes.ball_stack = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.2, -0.1, -0.2, 0.2, 0.3, 0.2}, -- ball top
|
||||||
|
{0.1, -0.5, -0.2, 0.2, -0.1, 0.2}, -- ball left
|
||||||
|
{0.5, -0.5, -0.2, 0.2, -0.1, 0.2}, -- ball left
|
||||||
|
{-0.2, -0.5, 0.5, 0.0, -0.1, 0.2},-- ball back
|
||||||
|
{0.0, -0.5, 0.1, -0.4, -0.1, 0.2},--ball back
|
||||||
|
{-0.2, -0.5, 0.5, -0.4, -0.1, 0.2},-- ball back
|
||||||
|
{-0.2, -0.5, 0.1, -0.4, -0.1, 0.2},-- ball back
|
||||||
|
{-0.2, -0.5, -0.1, -0.4, -0.1, -0.5},
|
||||||
|
{0.0, -0.5, -0.1, -0.4, -0.1, -0.5},
|
||||||
|
|
||||||
|
|
||||||
|
-- side , top , side , side , bottom, side,
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
cannons.nodeboxes.cannon = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.2, 0.2, -0.7, 0.2, -0.2, 0.9}, -- barrle --
|
||||||
|
{0.53, -0.1, 0.1, -0.53, 0.1, -0.1}, -- plinth --
|
||||||
|
|
||||||
|
-- side , top hight , depth , side , bottom, side,
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cannons.nodeboxes.stand = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, -- bottom --
|
||||||
|
{-0.5, -0.5, -0.5, -0.35, 1.0, 0.5}, -- side left --
|
||||||
|
{0.35, -0.5, -0.5, 0.5, 1.0, 0.5}, -- side right --
|
||||||
|
{0.35, -0.5, -0.2, 0.5, 1.2, 0.5}, -- side right --
|
||||||
|
{-0.5, -0.5, -0.2, -0.35, 1.2, 0.5}, -- side left --
|
||||||
|
|
||||||
|
-- side , top , side , side , bottom, side,
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
local apple={
|
local apple={
|
||||||
physical = false,
|
physical = false,
|
||||||
|
220
items.lua
220
items.lua
@ -161,7 +161,7 @@ end
|
|||||||
|
|
||||||
-- classic cannon --
|
-- classic cannon --
|
||||||
minetest.register_node("cannons:cannon", {
|
minetest.register_node("cannons:cannon", {
|
||||||
description = "Cannon",
|
description = "Cannon",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
tiles = {"cannon_cannon_top.png","cannon_cannon_top.png","cannon_cannon_side.png","cannon_cannon_side.png","cannon_cannon_top.png^cannons_rim.png","cannon_cannon_side.png"},
|
tiles = {"cannon_cannon_top.png","cannon_cannon_top.png","cannon_cannon_side.png","cannon_cannon_side.png","cannon_cannon_top.png^cannons_rim.png","cannon_cannon_side.png"},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
@ -169,35 +169,15 @@ minetest.register_node("cannons:cannon", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
sounds = cannons.sound_defaults(),
|
sounds = cannons.sound_defaults(),
|
||||||
node_box = cannons.nodebox,
|
node_box = cannons.nodeboxes.cannon,
|
||||||
on_place = cannons.on_place,
|
|
||||||
selection_box = cannons.nodebox,
|
|
||||||
on_punch = cannons.punched,
|
on_punch = cannons.punched,
|
||||||
mesecons = {effector = {
|
mesecons = cannons.supportMesecons,
|
||||||
rules = cannons.rules,
|
|
||||||
action_on = cannons.meseconsfire,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
on_construct = cannons.on_construct,
|
on_construct = cannons.on_construct,
|
||||||
can_dig = function(pos,player)
|
can_dig = cannons.can_dig,
|
||||||
local meta = minetest.get_meta(pos);
|
allow_metadata_inventory_put = cannons.allow_metadata_inventory_put,
|
||||||
local inv = meta:get_inventory()
|
allow_metadata_inventory_move = cannons.allow_metadata_inventory_move,
|
||||||
if not inv:is_empty("gunpowder") then
|
on_metadata_inventory_put = cannons.inventory_modified,
|
||||||
return false
|
on_metadata_inventory_take = cannons.inventory_modified,
|
||||||
elseif not inv:is_empty("muni") then
|
|
||||||
return false
|
|
||||||
else
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
allow_metadata_inventory_put = cannons.allow_metadata_inventory_put,
|
|
||||||
|
|
||||||
allow_metadata_inventory_move = cannons.allow_metadata_inventory_move,
|
|
||||||
|
|
||||||
on_metadata_inventory_put = cannons.inventory_modified,
|
|
||||||
|
|
||||||
on_metadata_inventory_take = cannons.inventory_modified,
|
|
||||||
|
|
||||||
on_metadata_inventory_move = cannons.inventory_modified,
|
on_metadata_inventory_move = cannons.inventory_modified,
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -212,34 +192,15 @@ minetest.register_node("cannons:bronze_canon", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
sounds = cannons.sound_defaults(),
|
sounds = cannons.sound_defaults(),
|
||||||
node_box = cannons.nodebox,
|
node_box = cannons.nodeboxes.cannon,
|
||||||
selection_box = cannons.nodebox,
|
|
||||||
on_punch = cannons.punched,
|
on_punch = cannons.punched,
|
||||||
mesecons = {effector = {
|
mesecons = cannons.supportMesecons,
|
||||||
rules = cannons.rules,
|
|
||||||
action_on = cannons.meseconsfire,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
on_construct = cannons.on_construct,
|
on_construct = cannons.on_construct,
|
||||||
can_dig = function(pos,player)
|
can_dig = cannons.can_dig,
|
||||||
local meta = minetest.get_meta(pos);
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
if not inv:is_empty("gunpowder") then
|
|
||||||
return false
|
|
||||||
elseif not inv:is_empty("muni") then
|
|
||||||
return false
|
|
||||||
else
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
allow_metadata_inventory_put = cannons.allow_metadata_inventory_put,
|
allow_metadata_inventory_put = cannons.allow_metadata_inventory_put,
|
||||||
|
allow_metadata_inventory_move = cannons.allow_metadata_inventory_move,
|
||||||
allow_metadata_inventory_move = cannons.allow_metadata_inventory_move,
|
on_metadata_inventory_put = cannons.inventory_modified,
|
||||||
|
on_metadata_inventory_take = cannons.inventory_modified,
|
||||||
on_metadata_inventory_put = cannons.inventory_modified,
|
|
||||||
|
|
||||||
on_metadata_inventory_take = cannons.inventory_modified,
|
|
||||||
|
|
||||||
on_metadata_inventory_move = cannons.inventory_modified,
|
on_metadata_inventory_move = cannons.inventory_modified,
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -253,7 +214,7 @@ minetest.register_node("cannons:stand", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2,cannonstand=1},
|
groups = {cracky=2,cannonstand=1},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = cannons.stand_nodebox,
|
node_box = cannons.nodeboxes.stand,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -271,7 +232,7 @@ minetest.register_node("cannons:stand_wood", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2,cannonstand=1},
|
groups = {cracky=2,cannonstand=1},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = cannons.stand_nodebox,
|
node_box = cannons.nodeboxes.stand,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -283,6 +244,7 @@ minetest.register_node("cannons:stand_wood", {
|
|||||||
--+ cannon balls +
|
--+ cannon balls +
|
||||||
--++++++++++++++++++++++++++++++++++++
|
--++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
--wood ball
|
||||||
minetest.register_node("cannons:ball_wood", {
|
minetest.register_node("cannons:ball_wood", {
|
||||||
description = "Cannon Ball Wood",
|
description = "Cannon Ball Wood",
|
||||||
stack_max = 99,
|
stack_max = 99,
|
||||||
@ -292,23 +254,10 @@ minetest.register_node("cannons:ball_wood", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2},
|
groups = {cracky=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = {
|
node_box = cannons.nodeboxes.ball,
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
|
||||||
|
|
||||||
-- side , top , side , side , bottom, side,
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--stone ball
|
||||||
minetest.register_node("cannons:ball_stone", {
|
minetest.register_node("cannons:ball_stone", {
|
||||||
description = "Cannon Ball Stone",
|
description = "Cannon Ball Stone",
|
||||||
stack_max = 99,
|
stack_max = 99,
|
||||||
@ -318,23 +267,10 @@ minetest.register_node("cannons:ball_stone", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2},
|
groups = {cracky=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = {
|
node_box = cannons.nodeboxes.ball,
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
|
||||||
|
|
||||||
-- side , top , side , side , bottom, side,
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--steel ball
|
||||||
minetest.register_node("cannons:ball_steel", {
|
minetest.register_node("cannons:ball_steel", {
|
||||||
description = "Cannon Ball Steel",
|
description = "Cannon Ball Steel",
|
||||||
stack_max = 99,
|
stack_max = 99,
|
||||||
@ -344,22 +280,10 @@ minetest.register_node("cannons:ball_steel", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2},
|
groups = {cracky=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = {
|
node_box = cannons.nodeboxes.ball,
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
|
||||||
|
|
||||||
-- side , top , side , side , bottom, side,
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--explosion cannon ball
|
||||||
if cannons.enable_explosion then
|
if cannons.enable_explosion then
|
||||||
minetest.register_node("cannons:ball_exploding", {
|
minetest.register_node("cannons:ball_exploding", {
|
||||||
description = "Exploding Cannon Ball",
|
description = "Exploding Cannon Ball",
|
||||||
@ -370,23 +294,11 @@ minetest.register_node("cannons:ball_exploding", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2},
|
groups = {cracky=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = {
|
node_box = cannons.nodeboxes.ball,
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
|
||||||
|
|
||||||
-- side , top , side , side , bottom, side,
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--fire cannon ball
|
||||||
if cannons.enable_fire then
|
if cannons.enable_fire then
|
||||||
minetest.register_node("cannons:ball_fire", {
|
minetest.register_node("cannons:ball_fire", {
|
||||||
description = "Burning Cannon Ball",
|
description = "Burning Cannon Ball",
|
||||||
@ -397,23 +309,11 @@ minetest.register_node("cannons:ball_fire", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2},
|
groups = {cracky=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = {
|
node_box = cannons.nodeboxes.ball,
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
|
||||||
|
|
||||||
-- side , top , side , side , bottom, side,
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--ball wood stack
|
||||||
minetest.register_node("cannons:ball_wood_stack", {
|
minetest.register_node("cannons:ball_wood_stack", {
|
||||||
description = "Cannon Ball Wood Stack",
|
description = "Cannon Ball Wood Stack",
|
||||||
stack_max = 99,
|
stack_max = 99,
|
||||||
@ -424,24 +324,7 @@ minetest.register_node("cannons:ball_wood_stack", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2},
|
groups = {cracky=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = {
|
node_box = cannons.nodeboxes.ball_stack,
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.1, -0.2, 0.2, 0.3, 0.2}, -- ball top
|
|
||||||
{0.1, -0.5, -0.2, 0.2, -0.1, 0.2}, -- ball left
|
|
||||||
{0.5, -0.5, -0.2, 0.2, -0.1, 0.2}, -- ball left
|
|
||||||
{-0.2, -0.5, 0.5, 0.0, -0.1, 0.2},-- ball back
|
|
||||||
{0.0, -0.5, 0.1, -0.4, -0.1, 0.2},--ball back
|
|
||||||
{-0.2, -0.5, 0.5, -0.4, -0.1, 0.2},-- ball back
|
|
||||||
{-0.2, -0.5, 0.1, -0.4, -0.1, 0.2},-- ball back
|
|
||||||
{-0.2, -0.5, -0.1, -0.4, -0.1, -0.5},
|
|
||||||
{0.0, -0.5, -0.1, -0.4, -0.1, -0.5},
|
|
||||||
|
|
||||||
|
|
||||||
-- side , top , side , side , bottom, side,
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -450,7 +333,7 @@ minetest.register_node("cannons:ball_wood_stack", {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--ball stone stack
|
||||||
minetest.register_node("cannons:ball_stone_stack", {
|
minetest.register_node("cannons:ball_stone_stack", {
|
||||||
description = "Cannon Ball Stone Stack",
|
description = "Cannon Ball Stone Stack",
|
||||||
stack_max = 99,
|
stack_max = 99,
|
||||||
@ -461,24 +344,7 @@ minetest.register_node("cannons:ball_stone_stack", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2},
|
groups = {cracky=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = {
|
node_box = cannons.nodeboxes.ball_stack,
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.1, -0.2, 0.2, 0.3, 0.2}, -- ball top
|
|
||||||
{0.1, -0.5, -0.2, 0.2, -0.1, 0.2}, -- ball left
|
|
||||||
{0.5, -0.5, -0.2, 0.2, -0.1, 0.2}, -- ball left
|
|
||||||
{-0.2, -0.5, 0.5, 0.0, -0.1, 0.2},-- ball back
|
|
||||||
{0.0, -0.5, 0.1, -0.4, -0.1, 0.2},--ball back
|
|
||||||
{-0.2, -0.5, 0.5, -0.4, -0.1, 0.2},-- ball back
|
|
||||||
{-0.2, -0.5, 0.1, -0.4, -0.1, 0.2},-- ball back
|
|
||||||
{-0.2, -0.5, -0.1, -0.4, -0.1, -0.5},
|
|
||||||
{0.0, -0.5, -0.1, -0.4, -0.1, -0.5},
|
|
||||||
|
|
||||||
|
|
||||||
-- side , top , side , side , bottom, side,
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -487,6 +353,7 @@ minetest.register_node("cannons:ball_stone_stack", {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--ball steel stack
|
||||||
minetest.register_node("cannons:canon_ball_steel_stack", {
|
minetest.register_node("cannons:canon_ball_steel_stack", {
|
||||||
description = "Cannon Ball Steel Stack",
|
description = "Cannon Ball Steel Stack",
|
||||||
stack_max = 99,
|
stack_max = 99,
|
||||||
@ -497,24 +364,7 @@ minetest.register_node("cannons:canon_ball_steel_stack", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2},
|
groups = {cracky=2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = {
|
node_box = cannons.nodeboxes.ball_stack,
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.2, -0.1, -0.2, 0.2, 0.3, 0.2}, -- ball top
|
|
||||||
{0.1, -0.5, -0.2, 0.2, -0.1, 0.2}, -- ball left
|
|
||||||
{0.5, -0.5, -0.2, 0.2, -0.1, 0.2}, -- ball left
|
|
||||||
{-0.2, -0.5, 0.5, 0.0, -0.1, 0.2},-- ball back
|
|
||||||
{0.0, -0.5, 0.1, -0.4, -0.1, 0.2},--ball back
|
|
||||||
{-0.2, -0.5, 0.5, -0.4, -0.1, 0.2},-- ball back
|
|
||||||
{-0.2, -0.5, 0.1, -0.4, -0.1, 0.2},-- ball back
|
|
||||||
{-0.2, -0.5, -0.1, -0.4, -0.1, -0.5},
|
|
||||||
{0.0, -0.5, -0.1, -0.4, -0.1, -0.5},
|
|
||||||
|
|
||||||
|
|
||||||
-- side , top , side , side , bottom, side,
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
|
@ -12,9 +12,8 @@ minetest.register_node("cannons:shared_locked_cannon", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
sounds = cannons.sound_defaults(),
|
sounds = cannons.sound_defaults(),
|
||||||
node_box = cannons.nodebox,
|
node_box = cannons.nodeboxes.cannon,
|
||||||
on_place = cannons.on_place,
|
on_place = cannons.on_place,
|
||||||
selection_box = cannons.nodebox,
|
|
||||||
on_punch = cannons.punched,
|
on_punch = cannons.punched,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
locks:lock_handle_input( pos, formname, fields, sender );
|
locks:lock_handle_input( pos, formname, fields, sender );
|
||||||
|
Loading…
Reference in New Issue
Block a user