loot.lua 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. dungeon_loot.registered_loot = {
  2. -- buckets
  3. {name = "bucket:bucket_empty", chance = 0.55},
  4. -- water in deserts/ice or above ground, lava otherwise
  5. {name = "bucket:bucket_water", chance = 0.45,
  6. types = {"sandstone", "desert", "ice"}},
  7. {name = "bucket:bucket_water", chance = 0.45, y = {0, 32768},
  8. types = {"normal"}},
  9. {name = "bucket:bucket_lava", chance = 0.45, y = {-32768, -1},
  10. types = {"normal"}},
  11. -- various items
  12. {name = "default:stick", chance = 0.6, count = {3, 6}},
  13. {name = "default:flint", chance = 0.4, count = {1, 3}},
  14. {name = "vessels:glass_fragments", chance = 0.35, count = {1, 4}},
  15. {name = "carts:rail", chance = 0.35, count = {1, 6}},
  16. {name = "epic:arrow_tip", chance = .3, count = {1, 43}, y = {-512, -32}},
  17. {name = "commoditymarkget:gold_coins", chance = .1, count = {1, 800}, y = {-512, -256}},
  18. -- farming / consumable
  19. {name = "farming:string", chance = 0.5, count = {1, 8}},
  20. {name = "farming:wheat", chance = 0.5, count = {2, 5}},
  21. {name = "default:apple", chance = 0.4, count = {1, 4}},
  22. {name = "farming:seed_cotton", chance = 0.4, count = {1, 4},
  23. types = {"normal"}},
  24. {name = "default:cactus", chance = 0.4, count = {1, 4},
  25. types = {"sandstone", "desert"}},
  26. {name = "farming:coffee_beans", chance = 0.01, count = {1, 1}, y = {-32768, -512}},
  27. {name = "epic:healing_powder", chance = 0.03, count = {1, 3}, y = {-1024, -256}},
  28. --scrolls
  29. {name = "stations:scroll_teleport", chance = 0.02},
  30. {name = "stations:scroll_healing", chance = 0.02},
  31. {name = "stations:scroll_bloodstone_powder", chance = 0.3},
  32. {name = "stations:scroll_anti_fire", chance = 0.1},
  33. {name = "stations:scroll_wood_ash", chance = 0.5},
  34. {name = "stations:scroll_chitin", chance = 0.6},
  35. {name = "stations:scroll_sulfur_dust", chance = 0.6},
  36. {name = "stations:scroll_poison", chance = 0.2},
  37. --illuminati
  38. {name = "illuminati:core_off", chance = 0.1},
  39. {name = "illuminati:cone_off", chance = 0.1},
  40. -- minerals
  41. {name = "default:coal_lump", chance = 0.9, count = {1, 12}},
  42. {name = "default:gold_ingot", chance = 0.5},
  43. {name = "default:steel_ingot", chance = 0.4, count = {1, 6}},
  44. {name = "default:mese_crystal", chance = 0.1, count = {2, 3}},
  45. {name = "epic:titanium_lump", chance = 0.1, count = {1, 2}, y = {-32768, -24680}},
  46. {name = "epic:sulfur_lump", chance = .25, count = {4, 12}},
  47. -- tools
  48. {name = "default:sword_wood", chance = 0.6},
  49. {name = "default:pick_stone", chance = 0.3},
  50. {name = "default:axe_diamond", chance = 0.05},
  51. -- natural materials
  52. {name = "default:sand", chance = 0.8, count = {4, 32}, y = {-64, 32768},
  53. types = {"normal"}},
  54. {name = "default:desert_sand", chance = 0.8, count = {4, 32}, y = {-64, 32768},
  55. types = {"sandstone"}},
  56. {name = "default:desert_cobble", chance = 0.8, count = {4, 32},
  57. types = {"desert"}},
  58. {name = "default:snow", chance = 0.8, count = {8, 64}, y = {-64, 32768},
  59. types = {"ice"}},
  60. {name = "default:dirt", chance = 0.6, count = {2, 16}, y = {-64, 32768},
  61. types = {"normal", "sandstone", "desert"}},
  62. {name = "default:obsidian", chance = 0.25, count = {1, 3}, y = {-32768, -512}},
  63. {name = "default:mese", chance = 0.15, y = {-32768, -512}},
  64. }
  65. function dungeon_loot.register(t)
  66. if t.name ~= nil then
  67. t = {t} -- single entry
  68. end
  69. for _, loot in ipairs(t) do
  70. table.insert(dungeon_loot.registered_loot, loot)
  71. end
  72. end
  73. function dungeon_loot._internal_get_loot(pos_y, dungeontype)
  74. -- filter by y pos and type
  75. local ret = {}
  76. for _, l in ipairs(dungeon_loot.registered_loot) do
  77. if l.y == nil or (pos_y >= l.y[1] and pos_y <= l.y[2]) then
  78. if l.types == nil or table.indexof(l.types, dungeontype) ~= -1 then
  79. table.insert(ret, l)
  80. end
  81. end
  82. end
  83. return ret
  84. end