renamed mod into cannons
@ -1,54 +1,3 @@
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
--+ Stoneball +
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
local stone={
|
||||
physical = false,
|
||||
timer=0,
|
||||
textures = {"canons_bullet.png"},
|
||||
lastpos={},
|
||||
damage=20,
|
||||
range=2,
|
||||
gravity=10,
|
||||
velocity=40,
|
||||
name="canons:stone_bullet",
|
||||
collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25},
|
||||
on_player_hit = function(self,pos,player)
|
||||
local playername = player:get_player_name()
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=self.damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
minetest.chat_send_all(playername .." tried to catch a canonball")
|
||||
end,
|
||||
on_mob_hit = function(self,pos,mob)
|
||||
mob:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=self.damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
end,
|
||||
on_node_hit = function(self,pos,node)
|
||||
if node.name == "default:dirt_with_grass" then
|
||||
minetest.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="default:dirt"})
|
||||
minetest.sound_play("canons_hit",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
elseif node.name == "default:water_source" then
|
||||
minetest.sound_play("canons_splash",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
else
|
||||
minetest.sound_play("canons_hit",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
|
||||
}
|
||||
canons.register_muni("default:stone",stone)
|
||||
|
||||
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
--+ Meseball +
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
@ -63,7 +12,7 @@ local mese={
|
||||
range=1,
|
||||
gravity=10,
|
||||
velocity=30,
|
||||
name="canons:mese",
|
||||
name="cannons:mese_bullet",
|
||||
collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25},
|
||||
on_player_hit = function(self,pos,player)
|
||||
local playername = player:get_player_name()
|
||||
@ -81,15 +30,15 @@ local mese={
|
||||
self.object:remove()
|
||||
end,
|
||||
on_node_hit = function(self,pos,node)
|
||||
canons.destroy({x=pos.x, y=pos.y, z=pos.z},self.range)
|
||||
minetest.sound_play("canons_shot",
|
||||
cannons.destroy({x=pos.x, y=pos.y, z=pos.z},self.range)
|
||||
minetest.sound_play("cannons_shot",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
end,
|
||||
|
||||
}
|
||||
if enable_explosion then
|
||||
canons.register_muni("default:mese",mese)
|
||||
if cannons.enable_explosion then
|
||||
cannons.register_muni("default:mese",mese)
|
||||
end
|
||||
|
||||
local tree={
|
||||
@ -103,7 +52,7 @@ local tree={
|
||||
range=2,
|
||||
gravity=8,
|
||||
velocity=35,
|
||||
name="canons:tree",
|
||||
name="cannons:tree_bullet",
|
||||
collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25},
|
||||
on_player_hit = function(self,pos,player)
|
||||
local playername = player:get_player_name()
|
||||
@ -125,8 +74,8 @@ local tree={
|
||||
end,
|
||||
|
||||
}
|
||||
if enable_fire then
|
||||
canons.register_muni("default:tree",tree)
|
||||
if cannons.enable_fire then
|
||||
cannons.register_muni("default:tree",tree)
|
||||
end
|
||||
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
@ -137,13 +86,13 @@ end
|
||||
local ball_wood={
|
||||
physical = false,
|
||||
timer=0,
|
||||
textures = {"canons_bullet.png"},
|
||||
textures = {"cannons_wood_bullet.png"},
|
||||
lastpos={},
|
||||
damage=20,
|
||||
range=1,
|
||||
gravity=10,
|
||||
velocity=40,
|
||||
name="canons:stone_bullet",
|
||||
name="cannons:wood_bullet",
|
||||
collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25},
|
||||
on_player_hit = function(self,pos,player)
|
||||
local playername = player:get_player_name()
|
||||
@ -152,7 +101,7 @@ local ball_wood={
|
||||
damage_groups={fleshy=self.damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
minetest.chat_send_all(playername .." tried to catch a canonball")
|
||||
minetest.chat_send_all(playername .." tried to catch a cannonball")
|
||||
end,
|
||||
on_mob_hit = function(self,pos,mob)
|
||||
mob:punch(self.object, 1.0, {
|
||||
@ -164,22 +113,22 @@ local ball_wood={
|
||||
on_node_hit = function(self,pos,node)
|
||||
if node.name == "default:dirt_with_grass" then
|
||||
minetest.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="default:dirt"})
|
||||
minetest.sound_play("canons_hit",
|
||||
minetest.sound_play("cannons_hit",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
elseif node.name == "default:water_source" then
|
||||
minetest.sound_play("canons_splash",
|
||||
minetest.sound_play("cannons_splash",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
else
|
||||
minetest.sound_play("canons_hit",
|
||||
minetest.sound_play("cannons_hit",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
|
||||
}
|
||||
canons.register_muni("canons:canon_ball_wood",ball_wood)
|
||||
cannons.register_muni("cannons:ball_wood",ball_wood)
|
||||
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
--+ Stone Cannon ball +
|
||||
@ -189,13 +138,13 @@ canons.register_muni("canons:canon_ball_wood",ball_wood)
|
||||
local ball_stone={
|
||||
physical = false,
|
||||
timer=0,
|
||||
textures = {"canons_bullet.png"},
|
||||
textures = {"cannons_bullet.png"},
|
||||
lastpos={},
|
||||
damage=20,
|
||||
range=2,
|
||||
gravity=10,
|
||||
velocity=40,
|
||||
name="canons:stone_bullet",
|
||||
name="cannons:stone_bullet",
|
||||
collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25},
|
||||
on_player_hit = function(self,pos,player)
|
||||
local playername = player:get_player_name()
|
||||
@ -204,7 +153,7 @@ local ball_stone={
|
||||
damage_groups={fleshy=self.damage},
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
minetest.chat_send_all(playername .." tried to catch a canonball")
|
||||
minetest.chat_send_all(playername .." tried to catch a cannonball")
|
||||
end,
|
||||
on_mob_hit = function(self,pos,mob)
|
||||
mob:punch(self.object, 1.0, {
|
||||
@ -216,22 +165,22 @@ local ball_stone={
|
||||
on_node_hit = function(self,pos,node)
|
||||
if node.name == "default:dirt_with_grass" then
|
||||
minetest.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="default:dirt"})
|
||||
minetest.sound_play("canons_hit",
|
||||
minetest.sound_play("cannons_hit",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
elseif node.name == "default:water_source" then
|
||||
minetest.sound_play("canons_splash",
|
||||
minetest.sound_play("cannons_splash",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
else
|
||||
minetest.sound_play("canons_hit",
|
||||
minetest.sound_play("cannons_hit",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
|
||||
}
|
||||
canons.register_muni("canons:canon_ball_stone",ball_stone)
|
||||
cannons.register_muni("cannons:ball_stone",ball_stone)
|
||||
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
--+ Steel Cannon ball +
|
||||
@ -241,13 +190,13 @@ canons.register_muni("canons:canon_ball_stone",ball_stone)
|
||||
local ball_steel={
|
||||
physical = false,
|
||||
timer=0,
|
||||
textures = {"canons_bullet_iron.png"},
|
||||
textures = {"cannons_bullet_iron.png"},
|
||||
lastpos={},
|
||||
damage=30,
|
||||
range=2,
|
||||
gravity=5,
|
||||
velocity=50,
|
||||
name="canons:stone_bullet",
|
||||
name="cannons:iron_bullet",
|
||||
collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25},
|
||||
on_player_hit = function(self,pos,player)
|
||||
local playername = player:get_player_name()
|
||||
@ -268,19 +217,19 @@ local ball_steel={
|
||||
on_node_hit = function(self,pos,node)
|
||||
if node.name == "default:dirt_with_grass" then
|
||||
minetest.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="default:dirt"})
|
||||
minetest.sound_play("canons_hit",
|
||||
minetest.sound_play("cannons_hit",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
elseif node.name == "default:water_source" then
|
||||
minetest.sound_play("canons_splash",
|
||||
minetest.sound_play("cannons_splash",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
else
|
||||
minetest.sound_play("canons_hit",
|
||||
minetest.sound_play("cannons_hit",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
|
||||
}
|
||||
canons.register_muni("canons:canon_ball_steel",ball_steel)
|
||||
cannons.register_muni("cannons:ball_steel",ball_steel)
|
@ -1,5 +1,5 @@
|
||||
|
||||
function canons.destroy(pos,range)
|
||||
function cannons.destroy(pos,range)
|
||||
for x=-range,range do
|
||||
for y=-range,range do
|
||||
for z=-range,range do
|
||||
@ -15,7 +15,7 @@ function canons.destroy(pos,range)
|
||||
end
|
||||
end
|
||||
|
||||
function canons.inventory_modified(pos)
|
||||
function cannons.inventory_modified(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack("muni", 1)
|
||||
@ -23,75 +23,75 @@ function canons.inventory_modified(pos)
|
||||
if muni == nil then
|
||||
muni = false
|
||||
else
|
||||
muni = canons.is_muni(muni.name)
|
||||
muni = cannons.is_muni(muni.name)
|
||||
end
|
||||
|
||||
local gunpowder = inv:contains_item("gunpowder","canons:gunpowder 1")
|
||||
local gunpowder = inv:contains_item("gunpowder","cannons:gunpowder 1")
|
||||
if not muni and not gunpowder then
|
||||
meta:set_string("infotext","Canon has no muni and no gunpowder")
|
||||
meta:set_string("infotext","Cannon has no muni and no gunpowder")
|
||||
|
||||
elseif not muni then
|
||||
meta:set_string("infotext","Canon has no muni")
|
||||
meta:set_string("infotext","Cannon has no muni")
|
||||
|
||||
elseif not gunpowder then
|
||||
meta:set_string("infotext","Canon has no gunpowder")
|
||||
meta:set_string("infotext","Cannon has no gunpowder")
|
||||
|
||||
else
|
||||
meta:set_string("infotext","Canon is ready")
|
||||
meta:set_string("infotext","Cannon is ready")
|
||||
end
|
||||
end
|
||||
|
||||
canons.allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
cannons.allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
stack = stack:to_table()
|
||||
if listname == "gunpowder" and stack.name == "canons:gunpowder" then
|
||||
if listname == "gunpowder" and stack.name == "cannons:gunpowder" then
|
||||
return stack.count
|
||||
elseif listname == "muni" and canons.is_muni(stack.name) then
|
||||
elseif listname == "muni" and cannons.is_muni(stack.name) then
|
||||
return stack.count
|
||||
else return 0
|
||||
end
|
||||
|
||||
end
|
||||
canons.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 inv = meta:get_inventory()
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
stack = stack:to_table()
|
||||
if to_list == "gunpowder" and stack.name == "canons:gunpowder" then
|
||||
if to_list == "gunpowder" and stack.name == "cannons:gunpowder" then
|
||||
return count
|
||||
|
||||
elseif to_list == "muni" and canons.is_muni(stack.name) then
|
||||
elseif to_list == "muni" and cannons.is_muni(stack.name) then
|
||||
return count
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
canons.formspec =
|
||||
cannons.formspec =
|
||||
"size[8,9]"..
|
||||
"list[current_name;muni;2,1;1,1;] label[2,0.5;Muni:]"..
|
||||
"list[current_name;gunpowder;2,3;1,1;] label[2,2.5;Gunpowder:]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
canons.disabled_formspec =
|
||||
cannons.disabled_formspec =
|
||||
"size[8,9]"..
|
||||
"label[2,0.5;Canon is Disabled. Place it on a canonstand to activate it]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
canons.on_construct = function(pos)
|
||||
cannons.on_construct = function(pos)
|
||||
local node = minetest.get_node({x = pos.x ,y = pos.y-1, z = pos.z})
|
||||
if node.name == "canons:canon_stand" then
|
||||
if node.name == "cannons:stand" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", canons.formspec)
|
||||
meta:set_string("formspec", cannons.formspec)
|
||||
meta:set_string("infotext", "Canon has no muni and no gunpowder")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("gunpowder", 1)
|
||||
inv:set_size("muni", 1)
|
||||
else
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", canons.disabled_formspec)
|
||||
meta:set_string("formspec", cannons.disabled_formspec)
|
||||
meta:set_string("infotext", "Canon is out of Order")
|
||||
end
|
||||
end
|
||||
canons.nodebox = {
|
||||
cannons.nodebox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.2, 0.2, -0.7, 0.2, -0.2, 0.9}, -- barrle --
|
||||
@ -101,7 +101,7 @@ canons.nodebox = {
|
||||
|
||||
}
|
||||
}
|
||||
canons.stand_nodebox = {
|
||||
cannons.stand_nodebox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, -- bottom --
|
||||
@ -114,34 +114,34 @@ canons.stand_nodebox = {
|
||||
|
||||
},
|
||||
}
|
||||
function canons.fire(pos,node,puncher)
|
||||
function cannons.fire(pos,node,puncher)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack("muni", 1)
|
||||
local muni = stack:to_table()
|
||||
if inv:contains_item("gunpowder","canons:gunpowder 1")
|
||||
if inv:contains_item("gunpowder","cannons:gunpowder 1")
|
||||
and muni ~= nil
|
||||
and canons.is_muni(muni.name)
|
||||
and cannons.is_muni(muni.name)
|
||||
and inv:contains_item("muni",muni.name.." 1")
|
||||
|
||||
then
|
||||
minetest.sound_play("canons_shot",
|
||||
minetest.sound_play("cannons_shot",
|
||||
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
||||
|
||||
|
||||
inv:remove_item("muni", muni.name.." 1")
|
||||
inv:remove_item("gunpowder", "canons:gunpowder 1")
|
||||
canons.inventory_modified(pos)
|
||||
local settings = canons.get_settings(muni.name)
|
||||
inv:remove_item("gunpowder", "cannons:gunpowder 1")
|
||||
cannons.inventory_modified(pos)
|
||||
local settings = cannons.get_settings(muni.name)
|
||||
local playerpos=puncher:getpos()
|
||||
local obj=minetest.env:add_entity(pos, canons.get_entity(muni.name))
|
||||
local obj=minetest.env:add_entity(pos, cannons.get_entity(muni.name))
|
||||
local dir=puncher:get_look_dir()
|
||||
obj:setvelocity({x=dir.x*settings.velocity, y=-1, z=dir.z*settings.velocity})
|
||||
obj:setacceleration({x=dir.x*-3, y=-settings.gravity, z=dir.z*-3})
|
||||
end
|
||||
end
|
||||
|
||||
function canons.punched(pos, node, puncher)
|
||||
function cannons.punched(pos, node, puncher)
|
||||
if not puncher or not node then
|
||||
return
|
||||
end
|
||||
@ -151,20 +151,20 @@ function canons.punched(pos, node, puncher)
|
||||
end
|
||||
wield = wield:get_name()
|
||||
if wield and wield == 'default:torch' then
|
||||
canons.fire(pos,node,puncher)
|
||||
cannons.fire(pos,node,puncher)
|
||||
end
|
||||
end
|
||||
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
--+ canons.register_muni +
|
||||
--+ cannons.register_muni +
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
|
||||
canons.registered_muni = {}
|
||||
cannons.registered_muni = {}
|
||||
|
||||
function canons.register_muni(node,entity)
|
||||
canons.registered_muni[node] = {}
|
||||
canons.registered_muni[node].entity = entity
|
||||
canons.registered_muni[node].entity.on_step = function(self, dtime)
|
||||
function cannons.register_muni(node,entity)
|
||||
cannons.registered_muni[node] = {}
|
||||
cannons.registered_muni[node].entity = entity
|
||||
cannons.registered_muni[node].entity.on_step = function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
--pr(self.timer,"Timer")
|
||||
if self.timer >= 0.3 then --easiesst less laggiest way to find out that it left his start position
|
||||
@ -190,18 +190,18 @@ function canons.register_muni(node,entity)
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
end
|
||||
end
|
||||
canons.registered_muni[node].obj = entity.name
|
||||
minetest.register_entity(entity.name, canons.registered_muni[node].entity)
|
||||
cannons.registered_muni[node].obj = entity.name
|
||||
minetest.register_entity(entity.name, cannons.registered_muni[node].entity)
|
||||
end
|
||||
|
||||
function canons.is_muni(node)
|
||||
return canons.registered_muni[node] ~= nil
|
||||
function cannons.is_muni(node)
|
||||
return cannons.registered_muni[node] ~= nil
|
||||
end
|
||||
function canons.get_entity(node)
|
||||
return canons.registered_muni[node].obj
|
||||
function cannons.get_entity(node)
|
||||
return cannons.registered_muni[node].obj
|
||||
end
|
||||
function canons.get_settings(node)
|
||||
return canons.registered_muni[node].entity
|
||||
function cannons.get_settings(node)
|
||||
return cannons.registered_muni[node].entity
|
||||
end
|
||||
|
||||
local apple={
|
||||
@ -213,7 +213,7 @@ local apple={
|
||||
range=2,
|
||||
gravity=10,
|
||||
velocity=30,
|
||||
name="canons:apple",
|
||||
name="cannons:apple",
|
||||
collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25},
|
||||
on_player_hit = function(self,pos,player)
|
||||
local playername = player:get_player_name()
|
||||
@ -236,4 +236,4 @@ local apple={
|
||||
end,
|
||||
|
||||
}
|
||||
canons.register_muni("default:apple",apple)
|
||||
cannons.register_muni("default:apple",apple)
|
6
init.lua
@ -1,17 +1,15 @@
|
||||
|
||||
|
||||
|
||||
canons = {}
|
||||
cannons = {}
|
||||
local MODPATH = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
enable_fire = canons.enable_fire
|
||||
enable_explosion = canons.enable_explosion
|
||||
|
||||
dofile(MODPATH .."/settings.txt")
|
||||
dofile(MODPATH .."/print_r.lua")
|
||||
dofile(MODPATH .."/functions.lua")
|
||||
dofile(MODPATH .."/items.lua")
|
||||
dofile(MODPATH .."/canonballs.lua")
|
||||
dofile(MODPATH .."/cannonballs.lua")
|
||||
|
||||
|
||||
minetest.log("action", "[MOD]"..minetest.get_current_modname().." -- loaded from "..minetest.get_modpath(minetest.get_current_modname()))
|
||||
|
130
items.lua
@ -2,57 +2,51 @@
|
||||
--+ Craft Items +
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
|
||||
minetest.register_craftitem("canons:gunpowder", {
|
||||
minetest.register_craftitem("cannons:gunpowder", {
|
||||
groups = {gunpowder=1},
|
||||
description = "Gunpowder",
|
||||
inventory_image = "canons_gunpowder.png"
|
||||
inventory_image = "cannons_gunpowder.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("canons:salt", {
|
||||
minetest.register_craftitem("cannons:salt", {
|
||||
description = "Salt",
|
||||
inventory_image = "canons_salt.png"
|
||||
inventory_image = "cannons_salt.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("canons:bucket_salt", {
|
||||
minetest.register_craftitem("cannons:bucket_salt", {
|
||||
description = "Bucket with salt",
|
||||
inventory_image = "canons_bucket_salt.png",
|
||||
inventory_image = "cannons_bucket_salt.png",
|
||||
stack_max = 300
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem("canons:stone_bullet", {
|
||||
Description = "Stone Bullet",
|
||||
inventory_image = "canons_bullet.png"
|
||||
})
|
||||
|
||||
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
--+ crafts +
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'canons:salt 12',
|
||||
output = 'cannons:salt 12',
|
||||
recipe = {
|
||||
"canons:bucket_salt"
|
||||
"cannons:bucket_salt"
|
||||
},
|
||||
replacements = {
|
||||
{"canons:bucket_salt", "bucket:bucket_empty"}
|
||||
{"cannons:bucket_salt", "bucket:bucket_empty"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = 'canons:bucket_salt',
|
||||
output = 'cannons:bucket_salt',
|
||||
recipe = 'bucket:bucket_water',
|
||||
cooktime = 15
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'canons:gunpowder',
|
||||
output = 'cannons:gunpowder',
|
||||
recipe = {
|
||||
"default:coal_lump", "default:mese_crystal", "canons:salt"
|
||||
"default:coal_lump", "default:mese_crystal", "cannons:salt"
|
||||
},
|
||||
})
|
||||
|
||||
@ -60,25 +54,25 @@ minetest.register_craft({
|
||||
-- new crafts --
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'canons:canon',
|
||||
output = 'cannons:cannon',
|
||||
recipe = {
|
||||
{"default:steelblock", "default:steelblock", "default:steelblock"},
|
||||
{"canons:gunpowder", "default:mese_block", ""},
|
||||
{"cannons:gunpowder", "default:mese_block", ""},
|
||||
{"default:steelblock", "default:steelblock", "default:steelblock"}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'canons:bronze_canon',
|
||||
output = 'cannons:bronze_canon',
|
||||
recipe = {
|
||||
{"default:bronzeblock", "default:bronzeblock", "default:bronzeblock"},
|
||||
{"canons:gunpowder", "default:mese_block", ""},
|
||||
{"cannons:gunpowder", "default:mese_block", ""},
|
||||
{"default:bronzeblock", "default:bronzeblock", "default:bronzeblock"}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'canons:canon_stand',
|
||||
output = 'cannons:stand',
|
||||
recipe = {
|
||||
{"default:wood", "", "default:wood"},
|
||||
{"default:wood", "default:steelblock", "default:wood"},
|
||||
@ -88,72 +82,70 @@ minetest.register_craft({
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'canons:canon_ball_steel_stack',
|
||||
output = 'cannons:ball_steel_stack',
|
||||
recipe = {
|
||||
"canons:canon_ball_steel", "canons:canon_ball_steel", "canons:canon_ball_steel", "canons:canon_ball_steel"
|
||||
"cannons:canon_ball_steel", "cannons:canon_ball_steel", "cannons:canon_ball_steel", "cannons:canon_ball_steel"
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'canons:canon_ball_stone_stack',
|
||||
output = 'cannons:ball_stone_stack',
|
||||
recipe = {
|
||||
"canons:canon_ball_stone", "canons:canon_ball_stone", "canons:canon_ball_stone", "canons:canon_ball_stone"
|
||||
"cannons:canon_ball_stone", "cannons:canon_ball_stone", "cannons:canon_ball_stone", "cannons:canon_ball_stone"
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'canons:canon_ball_wood_stack',
|
||||
output = 'cannons:ball_wood_stack',
|
||||
recipe = {
|
||||
"canons:canon_ball_wood", "canons:canon_ball_wood", "canons:canon_ball_wood", "canons:canon_ball_wood"
|
||||
"cannons:canon_ball_wood", "cannons:canon_ball_wood", "cannons:canon_ball_wood", "cannons:canon_ball_wood"
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'canons:canon_ball_wood 2',
|
||||
output = 'cannons:ball_wood 2',
|
||||
recipe = {
|
||||
{"default:wood","default:wood"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'canons:canon_ball_stone',
|
||||
output = 'cannons:ball_stone',
|
||||
recipe = {
|
||||
{"default:stone"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'canons:canon_ball_steel',
|
||||
output = 'cannons:ball_steel',
|
||||
recipe = {
|
||||
{"default:steelblock"}
|
||||
},
|
||||
})
|
||||
|
||||
-- silly crafts --
|
||||
|
||||
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
--+ cannon stuff +
|
||||
--++++++++++++++++++++++++++++++++++++
|
||||
|
||||
-- classic cannon --
|
||||
minetest.register_node("canons:canon", {
|
||||
minetest.register_node("cannons:cannon", {
|
||||
description = "Cannon",
|
||||
stack_max = 1,
|
||||
tiles = {"cannon_cannon_top.png","cannon_cannon_top.png","cannon_cannon_side.png","cannon_cannon_side.png","cannon_cannon_top.png^canons_canons_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",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = canons.nodebox,
|
||||
on_place = canons.on_place,
|
||||
selection_box = canons.nodebox,
|
||||
on_punch = canons.punched,
|
||||
on_construct = canons.on_construct,
|
||||
node_box = cannons.nodebox,
|
||||
on_place = cannons.on_place,
|
||||
selection_box = cannons.nodebox,
|
||||
on_punch = cannons.punched,
|
||||
on_construct = cannons.on_construct,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
@ -165,33 +157,33 @@ minetest.register_node("canons:canon", {
|
||||
return true
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_put = canons.allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_put = cannons.allow_metadata_inventory_put,
|
||||
|
||||
allow_metadata_inventory_move = canons.allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_move = cannons.allow_metadata_inventory_move,
|
||||
|
||||
on_metadata_inventory_put = canons.inventory_modified,
|
||||
on_metadata_inventory_put = cannons.inventory_modified,
|
||||
|
||||
on_metadata_inventory_take = canons.inventory_modified,
|
||||
on_metadata_inventory_take = cannons.inventory_modified,
|
||||
|
||||
on_metadata_inventory_move = canons.inventory_modified,
|
||||
on_metadata_inventory_move = cannons.inventory_modified,
|
||||
|
||||
})
|
||||
|
||||
-- bronze cannon --
|
||||
minetest.register_node("canons:bronze_canon", {
|
||||
minetest.register_node("cannons:bronze_canon", {
|
||||
description = "Cannon (bronze)",
|
||||
stack_max = 1,
|
||||
tiles = {"cannon_bronze_cannon_top.png","cannon_bronze_cannon_top.png","cannon_bronze_cannon_side.png","cannon_bronze_cannon_side.png","cannon_bronze_cannon_top.png^canons_canons_rim.png","cannon_bronze_cannon_side.png"},
|
||||
tiles = {"cannon_bronze_cannon_top.png","cannon_bronze_cannon_top.png","cannon_bronze_cannon_side.png","cannon_bronze_cannon_side.png","cannon_bronze_cannon_top.png^cannons_rim.png","cannon_bronze_cannon_side.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = canons.nodebox,
|
||||
selection_box = canons.nodebox,
|
||||
on_punch = canons.punched,
|
||||
on_construct = canons.on_construct,
|
||||
node_box = cannons.nodebox,
|
||||
selection_box = cannons.nodebox,
|
||||
on_punch = cannons.punched,
|
||||
on_construct = cannons.on_construct,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
@ -203,29 +195,29 @@ minetest.register_node("canons:bronze_canon", {
|
||||
return true
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_put = canons.allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_put = cannons.allow_metadata_inventory_put,
|
||||
|
||||
allow_metadata_inventory_move = canons.allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_move = cannons.allow_metadata_inventory_move,
|
||||
|
||||
on_metadata_inventory_put = canons.inventory_modified,
|
||||
on_metadata_inventory_put = cannons.inventory_modified,
|
||||
|
||||
on_metadata_inventory_take = canons.inventory_modified,
|
||||
on_metadata_inventory_take = cannons.inventory_modified,
|
||||
|
||||
on_metadata_inventory_move = canons.inventory_modified,
|
||||
on_metadata_inventory_move = cannons.inventory_modified,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_node("canons:canon_stand", {
|
||||
minetest.register_node("cannons:stand", {
|
||||
description = "Cannon Stand",
|
||||
stack_max = 99,
|
||||
tiles = {"default_junglewood.png","default_junglewood.png^canons_canons_rim.png","default_junglewood.png^canons_canons_rim.png","default_junglewood.png^canons_canons_rim.png","default_cobble.png","default_junglewood.png^canons_canons_rim.png"},
|
||||
tiles = {"default_junglewood.png","default_junglewood.png^cannons_rim.png","default_junglewood.png^cannons_rim.png","default_junglewood.png^cannons_rim.png","default_cobble.png","default_junglewood.png^cannons_rim.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {cracky=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = canons.stand_nodebox,
|
||||
node_box = cannons.stand_nodebox,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
@ -233,7 +225,7 @@ minetest.register_node("canons:canon_stand", {
|
||||
},
|
||||
}
|
||||
})
|
||||
minetest.register_node("canons:canon_ball_wood", {
|
||||
minetest.register_node("cannons:ball_wood", {
|
||||
description = "Cannon Ball Wood",
|
||||
stack_max = 99,
|
||||
tiles = {"default_wood.png"},
|
||||
@ -260,7 +252,7 @@ minetest.register_node("canons:canon_ball_wood", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("canons:canon_ball_stone", {
|
||||
minetest.register_node("cannons:ball_stone", {
|
||||
description = "Cannon Ball Stone",
|
||||
stack_max = 99,
|
||||
tiles = {"default_stone.png"},
|
||||
@ -287,7 +279,7 @@ minetest.register_node("canons:canon_ball_stone", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("canons:canon_ball_steel", {
|
||||
minetest.register_node("cannons:ball_steel", {
|
||||
description = "Cannon Ball Steel",
|
||||
stack_max = 99,
|
||||
tiles = {"cannon_cannon_top.png"},
|
||||
@ -314,12 +306,12 @@ minetest.register_node("canons:canon_ball_steel", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("canons:canon_ball_wood_stack", {
|
||||
minetest.register_node("cannons:ball_wood_stack", {
|
||||
description = "Cannon Ball Wood Stack",
|
||||
stack_max = 99,
|
||||
tiles = {"default_wood.png"},
|
||||
drawtype = "nodebox",
|
||||
drop = 'canons:canon_ball_wood 4',
|
||||
drop = 'cannons:ball_wood 4',
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
@ -352,12 +344,12 @@ minetest.register_node("canons:canon_ball_wood_stack", {
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("canons:canon_ball_stone_stack", {
|
||||
minetest.register_node("cannons:ball_stone_stack", {
|
||||
description = "Cannon Ball Stone Stack",
|
||||
stack_max = 99,
|
||||
tiles = {"default_stone.png"},
|
||||
drawtype = "nodebox",
|
||||
drop = 'canons:canon_ball_stone 4',
|
||||
drop = 'cannons:ball_stone 4',
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
@ -389,12 +381,12 @@ minetest.register_node("canons:canon_ball_stone_stack", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("canons:canon_ball_steel_stack", {
|
||||
minetest.register_node("cannons:canon_ball_steel_stack", {
|
||||
description = "Cannon Ball Steel Stack",
|
||||
stack_max = 99,
|
||||
tiles = {"cannon_cannon_top.png"},
|
||||
drawtype = "nodebox",
|
||||
drop = 'canons:canon_ball_steel 4',
|
||||
drop = 'cannons:ball_steel 4',
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
|
@ -1,7 +1,7 @@
|
||||
canons_splash.1.ogg
|
||||
canons_splash.2.ogg
|
||||
canons_splash.3.ogg
|
||||
canons_splash.4.ogg
|
||||
cannons_splash.1.ogg
|
||||
cannons_splash.2.ogg
|
||||
cannons_splash.3.ogg
|
||||
cannons_splash.4.ogg
|
||||
|
||||
License: Public Domain
|
||||
source: http://www.mediacollege.com/downloads/sound-effects/water/
|
@ -9,8 +9,8 @@
|
||||
|
||||
-- enable/disable the muni wich makes things burning if it hit them.
|
||||
-- if you want to dissable it just set it to false:
|
||||
canons.enable_fire = true
|
||||
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:
|
||||
canons.enable_explosion = true
|
||||
cannons.enable_explosion = true
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 372 B |
Before Width: | Height: | Size: 420 B After Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 420 B After Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 336 B |
Before Width: | Height: | Size: 651 B After Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 504 B |