orc_food.lua 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. minetest.register_craftitem("lottfarming:orc_food", {
  2. description = "Orc Food",
  3. inventory_image = "lottfarming_orc_food.png",
  4. on_use = function(itemstack, user, pointed_thing)
  5. if minetest.setting_getbool("creative_mode") ~= true then
  6. itemstack:take_item()
  7. end
  8. stamina.change(user, 20)
  9. if not minetest.get_player_privs(user:get_player_name()).GAMEorc then
  10. local first_screen = user:hud_add({
  11. hud_elem_type = "image",
  12. position = {x=0, y=0},
  13. scale = {x=100, y=100},
  14. text = "orc_food.png",
  15. offset = {x=0, y=0},
  16. })
  17. minetest.after(10, function()
  18. user:hud_remove(first_screen)
  19. local second_screen = user:hud_add({
  20. hud_elem_type = "image",
  21. position = {x=0.5, y=0.5},
  22. scale = {x=-100, y=-100},
  23. text = "orc_food1.png",
  24. offset = {x=0, y=0},
  25. })
  26. minetest.after(10, function()
  27. user:hud_remove(second_screen)
  28. end)
  29. end)
  30. end
  31. return itemstack
  32. end,
  33. })
  34. minetest.register_craft({
  35. output = "lottfarming:orc_food 4",
  36. recipe = {
  37. {"default:dirt", "lottfarming:potato_cooked", "default:dirt"},
  38. {"lottmobs:meat_raw", "farming:bread", "lottmobs:meat_raw"},
  39. {"default:dirt", "default:dirt", "default:dirt"},
  40. }
  41. })
  42. minetest.register_craftitem("lottfarming:orc_medicine", {
  43. description = "Orc medicine",
  44. inventory_image = "lottfarming_orc_medicine.png",
  45. on_use = function(itemstack, user, pointed_thing)
  46. if minetest.setting_getbool("creative_mode") ~= true then
  47. itemstack:take_item()
  48. end
  49. user:set_hp(20)
  50. if not minetest.get_player_privs(user:get_player_name()).GAMEorc then
  51. local first_screen = user:hud_add({
  52. hud_elem_type = "image",
  53. position = {x=0, y=0},
  54. scale = {x=100, y=100},
  55. text = "orc_medicine.png",
  56. offset = {x=0, y=0},
  57. })
  58. minetest.after(10, function()
  59. user:hud_remove(first_screen)
  60. local second_screen = user:hud_add({
  61. hud_elem_type = "image",
  62. position = {x=0.5, y=0.5},
  63. scale = {x=-100, y=-100},
  64. text = "orc_medicine1.png",
  65. offset = {x=0, y=0},
  66. })
  67. minetest.after(10, function()
  68. user:hud_remove(second_screen)
  69. end)
  70. end)
  71. end
  72. return itemstack
  73. end,
  74. })
  75. minetest.register_craft({
  76. output = "lottfarming:orc_medicine 2",
  77. recipe = {
  78. {"", "lottfarming:berries", ""},
  79. {"lottfarming:berries", "lottfarming:orc_food", "lottfarming:berries"},
  80. {"", "vessels:drinking_glass", ""},
  81. }
  82. })