pebble_looting · v0.1.0

Configuration

pebble_looting has two config files, both open to edit. Restart the resource after a change.

  • config/shared.lua: rarity weights, template defaults, distances, NPC looting, no-loot zones, crate rotations and ground loot.
  • config/server.lua: the admin command, access and the audit webhook.

Templates, zones, props, search areas and model rules aren't in the config: build them in /lootadmin or register them from another resource with the API.

config/shared.lua

Rarity weights

Config.RarityWeights = {
    COMMON = 500,
    UNCOMMON = 300,
    RARE = 100,
    EPIC = 70,
    LEGENDARY = 30,
}

Config.RerollEmptyTiers = true

Each roll first picks a rarity by these weights (out of their sum), then a random item inside it. Only rarities that have items in the template take part. With RerollEmptyTiers, a roll that lands on an empty tier rolls again instead of giving nothing.

Defaults

Config.Defaults = {
    cooldown = 60,   -- minutes until the loot refreshes
    minRolls = 1,
    maxRolls = 3,
    progress = {
        label = "Searching",
        duration = 5, -- seconds
        animDict = "amb@medic@standing@tendtodead@base",
        animClip = "base",
        animFlag = 1,
    },
}

Used for any value a template leaves out.

Distances and revisits

Option Default
Config.MaxLootDistance 6.0 How far from a container a player may be when the server checks a search.
Config.Points.streamDistance 50.0 Props spawn for players within this distance.
Config.Points.targetDistance 2.2 How close a player must be to target a prop.
Config.RevisitSearchMultiplier 0.35 Search time multiplier for a player who already looted the container before its cooldown ran out.

NPCs and animals

Config.Peds = {
    enabled = true,  -- dead NPCs can be searched
    animals = true,  -- dead animals too
    distance = 2.0,  -- how close a player must be to target the body
}

A dead ped uses its zone's ped template, or a category template when another resource names the ped's category (see hooks).

No-loot zones

Config.NoLootZones = {
    { type = "sphere", coords = vec3(-1037.8, -2737.6, 20.2), radius = 60.0 },
}

Nothing can be searched inside these. Shapes:

  • { type = "sphere", coords, radius }
  • { type = "box", coords, size, rotation }
  • { type = "poly", points, minZ?, maxZ? }

Other resources can add more at runtime with AddNoLootZone.

Crate rotations

Crates that move between positions. Each rotation shows count random positions and reshuffles every rotateMinutes.

Config.CrateRotations = {
    {
        id = "military",
        label = "Military Crate",
        model = "prop_mil_crate_01",
        template = "crate_military", -- template id or script id
        count = 2,
        rotateMinutes = 360,
        positions = {
            vec4(-2357.9, 3249.6, 32.8, 60.0),
            vec4(-2133.4, 3250.1, 32.8, 150.0),
            vec4(-1838.2, 2966.5, 32.8, 240.0),
        },
    },
}

Give the template a lock to make players pick these crates.

Ground loot

Items lying on the ground that go straight into the player's inventory.

Config.GroundLoot = {
    streamDistance = 75.0,
    pickupDistance = 2.0,
    progress = { label = "Picking up", duration = 1.5, animDict = "pickup_object", animClip = "pickup_low", animFlag = 0 },
    zones = {
        {
            id = "sandy_airfield",
            coords = vec3(1718.3, 3255.1, 41.1),
            radius = 80.0,
            maxSpawns = 4,
            respawnMinutes = 30,
            minSpacing = 8.0,
            items = {
                { item = "WEAPON_PISTOL", model = "w_pi_pistol", rarity = "RARE", metadata = { durability = 60 } },
                { item = "ammo-9", model = "prop_ld_ammo_pack_01", rarity = "COMMON", min = 6, max = 18 },
            },
        },
    },
}

Each zone keeps up to maxSpawns items inside radius, at least minSpacing apart, and respawns them after respawnMinutes. Each item has a model to show and either a rarity (COMMON to LEGENDARY) or a plain weight, plus optional min/max and metadata.

config/server.lua

Option Default
ServerConfig.AdminCommand "lootadmin" Command that opens the panel.
ServerConfig.AdminAce "pebble_looting.admin" Ace that grants access, checked first.
ServerConfig.AdminGroups { "admin", "god", "superadmin" } Framework groups that also grant access.
ServerConfig.Webhook "" Discord webhook for the audit log. Empty only logs to the database.

Translations

Every player-facing message is in locales/en.json. To translate, copy it to a new file (for example locales/de.json), translate the values and set ox_lib's locale in server.cfg:

setr ox:locale "de"