2013-10-12 12:24:24 +02:00
|
|
|
--++++++++++++++++++++++++++++++++++++
|
|
|
|
--+ Meseball +
|
|
|
|
--++++++++++++++++++++++++++++++++++++
|
2013-11-16 00:01:52 +01:00
|
|
|
local exploding={
|
2013-10-12 12:24:24 +02:00
|
|
|
physical = false,
|
|
|
|
timer=0,
|
|
|
|
textures = {"default_mese_block.png","default_mese_block.png","default_mese_block.png","default_mese_block.png","default_mese_block.png","default_mese_block.png"},
|
|
|
|
lastpos={},
|
|
|
|
damage=15,
|
|
|
|
visual = "cube",
|
|
|
|
visual_size = {x=0.5, y=0.5},
|
|
|
|
range=1,
|
|
|
|
gravity=10,
|
|
|
|
velocity=30,
|
|
|
|
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()
|
|
|
|
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)
|
2014-12-07 11:20:19 +01:00
|
|
|
cannons.nodehitparticles(pos,node)
|
2013-11-13 17:42:48 +01:00
|
|
|
cannons.destroy({x=pos.x, y=pos.y, z=pos.z},self.range)
|
|
|
|
minetest.sound_play("cannons_shot",
|
2013-10-12 12:24:24 +02:00
|
|
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
|
|
|
self.object:remove()
|
|
|
|
end,
|
|
|
|
|
|
|
|
}
|
2014-07-27 09:24:33 +02:00
|
|
|
if cannons.config:get("enable_explosion") == "true" then
|
2013-11-16 00:01:52 +01:00
|
|
|
cannons.register_muni("cannons:ball_exploding",exploding)
|
2013-10-12 12:24:24 +02:00
|
|
|
end
|
2013-11-16 00:01:52 +01:00
|
|
|
local fire={
|
2013-10-12 12:24:24 +02:00
|
|
|
physical = false,
|
|
|
|
timer=0,
|
|
|
|
textures = {"default_tree.png","default_tree.png","default_tree.png","default_tree.png","default_tree.png","default_tree.png"},
|
|
|
|
lastpos={},
|
|
|
|
damage=10,
|
|
|
|
visual = "cube",
|
|
|
|
visual_size = {x=0.5, y=0.5},
|
|
|
|
range=2,
|
|
|
|
gravity=8,
|
|
|
|
velocity=35,
|
|
|
|
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()
|
|
|
|
end,
|
|
|
|
on_mob_hit = function(self,pos,mob)
|
|
|
|
self.object:remove()
|
|
|
|
end,
|
|
|
|
on_node_hit = function(self,pos,node)
|
2014-12-07 11:20:19 +01:00
|
|
|
cannons.nodehitparticles(pos,node)
|
2013-10-12 12:24:24 +02:00
|
|
|
pos = self.lastpos
|
|
|
|
minetest.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="fire:basic_flame"})
|
|
|
|
minetest.sound_play("default_break_glass",
|
|
|
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
|
|
|
self.object:remove()
|
|
|
|
end,
|
|
|
|
|
|
|
|
}
|
2014-07-27 09:24:33 +02:00
|
|
|
if cannons.config:get("enable_fire")=="true" then
|
2013-11-16 00:01:52 +01:00
|
|
|
cannons.register_muni("cannons:ball_fire",fire)
|
2013-10-12 12:24:24 +02:00
|
|
|
end
|
2013-11-12 22:28:21 +01:00
|
|
|
|
|
|
|
--++++++++++++++++++++++++++++++++++++
|
2013-12-01 06:24:17 +01:00
|
|
|
--+ Wooden Cannon ball +
|
2013-11-12 22:28:21 +01:00
|
|
|
--++++++++++++++++++++++++++++++++++++
|
|
|
|
|
2013-12-05 22:38:03 +01:00
|
|
|
cannons.register_muni("cannons:ball_wood",{
|
2013-11-12 22:28:21 +01:00
|
|
|
physical = false,
|
|
|
|
timer=0,
|
2013-11-13 17:42:48 +01:00
|
|
|
textures = {"cannons_wood_bullet.png"},
|
2013-11-12 22:28:21 +01:00
|
|
|
lastpos={},
|
|
|
|
damage=20,
|
|
|
|
range=1,
|
|
|
|
gravity=10,
|
|
|
|
velocity=40,
|
|
|
|
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()
|
2013-11-13 17:42:48 +01:00
|
|
|
minetest.chat_send_all(playername .." tried to catch a cannonball")
|
2013-11-12 22:28:21 +01:00
|
|
|
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)
|
2014-12-07 11:20:19 +01:00
|
|
|
cannons.nodehitparticles(pos,node)
|
2013-11-12 22:28:21 +01:00
|
|
|
if node.name == "default:dirt_with_grass" then
|
|
|
|
minetest.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="default:dirt"})
|
2013-11-13 17:42:48 +01:00
|
|
|
minetest.sound_play("cannons_hit",
|
2013-11-12 22:28:21 +01:00
|
|
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
|
|
|
self.object:remove()
|
|
|
|
elseif node.name == "default:water_source" then
|
2013-11-13 17:42:48 +01:00
|
|
|
minetest.sound_play("cannons_splash",
|
2013-11-12 22:28:21 +01:00
|
|
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
|
|
|
self.object:remove()
|
|
|
|
else
|
2013-11-13 17:42:48 +01:00
|
|
|
minetest.sound_play("cannons_hit",
|
2013-11-12 22:28:21 +01:00
|
|
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
|
|
|
self.object:remove()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2013-12-05 22:38:03 +01:00
|
|
|
})
|
2013-11-12 22:28:21 +01:00
|
|
|
|
|
|
|
--++++++++++++++++++++++++++++++++++++
|
|
|
|
--+ Stone Cannon ball +
|
|
|
|
--++++++++++++++++++++++++++++++++++++
|
|
|
|
|
2013-12-05 22:38:03 +01:00
|
|
|
cannons.register_muni("cannons:ball_stone",{
|
2013-11-12 22:28:21 +01:00
|
|
|
physical = false,
|
|
|
|
timer=0,
|
2013-11-13 17:42:48 +01:00
|
|
|
textures = {"cannons_bullet.png"},
|
2013-11-12 22:28:21 +01:00
|
|
|
lastpos={},
|
|
|
|
damage=20,
|
|
|
|
range=2,
|
|
|
|
gravity=10,
|
|
|
|
velocity=40,
|
|
|
|
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()
|
2013-11-13 17:42:48 +01:00
|
|
|
minetest.chat_send_all(playername .." tried to catch a cannonball")
|
2013-11-12 22:28:21 +01:00
|
|
|
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)
|
2013-12-02 15:55:22 +01:00
|
|
|
cannons.nodehitparticles(pos,node)
|
2013-11-12 22:28:21 +01:00
|
|
|
if node.name == "default:dirt_with_grass" then
|
|
|
|
minetest.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="default:dirt"})
|
2013-11-13 17:42:48 +01:00
|
|
|
minetest.sound_play("cannons_hit",
|
2013-11-12 22:28:21 +01:00
|
|
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
|
|
|
self.object:remove()
|
|
|
|
elseif node.name == "default:water_source" then
|
2013-11-13 17:42:48 +01:00
|
|
|
minetest.sound_play("cannons_splash",
|
2013-11-12 22:28:21 +01:00
|
|
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
|
|
|
self.object:remove()
|
|
|
|
else
|
2013-11-13 17:42:48 +01:00
|
|
|
minetest.sound_play("cannons_hit",
|
2013-11-12 22:28:21 +01:00
|
|
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
|
|
|
self.object:remove()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2013-12-05 22:38:03 +01:00
|
|
|
})
|
2013-11-12 22:28:21 +01:00
|
|
|
|
|
|
|
--++++++++++++++++++++++++++++++++++++
|
|
|
|
--+ Steel Cannon ball +
|
|
|
|
--++++++++++++++++++++++++++++++++++++
|
|
|
|
|
2013-12-05 22:38:03 +01:00
|
|
|
cannons.register_muni("cannons:ball_steel",{
|
2013-11-12 22:28:21 +01:00
|
|
|
physical = false,
|
|
|
|
timer=0,
|
2013-11-13 17:42:48 +01:00
|
|
|
textures = {"cannons_bullet_iron.png"},
|
2013-11-12 22:28:21 +01:00
|
|
|
lastpos={},
|
|
|
|
damage=30,
|
|
|
|
range=2,
|
|
|
|
gravity=5,
|
|
|
|
velocity=50,
|
|
|
|
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)
|
2014-12-07 11:20:19 +01:00
|
|
|
cannons.nodehitparticles(pos,node)
|
2013-11-12 22:28:21 +01:00
|
|
|
if node.name == "default:dirt_with_grass" then
|
|
|
|
minetest.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="default:dirt"})
|
2013-11-13 17:42:48 +01:00
|
|
|
minetest.sound_play("cannons_hit",
|
2013-11-12 22:28:21 +01:00
|
|
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
|
|
|
self.object:remove()
|
|
|
|
elseif node.name == "default:water_source" then
|
2013-11-13 17:42:48 +01:00
|
|
|
minetest.sound_play("cannons_splash",
|
2013-11-12 22:28:21 +01:00
|
|
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
|
|
|
self.object:remove()
|
|
|
|
else
|
2013-11-13 17:42:48 +01:00
|
|
|
minetest.sound_play("cannons_hit",
|
2013-11-12 22:28:21 +01:00
|
|
|
{pos = pos, gain = 1.0, max_hear_distance = 32,})
|
|
|
|
self.object:remove()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2013-12-05 22:38:03 +01:00
|
|
|
})
|