loot.lua 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. {name = "stations:scroll_lifeforce_potion", chance = 0.01},
  38. {name = "stations:scroll_lifeforce_potion2", chance = 0.09},
  39. --illuminati
  40. {name = "illuminati:core_off", chance = 0.1},
  41. {name = "illuminati:cone_off", chance = 0.1},
  42. -- minerals
  43. {name = "default:coal_lump", chance = 0.9, count = {1, 12}},
  44. {name = "default:gold_ingot", chance = 0.5},
  45. {name = "default:steel_ingot", chance = 0.4, count = {1, 6}},
  46. {name = "default:mese_crystal", chance = 0.1, count = {2, 3}},
  47. {name = "epic:titanium_lump", chance = 0.1, count = {1, 2}, y = {-32768, -24680}},
  48. {name = "epic:sulfur_lump", chance = .25, count = {4, 12}},
  49. -- tools
  50. {name = "default:sword_wood", chance = 0.6},
  51. {name = "default:pick_stone", chance = 0.3},
  52. {name = "default:axe_diamond", chance = 0.05},
  53. -- natural materials
  54. {name = "default:sand", chance = 0.8, count = {4, 32}, y = {-64, 32768},
  55. types = {"normal"}},
  56. {name = "default:desert_sand", chance = 0.8, count = {4, 32}, y = {-64, 32768},
  57. types = {"sandstone"}},
  58. {name = "default:desert_cobble", chance = 0.8, count = {4, 32},
  59. types = {"desert"}},
  60. {name = "default:snow", chance = 0.8, count = {8, 64}, y = {-64, 32768},
  61. types = {"ice"}},
  62. {name = "default:dirt", chance = 0.6, count = {2, 16}, y = {-64, 32768},
  63. types = {"normal", "sandstone", "desert"}},
  64. {name = "default:obsidian", chance = 0.25, count = {1, 3}, y = {-32768, -512}},
  65. {name = "default:mese", chance = 0.15, y = {-32768, -512}},
  66. }
  67. function dungeon_loot.register(t)
  68. if t.name ~= nil then
  69. t = {t} -- single entry
  70. end
  71. for _, loot in ipairs(t) do
  72. table.insert(dungeon_loot.registered_loot, loot)
  73. end
  74. end
  75. function dungeon_loot._internal_get_loot(pos_y, dungeontype)
  76. -- filter by y pos and type
  77. local ret = {}
  78. for _, l in ipairs(dungeon_loot.registered_loot) do
  79. if l.y == nil or (pos_y >= l.y[1] and pos_y <= l.y[2]) then
  80. if l.types == nil or table.indexof(l.types, dungeontype) ~= -1 then
  81. table.insert(ret, l)
  82. end
  83. end
  84. end
  85. return ret
  86. end