New Sounds, Flame Ammo, Bug Fixes
13
README.md
|
@ -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', ''},
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
After Width: | Height: | Size: 30 KiB |
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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 +1,2 @@
|
|||
lulzpack
|
||||
fire
|
||||
|
|
Before Width: | Height: | Size: 396 KiB After Width: | Height: | Size: 396 KiB |
Before Width: | Height: | Size: 316 KiB After Width: | Height: | Size: 316 KiB |
Before Width: | Height: | Size: 494 KiB After Width: | Height: | Size: 494 KiB |
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 190 KiB |
After Width: | Height: | Size: 336 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 250 KiB After Width: | Height: | Size: 250 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 191 KiB After Width: | Height: | Size: 191 KiB |
|
@ -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
|
||||
|
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 395 B After Width: | Height: | Size: 395 B |
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 761 B |
After Width: | Height: | Size: 288 B |
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 367 B |
Before Width: | Height: | Size: 857 B After Width: | Height: | Size: 857 B |
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 323 B |