Increase grenade blast radius and damage

adds realism to grenades, which can now be relied upon...
This commit is contained in:
Anand S 2018-02-18 19:43:19 +05:30 committed by rubenwardy
parent a4472242a8
commit bb10976243
2 changed files with 4 additions and 3 deletions

View file

@ -43,10 +43,11 @@ minetest.register_tool("shooter:grenade", {
if not minetest.setting_getbool("creative_mode") then
itemstack = ""
end
-- clarification for future readers: grenade can be used only if player points at nothing (line 47)
if pointed_thing.type ~= "nothing" then
local pointed = minetest.get_pointed_thing_position(pointed_thing)
if vector.distance(user:getpos(), pointed) < 8 then
shooter:blast(pointed, 1, 25, 5)
if vector.distance(user:getpos(), pointed) < 10 then
shooter:blast(pointed, 2, 25, 5)
return
end
end

View file

@ -388,7 +388,7 @@ function shooter:blast(pos, radius, fleshy, distance, user)
obj:get_luaentity().name ~= "__builtin:item") then
local obj_pos = obj:getpos()
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
obj_pos.y = obj_pos.y + 1.7
blast_pos = {x=pos.x, y=pos.y + 4, z=pos.z}