DriverProgress
Gives a driver XP, levels and challenges. Put it on any entity (an empty one is fine; it needs no sibling components). Each frame in play it reads a car — the `car` field, or the local player's own car when empty — through `driveProgress.reader`, scores top speed, chained drifts,…
DriverProgress
Gives a driver XP, levels and challenges. Put it on any entity (an empty one is fine; it needs no
sibling components). Each frame in play it reads a car — the car field, or the local player's own
car when empty — through driveProgress.reader, scores top speed, chained drifts, air time, crashes
and distance with driveProgress.score under its style (arcade, career, stunt, drift, zen; switch
live, XP kept), writes driver.xp, driver.level, driver.levelFrac, driver.combo,
driver.drift, driver.air and driver.distance values, announces awards, level-ups and
challenges as navUiKit toasts and personal objectives, and keeps a barsKit XP bar (and a
body-damage bar from car.damage) on screen. navUiKit and barsKit are optional.
Methods: progress(), reset(), setStyle(id), addChallenge(def), removeChallenge(id),
completeChallenge(id), challenges(), bonus(xp, why?), feed(sample, dt) (score a sample by
hand; with manual = true it reads no car), recent() (the last events), target().
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2DriverProgress — XP, levels and challenges for a driver, on any entity. Each frame in play it reads a car (the `car` field, or the local player's own car when empty) through driveProgress.reader, scores it with driveProgress.score under the chosen `style`, writes the driver.* values, announces awards, level-ups and challenges as navUiKit toasts and objectives (when navUiKit is installed) and keeps a barsKit XP bar and body-damage bar on screen (when barsKit is installed). entity.spawn("progress").component.add("driveProgress.DriverProgress", { style = "career" }) entity.find("progress").component.get("driveProgress.DriverProgress"):progress()
state( ) → any
nav( ) → any
bk( ) → any
objectiveId(id: string) → string
| arg | type | description |
|---|---|---|
| id | string |
showObjective(c: any) → void
| arg | type | description |
|---|---|---|
| c | any |
dropObjective(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
toast(text: string, title: string?, icon: string?) → void
| arg | type | description |
|---|---|---|
| text | string | |
| title | string? | |
| icon | string? |
levelLabel( ) → string
wantsDamageBar( ) → boolean
removeBars( ) → void
refreshBars( ) → void
bind( ) → void
bind( ) → void
applyDefaultChallenges( ) → void
writeValues( ) → void
put(id: string?) → void
| arg | type | description |
|---|---|---|
| id | string? |
flushPending( ) → void
handle(events: { any }) → void
| arg | type | description |
|---|---|---|
| events | { any } |
syncStyle( ) → void
update(dt: number) → void
| arg | type | description |
|---|---|---|
| dt | number |
onDestroy( ) → void
progress( ) → any
Where the driver stands: { style, xp, level, into, need, frac, rank, best = { speed, drift, air, crash, links }, totals = { events, drifts, jumps, crashes, distance, xpFromChallenges }, live = { drift, combo, air, damage, distance }, challenges = { { id, text, kind, target, xp, done, progress } }, car }.
reset( ) → void
Back to zero XP and level 1; challenges stay and are open again.
setStyle(id: string) → boolean
Switch style by id (arcade, career, stunt, drift, zen). Keeps the XP; the level follows the new curve.
| arg | type | description |
|---|---|---|
| id | string |
addChallenge(def: any) → any
Add (or replace) a challenge: { id, text, kind = speed|drift|air|crash|distance|level|combo|custom, target, xp }. speed/crash targets are km/h, drift/air seconds, distance metres, combo links, level a level. custom completes only via completeChallenge.
| arg | type | description |
|---|---|---|
| def | any |
removeChallenge(id: string) → boolean
Remove a challenge (and its objective). Returns whether it existed.
| arg | type | description |
|---|---|---|
| id | string |
completeChallenge(id: string) → void
Complete a challenge now (awards its XP). Returns the events it caused.
| arg | type | description |
|---|---|---|
| id | string |
challenges( ) → void
The challenges, in the order added: { id, text, kind, target, xp, done, progress }.
bonus(xp: number, why: string?) → void
Add XP for something of your own game. Returns the events (the bonus and any level-ups).
| arg | type | description |
|---|---|---|
| xp | number | |
| why | string? |
feed(sample: any, dt: number) → void
Score one sample by hand: { kmh, speed, slip, airborne, impactCount, impactSpeed, damage }. Returns the events.
| arg | type | description |
|---|---|---|
| sample | any | |
| dt | number |
recent( ) → void
Recent events, newest last (at most 40).
target( ) → string
The car being scored right now (entity id), or nil.
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.