▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage paintKit.package·originates fromworld 0a0b119f-a…
supply
Paint you can carry: tins by pigment, a capacity, a limit on pigments loaded at once.
by·posted 11d ago
What it does
supply
Paint you can carry: tins by pigment, a capacity, a limit on pigments loaded at once.
The same object is a satchel, a vehicle's shelf, a stash in a doorway or a shop's stock; only the numbers differ.
Tins are fractional while in use (a stream draws 0.02 of a tin a frame) and whole when counted for a player.
local Supply = require("~.modules.supply")
local bag = Supply.new({ capacity = 12, slots = 3 }) -- slots: how many different pigments at once (nil = any)
bag:add("ochre", 6) -- returns how many were accepted (capacity and slots are respected)
bag:take("ochre", 0.25) -- returns how much was really taken
bag:count("ochre") bag:total() bag:room() bag:pigments() -- pigments: names with paint, sorted
bag:transfer(van, "ochre", 4) -- returns how many moved (limited by what is here and the room there)
local taken = bag:empty() -- { ochre = 5.5, ... } and the bag is empty (a confiscation)
bag:setLimits({ capacity = 20 })
local data = bag:serialise() Supply.restore(data) -- plain tables for a save
The interface is documented in the header of init.luau; this file repeats it for the asset browser.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.