▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage paintKit.package·originates fromworld 0a0b119f-a…
surfaces
What paint does to the thing it lands on, and for how long.
by·posted 11d ago
What it does
surfaces
What paint does to the thing it lands on, and for how long.
Paint on a wall is a mark. Paint on a lens, a windscreen, a road or a person may be an effect with a duration.
Which is data: cfg.surfaces[kind][tool] (or [kind].any) = { effect, seconds?, radius?, offence? }. This module
looks the rule up and keeps the timed effects that are running, including ones that cover an area.
local Surfaces = require("~.modules.surfaces")
local rule = Surfaces.rule(cfg.surfaces, "lens", "spray") -- { effect = "blind", ... } or nil
local field = Surfaces.field()
field:apply("cam12", rule) -- start (or restart) a timed effect on a thing
field:applyAt("slick7", rule, x, z) -- an effect that covers rule.radius round a point
field:has("cam12", "blind") field:left("cam12", "blind") -- seconds left (0 when not active)
field:at(x, z, "slick") -- the id of an area effect covering that point, or nil
field:clear("cam12", "blind") -- repaired / cleaned (returns true if it was active)
local ended = field:tick(dt) -- { { id, effect } } that ran out this tick
field:serialise() Surfaces.restore(data)
An effect with no `seconds` lasts until cleared.
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.