Aaron Suen fe2c153f9e Clean up all lua code style.
Formatting rules based on Paul Kulchenko's perl-based formatter...
http://notebook.kulchenko.com/programming/lua-beautifier-in-55-lines-of-perl
...using a single tab for indent.

Mostly pure whitespace changes.
2019-08-27 19:14:51 -04:00

26 lines
652 B
Lua

-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore
= minetest, nodecore
-- LUALOCALS > ---------------------------------------------------------
minetest.register_on_player_hpchange(function(player, hp)
local orig = player:get_hp()
if hp < 0 then
minetest.after(0, function()
local now = player:get_hp()
if now >= orig then return end
nodecore.sound_play_except("player_damage", {
pos = player:get_pos(),
gain = 0.5
}, player)
end)
end
if hp + orig <= 0 then
hp = 1 - orig
player:get_meta():set_float("dhp", -1)
end
return hp
end,
true
)