Add smoke grenade and tidy up a few things

This commit is contained in:
LoneWolfHT 2018-11-22 16:57:23 -08:00
parent 69d2664445
commit 1a16126f63
4 changed files with 39 additions and 6 deletions

@ -18,8 +18,8 @@ if settings:get_bool("enable_regular_grenade") then
maxexptime = 0.6,
minsize = 5,
maxsize = 7,
collisiondetection = false,
collision_removal = false,
collisiondetection = true,
collision_removal = true,
vertical = false,
texture = "grenades_smoke.png",
})
@ -60,3 +60,33 @@ if settings:get_bool("enable_flashbang_grenade") then
timeout = 3
})
end
if settings:get_bool("enable_smoke_grenade") then
grenades.register_grenade("smoke_greande", {
description = "A smoke grenade (Generates a lot of smoke around the detonation area)",
image = "grenades_smoke_grenade.png",
on_explode = function(pos, player, self)
for i = 0, 5, 1 do
minetest.add_particlespawner({
amount = 100,
time = 10,
minpos = vector.subtract(pos, 3.5),
maxpos = vector.add(pos, 3.5),
minvel = {x=0, y=2, z=0},
maxvel = {x=0, y=3, z=0},
minacc = {x=1, y=0.2, z=1},
maxacc = {x=1, y=0.2, z=1},
minexptime = 0.3,
maxexptime = 1,
minsize = 100,
maxsize = 100,
collisiondetection = false,
collision_removal = false,
vertical = false,
texture = "grenades_smoke.png",
})
end
end,
timeout = 3
})
end

@ -67,7 +67,7 @@ function grenades.register_grenade(name, def)
local player_name = user:get_player_name()
local inv = user:get_inventory()
grenade = throw_grenade("grenades:grenade_"..name, user)
local grenade = throw_grenade("grenades:grenade_"..name, user)
grenade.timer = 0
grenade.thrower_name = player_name

@ -1,5 +1,8 @@
#Add a regular grenade to the world
#Add a regular grenade
enable_regular_grenade (Add a regular grenade to the world) bool false
#Add a flashbang grenade to the world
enable_flashbang_grenade (Add a flashbang grenade to the world) bool false
#Add a flashbang grenade
enable_flashbang_grenade (Add a flashbang grenade to the world) bool false
#Add a smoke grenade
enable_smoke_grenade (Add a smoke grenade to the world) bool false

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B