guides.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. -- This file contains the more basic guides, the normal craft guide, the cooking
  2. -- guide, the armor/protection guide, the forbidden item guide and the master guide.
  3. -- These all use the same system, as outlined in functions.lua. The brewing and
  4. -- potions guides uses a different, hardcoded system, and therefore, have files
  5. -- of their own.
  6. local guides = {
  7. craft = {
  8. {}, {"cook_crafts", "armor_use", "armor_crafts", "forbidden"}, nil, "cooking"
  9. },
  10. cooking = {
  11. {"cook_crafts"}, {"forbidden", "armor_use", "armor_crafts"}, "cooking"
  12. },
  13. protection = {
  14. {"armor_use", "armor_crafts"}, {"forbidden"}
  15. },
  16. forbidden = {
  17. {"forbidden"}, {}
  18. },
  19. master = {
  20. {}, {}, nil, nil, true
  21. },
  22. }
  23. for name, table in pairs(guides) do
  24. lottinventory[name] = {users = {}, crafts = {}, itemlist = {}, need_load_all = true}
  25. lottinventory.receive_fields(lottinventory[name], name, table[5])
  26. local groups = {book = 1}
  27. if name == "forbidden" then
  28. groups.armor_use = 1
  29. elseif name == "master" then
  30. groups.forbidden = 1
  31. end
  32. minetest.register_tool("lottinventory:" .. name .. "_book",{
  33. description = name:gsub("^%l", string.upper) .. " Book",
  34. groups = groups,
  35. inventory_image = "lottinventory_" .. name .. "_book.png",
  36. wield_image = "",
  37. wield_scale = {x=1,y=1,z=1},
  38. stack_max = 1,
  39. tool_capabilities = {
  40. full_punch_interval = 1.0,
  41. max_drop_level=0,
  42. groupcaps={
  43. fleshy={times={[2]=0.80, [3]=0.40}, maxlevel=1},
  44. snappy={times={[2]=0.80, [3]=0.40}, maxlevel=1},
  45. choppy={times={[3]=0.90}, maxlevel=0}
  46. }
  47. },
  48. on_place = function(itemstack, player, pointed_thing)
  49. lottinventory.on_use(player, lottinventory[name], name,
  50. table[1], table[2], table[3], table[4], table[5])
  51. end,
  52. on_use = function(itemstack, player, pointed_thing)
  53. lottinventory.on_use(player, lottinventory[name], name,
  54. table[1], table[2], table[3], table[4], table[5])
  55. end,
  56. })
  57. end
  58. minetest.register_alias("lottinventory:crafts_book", "lottinventory:craft_book")
  59. minetest.register_alias("lottinventory:forbidden_crafts_book", "lottinventory:forbidden_book")