Add teleport spell

This commit is contained in:
Signal 2025-09-18 02:15:24 -04:00
parent eff46f3f3e
commit 71d58a4e48
8 changed files with 143 additions and 4 deletions

View file

@ -49,18 +49,18 @@ Player = {
local pos = m.object:get_pos()
if not pos then return end
m.health_display = minetest.add_entity(pos, "rgt_player:health_display")
m.health_display:set_attach(m.object, nil, vector.new(0, 17, 0))
m.health_display:set_attach(m.object, nil, vector.new(0, 22, 0))
m.health_display:get_luaentity().owner = m
end
local tx = "[combine:90x90"
for i = math.floor(hp /2), math.floor(m.props.hp_max /2) -1 do
tx = tx..":"..(i *9)..",0=rgt_heart_empty.png"
tx = tx..":"..(i *9)..",40=rgt_heart_empty.png"
end
for i = 0, math.floor(hp /2) -1 do
tx = tx..":"..(i *9)..",0=rgt_heart.png"
tx = tx..":"..(i *9)..",40=rgt_heart.png"
end
if hp %2 ~= 0 then
tx = tx..":"..((math.floor(hp /2)) *9)..",0=rgt_heart.png\\^[fill\\:5x9\\:4,0\\:#000\\^[makealpha\\:#000"
tx = tx..":"..((math.floor(hp /2)) *9)..",40=rgt_heart.png\\^[fill\\:5x9\\:4,0\\:#000\\^[makealpha\\:#000"
end
m.health_display:set_properties {
visual = "sprite",
@ -341,8 +341,12 @@ minetest.register_entity("rgt_player:health_display", {
initial_properties = {
visual = "sprite",
textures = {"blank.png"},
pointable = false,
static_save = false
},
on_activate = function(e)
e.object:set_armor_groups{immortal = 1}
end,
on_detach = function(e)
e.object:remove()
end,