Improve grenade radius code
This commit is contained in:
parent
cb131d1065
commit
7d16ce7db0
2 changed files with 3 additions and 3 deletions
|
@ -19,7 +19,7 @@ local fragdef = {
|
|||
|
||||
local player = minetest.get_player_by_name(name)
|
||||
|
||||
local radius = 6
|
||||
local radius = 8
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = 20,
|
||||
|
@ -67,7 +67,7 @@ local fragdef = {
|
|||
|
||||
if hit and player and v:is_player() and v:get_hp() > 0 and hit.type == "object" and hit.ref:is_player() and
|
||||
hit.ref:get_player_name() == v:get_player_name() then
|
||||
v:punch(player, 2, {damage_groups = {grenade = 1, fleshy = 90 * 0.707106 ^ vector.distance(pos, v:get_pos())}}, nil)
|
||||
v:punch(player, 2, {damage_groups = {grenade = 1, fleshy = 34 - ((25/radius) * vector.distance(pos, v:get_pos()))}}, nil)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
|
|
@ -140,7 +140,7 @@ function grenades.register_grenade(name, def)
|
|||
newdef.inventory_image = def.image
|
||||
newdef.on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
grenades.throw_grenade(name, 20, user)
|
||||
grenades.throw_grenade(name, 16, user)
|
||||
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
itemstack:take_item(1)
|
||||
|
|
Loading…
Reference in a new issue