License: Apache 2.0
Dependencies: default
Download: https://github.com/minetest-mods/loot/a ... .1.0.1.zip
This is a framework to aid in registering and generating loot. When you register a piece of loot, you give it a weight for each category you put it in - the chance that particular stack is selected when generating loot is the weight of the loot divided by the total weight of the category. For reference, diamond has a weight of 100 in both of the categories it's in.
Example:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
loot.register_loot(
{ weights = { generic = 100,
valuable = 100, },
payload = { stack = ItemStack("default:diamond"),
min_size = 1,
max_size = 5,
},
})
When generating loot you give a category and a count of loot to generate to loot.generate_loot. It returns a list of ItemStack.
Example:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
loot.generate_loot("generic", 3)
For particulars, refer to the github page.
The mod also adds loot chests to dungeons, which can be disabled with no_dungeon_loot=true in your minetest config.