Skip to content

Instantly share code, notes, and snippets.

@kaeza

kaeza/init.lua Secret

Last active April 5, 2019 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaeza/e748b3807c45a2ef9ca7793ea905e8d0 to your computer and use it in GitHub Desktop.
Save kaeza/e748b3807c45a2ef9ca7793ea905e8d0 to your computer and use it in GitHub Desktop.
Minetest - Flash screen
minetest.register_craftitem("mymod:myitem", {
description = "Flash",
inventory_image = "default_wood.png",
on_use = function(itemstack, user, pointed_thing)
if not user:is_player() then return end
local plname = user:get_player_name()
local hud_id = user:hud_add({
hud_elem_type = "image",
position = {x=0, y=0},
text = "mymod_flash.png",
alignment = {x=1, y=1},
scale = {x=-100, y=-100},
})
-- Remove "flash" after one second.
minetest.after(1, function()
user:hud_remove(hud_id)
end)
user:set_hp(user:get_hp() + 4)
end,
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment