New Sounds, Flame Ammo, Bug Fixes

master
Ricky 2013-01-10 19:09:38 +01:00
parent e749f67b0d
commit eb4ea406a5
36 changed files with 125 additions and 12 deletions

View File

@ -94,6 +94,19 @@ recipe = {
{'', 'lulzpack:obsidian_bucket_meltediron', ''},
}
```
### Flame Ammunition (cannons:flameammo)
![ recipe](https://raw.github.com/RickyFF/CannonsMod-Minetest/master/craft/flameammo.png)
```
recipe = {
{'', 'default:coal_lump', ''},
{'lulzpack:hotstone', 'lulzpack:dintled_celisblock', 'lulzpack:hotstone'},
{'', 'lulzpack:redyz_ingot', ''},
}
```

BIN
craft/flameammo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

94
games/BlockForge2/mods/cannons/bombs.lua Normal file → Executable file
View File

@ -27,26 +27,28 @@ bombs.explosive.velocity=40
local explosivebomb={
physical = false,
textures = {"gunmod_bullet1_back.png"},
visual = "mesh",
mesh = "bomb1.x",
textures={"explosiveBomb.png"},
lastpos={},
plastpos={},
collisionbox = {0,0,0,0,0,0},
on_step = function(self, dtime)
local pos = self.object:getpos()
local node = minetest.env:get_node(pos)
local exs=true
if node.name == "default:water_source" or node.name == "default:water_flowing" then
if minetest.get_node_group(node.name, "puts_out_fire")~=0 then
exs=false
self.object:remove()
end
if self.lastpos.x~=nil then
if node.name ~= "air" and exs then
self.object:remove()
explode(pos)
explode(pos,2,destroy)
end
end
checkState(self)
self.plastpos=self.lastpos
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
}
@ -62,7 +64,6 @@ bombs.timer.velocity=20
local timerbomb={
physical = true,
textures = {"gunmod_bullet1_back.png"},
visual = "mesh",
mesh = "bomb1.x",
textures={"timerBomb.png"},
@ -81,7 +82,7 @@ local timerbomb={
minetest.after(6, function(args)
if self.object~=nil and self.object:getpos()~=nil then
self.object:remove()
explode(self.object:getpos())
explode(self.object:getpos(),2,destroy)
end
end,self)
end
@ -90,10 +91,47 @@ local timerbomb={
}
minetest.register_entity(bombs.timer.name, timerbomb)
-- Flame Bomb
bombs.flame={}
bombs.flame.name=modname..':flamebomb'
bombs.flame.item=modname..':flameammo'
bombs.flame.gravity=9
bombs.flame.velocity=20
local flamebomb={
physical = false,
visual = "mesh",
mesh = "bomb1.x",
textures={"flameBomb.png"},
lastpos={},
collisionbox = {0,0,0,0,0,0},
c=false,
on_step = function(self, dtime)
local pos = self.object:getpos()
local node = minetest.env:get_node(pos)
local exs=true
if minetest.get_node_group(node.name, "puts_out_fire")~=0 then
exs=false
self.object:remove()
end
if self.lastpos.x~=nil then
if node.name ~= "air" and exs then
self.object:remove()
explode(pos,1,ignite)
end
end
checkState(self)
self.plastpos=self.lastpos
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
}
minetest.register_entity(bombs.flame.name, flamebomb)
-- Funct
function explode(pos) -- Based on https://github.com/PilzAdam/TNT
function explode(pos,dmwc1,func) -- Based on https://github.com/PilzAdam/TNT
if checkProtection(pos) then return end
minetest.sound_play("DeathFlash", {pos=pos, gain=1.5, max_hear_distance=2*64})
local objects = minetest.env:get_objects_inside_radius(pos, 7)
for _,obj in ipairs(objects) do
@ -111,6 +149,8 @@ function explode(pos) -- Based on https://github.com/PilzAdam/TNT
}, nil)
end
end
local destroyed=0
local stop=false
for dx=-2,2 do
for dz=-2,2 do
for dy=2,-2,-1 do
@ -119,31 +159,54 @@ function explode(pos) -- Based on https://github.com/PilzAdam/TNT
pos.z = pos.z+dz
local node = minetest.env:get_node(pos)
if math.abs(dx)<2 and math.abs(dy)<2 and math.abs(dz)<2 then
destroy(pos)
func(pos)
if minetest.get_node_group(node.name, "cracky")==1 then destroyed=destroyed+1 end
else
if math.random(1,5) <= 4 then
destroy(pos)
func(pos)
end
end
if destroyed>dmwc1 then
stop=true
break
end
pos.x = pos.x-dx
pos.y = pos.y-dy
pos.z = pos.z-dz
end
if stop then break end
end
if stop then break end
end
end
function destroy(pos) -- Based on https://github.com/PilzAdam/TNT
if math.random(1,5) <= 4 then
minetest.env:add_entity({x=pos.x+math.random(0,10)/10-0.5, y=pos.y, z=pos.z+math.random(0,10)/10-0.5}, modname..":smoke")
end
local nodename = minetest.env:get_node(pos).name
if nodename ~= "air" and nodename ~= "default:water_source" and nodename ~= "default:water_flowing" then
if minetest.get_node_group(nodename, "puts_out_fire")==0 then
minetest.env:remove_node(pos)
nodeupdate(pos)
end
end
function ignite(pos) -- Based on https://github.com/PilzAdam/TNT
if math.random(1,5) <= 4 then
minetest.env:add_entity({x=pos.x+math.random(0,10)/10-0.5, y=pos.y, z=pos.z+math.random(0,10)/10-0.5}, modname..":smoke")
end
local nodename = minetest.env:get_node(pos).name
if minetest.get_node_group(nodename, "puts_out_fire")==0 then
local nodepos = {x=pos.x,y=pos.y+1,z=pos.z}
if minetest.env:get_node(nodepos).name == 'air' then
minetest.env:add_node(nodepos, {name="fire:basic_flame"})
nodeupdate(pos)
end
end
end
minetest.register_entity(modname..":smoke", { -- Based on https://github.com/PilzAdam/TNT
physical = true,
@ -166,3 +229,16 @@ minetest.register_entity(modname..":smoke", { -- Based on https://github.com/Pil
end
end,
})
function checkState(ss)
minetest.after(2, function(s)
if s~=nil and s.plastpos==s.object:getpos() then
s.object:remove()
explode(s.object:getpos(),2)
end
end,ss)
end
function checkProtection(pos)
end

13
games/BlockForge2/mods/cannons/cannons.lua Normal file → Executable file
View File

@ -23,16 +23,22 @@ local cannon1 = {
visual = "mesh",
mesh = "cannon1.x",
textures={"cannon1.png"},
disabled=false,
on_rightclick = function(self, clicker)
for k,v in pairs(bombs) do
if clicker:get_wielded_item():get_name()==v.item then
if clicker:get_wielded_item():get_name()==v.item and self.disabled==false then
clicker:get_inventory():remove_item("main", v.item)
local pos=self.object:getpos()
minetest.sound_play("biggun1", {pos=pos, gain=1.5, max_hear_distance=2*64})
minetest.sound_play("HowitzerArtilleryCannonFire", {pos=pos, gain=1.5, max_hear_distance=2*64})
local dir=clicker:get_look_dir()
self.object:setyaw(clicker:get_look_yaw()+30-0.09)
shot(dir,pos,v.name,v.gravity,v.velocity)
self.disabled=true
minetest.after(2, function(args)
if self.object~=nil and self.disabled then
self.disabled=false
end
end,self)
break
end
end
@ -55,3 +61,4 @@ function shot(dir,pos,entity,gravity,velocity)
end

15
games/BlockForge2/mods/cannons/crafting.lua Normal file → Executable file
View File

@ -42,6 +42,12 @@ minetest.register_craftitem(bombs.timer.item, {
wield_image = "timerammo.png",
})
minetest.register_craftitem(bombs.flame.item, {
description = "Flame Ammunition",
inventory_image = "flameammo.png",
wield_image = "flameammo.png",
})
------------------------------------------------------------------------
minetest.register_craftitem(modname..":obsidian_rod", {
@ -79,6 +85,15 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = modname..':flameammo 1',
recipe = {
{'', 'default:coal_lump', ''},
{'lulzpack:hotstone', 'lulzpack:dintled_celisblock', 'lulzpack:hotstone'},
{'', 'lulzpack:redyz_ingot', ''},
}
})
minetest.register_craft({
output = modname..':timerammo 3',
recipe = {

1
games/BlockForge2/mods/cannons/depends.txt Normal file → Executable file
View File

@ -1 +1,2 @@
lulzpack
fire

0
games/BlockForge2/mods/cannons/init.lua Normal file → Executable file
View File

View File

View File

View File

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 396 KiB

View File

View File

Before

Width:  |  Height:  |  Size: 316 KiB

After

Width:  |  Height:  |  Size: 316 KiB

0
games/BlockForge2/mods/cannons/models/bomb1.x Normal file → Executable file
View File

0
games/BlockForge2/mods/cannons/models/cannon1.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 494 KiB

After

Width:  |  Height:  |  Size: 494 KiB

0
games/BlockForge2/mods/cannons/models/cannon1.x Normal file → Executable file
View File

View File

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

0
games/BlockForge2/mods/cannons/models/req/iron.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 250 KiB

After

Width:  |  Height:  |  Size: 250 KiB

0
games/BlockForge2/mods/cannons/models/req/mane6.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

0
games/BlockForge2/mods/cannons/models/req/obsidian.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

0
games/BlockForge2/mods/cannons/models/req/rb.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

0
games/BlockForge2/mods/cannons/models/timerBomb.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 191 KiB

After

Width:  |  Height:  |  Size: 191 KiB

1
games/BlockForge2/mods/cannons/sounds/Credits.txt Normal file → Executable file
View File

@ -1,2 +1,3 @@
biggun1.ogg by bart @ http://opengameart.org/content/2-big-gun-shots
DeathFlash.ogg by Blender Foundation @ http://opengameart.org/content/big-explosion
HowitzerArtilleryCannonFire.ogg @ http://soundjax.com/?q=cannon

0
games/BlockForge2/mods/cannons/sounds/DeathFlash.ogg Normal file → Executable file
View File

0
games/BlockForge2/mods/cannons/sounds/biggun1.ogg Normal file → Executable file
View File

0
games/BlockForge2/mods/cannons/textures/cannon1inv.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 395 B

After

Width:  |  Height:  |  Size: 395 B

View File

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

View File

Before

Width:  |  Height:  |  Size: 367 B

After

Width:  |  Height:  |  Size: 367 B

0
games/BlockForge2/mods/cannons/textures/timerammo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 857 B

0
games/BlockForge2/mods/cannons/textures/tnt_smoke.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 323 B

After

Width:  |  Height:  |  Size: 323 B