Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ unused_args = false
max_line_length = false

globals = {
"minetest", "cannons"
"core", "cannons"
}

read_globals = {
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "cannons",
"description": "To shoot insert muni and gunpowder and punch the cannon with a torch.",
"description": "To shoot, insert munitions and gunpowder and punch the cannon with a torch.",
"keywords": [
"cannon",
"cannons",
"medieval",
"shoot"
],
"forum": "http://forum.minetest.net/viewtopic.php?f=11&t=7744",
"forum": "http://forum.luanti.org/viewtopic.php?f=11&t=7744",
"screenshots": [
"https://bitbucket.org/kingarthursteam/cannons/raw/master/screenshot.png",
"https://bitbucket.org/kingarthursteam/cannons/wiki/screenshots/screenshot_1531516.png",
Expand Down
36 changes: 18 additions & 18 deletions cannonballs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ local exploding={
on_node_hit = function(self,pos,node)
cannons.nodehitparticles(pos,node)
cannons.destroy({x=pos.x, y=pos.y, z=pos.z},self.range)
minetest.sound_play("cannons_shot",
core.sound_play("cannons_shot",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
self.object:remove()
end,
Expand Down Expand Up @@ -64,8 +64,8 @@ local fire={
on_node_hit = function(self,pos,node)
cannons.nodehitparticles(pos,node)
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",
core.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="fire:basic_flame"})
core.sound_play("default_break_glass",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
self.object:remove()
end,
Expand Down Expand Up @@ -96,7 +96,7 @@ cannons.register_muni("cannons:ball_wood_stack_1",{
damage_groups={fleshy=self.damage},
}, nil)
self.object:remove()
minetest.chat_send_all(playername .." tried to catch a cannonball")
core.chat_send_all(playername .." tried to catch a cannonball")
end,
on_mob_hit = function(self,pos,mob)
mob:punch(self.object, 1.0, {
Expand All @@ -108,16 +108,16 @@ cannons.register_muni("cannons:ball_wood_stack_1",{
on_node_hit = function(self,pos,node)
cannons.nodehitparticles(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("cannons_hit",
core.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="default:dirt"})
core.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("cannons_splash",
core.sound_play("cannons_splash",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
self.object:remove()
else
minetest.sound_play("cannons_hit",
core.sound_play("cannons_hit",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
self.object:remove()
end
Expand Down Expand Up @@ -146,7 +146,7 @@ cannons.register_muni("cannons:ball_stone_stack_1",{
damage_groups={fleshy=self.damage},
}, nil)
self.object:remove()
minetest.chat_send_all(playername .." tried to catch a cannonball")
core.chat_send_all(playername .." tried to catch a cannonball")
end,
on_mob_hit = function(self,pos,mob)
mob:punch(self.object, 1.0, {
Expand All @@ -158,16 +158,16 @@ cannons.register_muni("cannons:ball_stone_stack_1",{
on_node_hit = function(self,pos,node)
cannons.nodehitparticles(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("cannons_hit",
core.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="default:dirt"})
core.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("cannons_splash",
core.sound_play("cannons_splash",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
self.object:remove()
else
minetest.sound_play("cannons_hit",
core.sound_play("cannons_hit",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
self.object:remove()
end
Expand Down Expand Up @@ -196,7 +196,7 @@ cannons.register_muni("cannons:ball_steel_stack_1",{
damage_groups={fleshy=self.damage},
}, nil)
self.object:remove()
minetest.chat_send_all(playername .." tried to catch a canonball")
core.chat_send_all(playername .." tried to catch a canonball")
end,
on_mob_hit = function(self,pos,mob)
mob:punch(self.object, 1.0, {
Expand All @@ -208,16 +208,16 @@ cannons.register_muni("cannons:ball_steel_stack_1",{
on_node_hit = function(self,pos,node)
cannons.nodehitparticles(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("cannons_hit",
core.env:set_node({x=pos.x, y=pos.y, z=pos.z},{name="default:dirt"})
core.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("cannons_splash",
core.sound_play("cannons_splash",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
self.object:remove()
else
minetest.sound_play("cannons_hit",
core.sound_play("cannons_hit",
{pos = pos, gain = 1.0, max_hear_distance = 32,})
self.object:remove()
end
Expand Down
22 changes: 11 additions & 11 deletions convert.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
minetest.register_abm({
core.register_abm({
nodenames = {"cannons:cannon","cannons:bronze_canon","cannons:mithril_cannon"},
--neighbors = {"cannons:stand","cannons.stand_wood"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local stand_pos = {x= pos.x,y= pos.y-1,z=pos.z}
local stand = minetest.get_node(stand_pos)
local stand = core.get_node(stand_pos)
if stand.name == "cannons:stand" or stand.name == "cannons:stand_wood" then -- cannon stand with cannon
if stand.name == "cannons:stand" then
minetest.set_node(stand_pos, {name = "default:cobble"})--replace stand with cobblestone
core.set_node(stand_pos, {name = "default:cobble"})--replace stand with cobblestone
else
minetest.set_node(stand_pos, {name = "default:wood"})--replace stand with cobblestone
core.set_node(stand_pos, {name = "default:wood"})--replace stand with cobblestone
end
if node.name == "cannons:cannon" then
node.name = "cannons:wood_stand_with_cannon_steel"
Expand All @@ -24,7 +24,7 @@ minetest.register_abm({
node.name = "air"
end

minetest.swap_node(pos, node)
core.swap_node(pos, node)

else --else its a single or disabled cannon
print("zweite if")
Expand All @@ -39,28 +39,28 @@ minetest.register_abm({
else --dont know what else can happen, but "Der Teufel ist ein Eichh�rnchen"
node.name = "air"
end
minetest.swap_node(pos, node)
core.swap_node(pos, node)
end
end,
})

--abm to convert single cannonstands
minetest.register_abm({
core.register_abm({
nodenames = {"cannons:stand","cannons:stand_wood"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local above_pos = {x= pos.x,y= pos.y+1,z=pos.z}
local above = minetest.get_node(above_pos)
local above = core.get_node(above_pos)
--if above the stand a cannon...
if above.name == "air" then
minetest.set_node(above_pos, {name = "cannons:wood_stand"})
core.set_node(above_pos, {name = "cannons:wood_stand"})
else
--replace single stands with a full block, and place the stand above it
if node.name == "cannons:stand" then
minetest.set_node(pos, {name = "default:cobble"})--replace stand with cobblestone
core.set_node(pos, {name = "default:cobble"})--replace stand with cobblestone
else
minetest.set_node(pos, {name = "default:wood"})--replace stand with cobblestone
core.set_node(pos, {name = "default:wood"})--replace stand with cobblestone
end
end
end,
Expand Down
6 changes: 0 additions & 6 deletions depends.txt

This file was deleted.

3 changes: 0 additions & 3 deletions description.txt

This file was deleted.

Loading
Loading