Merge branch 'master' into totem_particles

This commit is contained in:
NO11 2021-06-08 19:00:43 +00:00
commit 0795862c5c
4 changed files with 47 additions and 1 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# Text Editor TMP Files
*.swp

View file

@ -121,8 +121,52 @@ pumpkin_face_base_def._mcl_armor_mob_range_mob = "mobs_mc:enderman"
pumpkin_face_base_def._mcl_armor_element = "head"
pumpkin_face_base_def._mcl_armor_texture = "mcl_farming_pumpkin_face.png"
pumpkin_face_base_def._mcl_armor_preview = "mcl_farming_pumpkin_face_preview.png"
if minetest.get_modpath("mcl_armor") then
local pumpkin_hud = {}
local function add_pumpkin_hud(player)
pumpkin_hud[player] = {
pumpkin_blur = player:hud_add({
hud_elem_type = "image",
position = {x = 0.5, y = 0.5},
scale = {x = -100, y = -100},
text = "mcl_farming_pumpkin_hud.png",
z_index = -200
}),
--this is a fake crosshair, because hotbar and crosshair doesn't support z_index
--TODO: remove this and add correct z_index values
fake_crosshair = player:hud_add({
hud_elem_type = "image",
position = {x = 0.5, y = 0.5},
scale = {x = 1, y = 1},
text = "crosshair.png",
z_index = -100
})
}
end
local function remove_pumpkin_hud(player)
if pumpkin_hud[player] then
player:hud_remove(pumpkin_hud[player].pumpkin_blur)
player:hud_remove(pumpkin_hud[player].fake_crosshair)
pumpkin_hud[player] = nil
end
end
pumpkin_face_base_def.on_secondary_use = mcl_armor.equip_on_use
pumpkin_face_base_def._on_equip = add_pumpkin_hud
pumpkin_face_base_def._on_unequip = remove_pumpkin_hud
minetest.register_on_joinplayer(function(player)
if player:get_inventory():get_stack("armor", 2):get_name() == "mcl_farming:pumpkin_face" then
add_pumpkin_hud(player)
end
end)
minetest.register_on_dieplayer(function(player)
remove_pumpkin_hud(player)
end)
minetest.register_on_leaveplayer(function(player)
pumpkin_hud[player] = nil
end)
end
-- Register stem growth

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB