pebble_looting · v0.1.0
Templates
A template describes what a container drops. Staff build them in /lootadmin; other resources register them with the API. Both use the same fields.
{
id = "airdrop_crate_blue", -- script id; required for templates a resource owns
version = 1731456000, -- bump to push changes over an older version
label = "Airdrop Crate",
interactionLabel = "Search", -- optional prompt on the target
cooldown = 90, -- minutes until the loot refreshes; everyone shares the stash until then
minRolls = 3, maxRolls = 5, -- weighted rolls per search
tags = { "airdrop" }, -- free-form; hooks and events receive them
guaranteed = { RARE = 1 }, -- always added, counts towards the roll total
pools = {
FIXED = { { item = "water", min = 1, max = 2 } }, -- given on every search
COMMON = { { item = "bread", min = 1, max = 3 } },
UNCOMMON = {}, RARE = {}, EPIC = {}, LEGENDARY = {},
},
requiredItems = { { item = "crowbar", count = 1, consume = 0 } },
lock = {
items = { { item = "lockpick", failBreakChance = 0.3, successBreakChance = 0 } },
difficulty = { "easy", "medium" },
},
progress = { label = "Searching", duration = 5, animDict = "...", animClip = "...", animFlag = 1 },
actionAfterLoot = "do_nothing",
}
Fields you leave out use Config.Defaults.
Rolls
Each search rolls between minRolls and maxRolls times. Every roll picks a rarity by Config.RarityWeights, using only the rarities that have items in this template, then a random item from that pool with a count between its min and max.
guaranteedadds that many items of a rarity every time, and they count towards the roll total.FIXEDitems are given on every search, on top of the rolls.
Use the roll simulator in the template editor to see what a template really drops before you save it.
Cooldown and the shared stash
The first search fills a stash. Everyone who opens the container sees that same stash until cooldown minutes have passed, then the loot refreshes. Players who already looted it during the cooldown search faster (Config.RevisitSearchMultiplier).
Required items
requiredItems lists items a player needs to search. consume is how many are removed after a successful search; 0 only checks that the player has them.
Locks
With a lock, someone has to pick the container once per refresh before anyone can search it.
itemsare the lockpicks that work, each with a chance to break on a failed (failBreakChance) and a successful (successBreakChance) pick, from0to1.difficultyis one minigame layer per entry:easy,mediumorhard.
After looting
actionAfterLoot decides what happens to a placed prop once its stash has been emptied:
| Value | |
|---|---|
do_nothing |
The prop stays. |
remove_entity |
The prop is hidden until the loot refreshes. |
temporarily_remove_point |
The prop is hidden until the next restart. |
delete_point |
The prop is deleted for good. |
Script-owned templates
A template with an id belongs to the resource that registered it. When that resource registers a higher version, it overwrites the template, unless staff edited it in /lootadmin after that version. Staff edits show an Edited by staff badge; Return to script drops them so the resource's next registration applies again.