(I meant PVP as in there is a server option that can be used to turn off PVP damage. This is separate from whether damage is enabled at all, I believe. Anyway, this isn't the issue if other weapons are working.)
I really don't know what the behavior will be if the times are set to zero. You could try a really small value (e.g. 0.001) instead, maybe. As Calinou said, you might try defining full_punch_interval too. This could be a small value too. Basically I think the ratio of full_punch_interval/times[...] it going to be the maximum damage the weapon does, and it will do this much damage on the first swing and if you wait pull_punch_interval between swings.
More about entity damage can be found in lua_api.txt, and I've added a synopsis to the
LuaEntitySAO article on the dev wiki.
Of course, if you want a really, really sure way to kill a player with a weapon in one hit, forget the built-in damage and do something like this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_tool(
"...",
{
...,
on_use = function(stack, player, pointedThing)
local pos = pointedThing.under
local obj = pointedThing.ref
if pointedThing.type == "object" and obj then
obj:set_hp(0)
if not obj:get_player_name() then
-- Non-player entities have to be removed explicitly
obj:remove()
end
elseif pointedThing.type == "node" and pos then
minetest.node_dig(pos, minetest.env:get_node(pos), player)
end
end
})
That should do a one-swing kill on literally anything. The code is untested, so there might need to be a small change or two.