[Mod] Loot Framework [loot]

Posts: 816
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

[Mod] Loot Framework [loot]

by Byakuren » Wed Feb 03, 2016 03:49

Source: https://github.com/minetest-mods/loot
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.

Code: Select all
        { 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.

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.
Every time a mod API is left undocumented, a koala dies.

Return to Mod Releases

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests