00aa460942
- Player hp_max is 8 now, so most injuries will block a whole slot each time. - Player can be reduced to 1 slot, not 2. The 2 slots was from back in the day when players needed to go to the surface to heal faster, to help them get up there. Now the 1 slot is only needed in case the player is trapped in fire or something. - Damage effects now don't stop playing just because the player has reached maximum injury, and healing is also delayed by continued injury.
27 lines
774 B
Lua
27 lines
774 B
Lua
-- LUALOCALS < ---------------------------------------------------------
|
|
local minetest, nodecore
|
|
= minetest, nodecore
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
local hand = minetest.registered_items[""]
|
|
local injured = modname .. ":injured"
|
|
minetest.register_craftitem(injured, {
|
|
description = "Injury",
|
|
stack_max = 1,
|
|
inventory_image = modname .. "_injured.png",
|
|
wield_image = hand.wield_image,
|
|
wield_scale = hand.wield_scale,
|
|
on_drop = function(stack) return stack end,
|
|
on_place = function(stack) return stack end,
|
|
virtual_item = true
|
|
})
|
|
|
|
nodecore.register_healthfx({
|
|
item = injured,
|
|
getqty = function(player)
|
|
return 1 - nodecore.getphealth(player) / 8
|
|
end
|
|
})
|