Increase grenade blast radius and damage
adds realism to grenades, which can now be relied upon...
This commit is contained in:
parent
a4472242a8
commit
bb10976243
2 changed files with 4 additions and 3 deletions
|
@ -43,10 +43,11 @@ minetest.register_tool("shooter:grenade", {
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
itemstack = ""
|
itemstack = ""
|
||||||
end
|
end
|
||||||
|
-- clarification for future readers: grenade can be used only if player points at nothing (line 47)
|
||||||
if pointed_thing.type ~= "nothing" then
|
if pointed_thing.type ~= "nothing" then
|
||||||
local pointed = minetest.get_pointed_thing_position(pointed_thing)
|
local pointed = minetest.get_pointed_thing_position(pointed_thing)
|
||||||
if vector.distance(user:getpos(), pointed) < 8 then
|
if vector.distance(user:getpos(), pointed) < 10 then
|
||||||
shooter:blast(pointed, 1, 25, 5)
|
shooter:blast(pointed, 2, 25, 5)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -388,7 +388,7 @@ function shooter:blast(pos, radius, fleshy, distance, user)
|
||||||
obj:get_luaentity().name ~= "__builtin:item") then
|
obj:get_luaentity().name ~= "__builtin:item") then
|
||||||
local obj_pos = obj:getpos()
|
local obj_pos = obj:getpos()
|
||||||
local dist = vector.distance(obj_pos, pos)
|
local dist = vector.distance(obj_pos, pos)
|
||||||
local damage = (fleshy * 0.5 ^ dist) * 2
|
local damage = (fleshy * 0.5 ^ dist) * 3
|
||||||
if dist ~= 0 then
|
if dist ~= 0 then
|
||||||
obj_pos.y = obj_pos.y + 1.7
|
obj_pos.y = obj_pos.y + 1.7
|
||||||
blast_pos = {x=pos.x, y=pos.y + 4, z=pos.z}
|
blast_pos = {x=pos.x, y=pos.y + 4, z=pos.z}
|
||||||
|
|
Loading…
Reference in a new issue