botcore
The body of a corner robot, for any design built from parts. Every number comes from `Rules.stats(slot)`, and the look is built by `bots.assembler`.
bots.botcore
The body of a corner robot, for any design built from parts. Every number comes from Rules.stats(slot), and the look is built by bots.assembler.
- Drive: tank drive from the parts' derived speed, acceleration and turn. A side that lost wheels drives weaker and makes the bot pull. Lost batteries cut the power, and with none left nothing drives or spins.
- Contact: arena walls and bot-on-bot shoving use each bot's oriented footprint (its parts' bounds), not a circle.
- Weapons: every weapon part works on its own.
- Spinners spin up and down from where they are mounted. Vertical discs and drums bite with the front arc; horizontal spinners hit all round within their sweep at hub height.
bot:fire()fires every charged cycle weapon at once (flipper, lifter, hammer, crusher). Hammers and crushers come down from above onto the top part under their tip.- Spikes hit for
ramDamage× closing speed × mass / 100 kg.
- Hits: each hit lands on the first surviving victim part the weapon meets, so armour in front of internals takes it. Damage is the weapon's damage × that part's
armorScale, ×1.6 on batteries and receivers. It comes off the bot's health and the part's own hp (armour and structure parts absorb 30% into their hp). - Events:
"hit"carriespart,partTypeandweaponId."partDamaged"and"partLost"fire on part damage and loss. A lost receiver destroys the bot, and lost batteries lead to an immobile KO. A lost wheel weakens its side, a lost weapon stops, and a lost self-righter can't right the bot any more."reset"restores every part. - Rules record: writes
rpm(the primary weapon),weaponFraction,weapons[id] = { rpm, charge, lost },partHp,immobileSecondsandflippedtoRules.bot(slot)every frame. - Sim bodies:
Core.newSimmakes a headless body that never touches the live match, used bybots.fightsim.
Used by bots.HavocBot, bots.RiptideBot and bots.fightsim. Core.get(slot) returns the live bot.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2strict
damageModule( ) → any
get(name: string) → any
The live bot object registered under `slot` this session (nil if none).
| arg | type | description |
|---|---|---|
| name | string |
recOf(self: any) → any
A sim bot (Core.newSim) keeps its own match record, events and opponent and never touches game.rules: many headless fights can run inside one call.
| arg | type | description |
|---|---|---|
| self | any |
liveOf(self: any) → boolean
| arg | type | description |
|---|---|---|
| self | any |
foeOf(self: any) → any
| arg | type | description |
|---|---|---|
| self | any |
emit(self: any, ev: string, payload: any) → void
| arg | type | description |
|---|---|---|
| self | any | |
| ev | string | |
| payload | any |
damageBot(victim: any, dmg: number, cause: string, attacker: any) → void
| arg | type | description |
|---|---|---|
| victim | any | |
| dmg | number | |
| cause | string | |
| attacker | any |
yawOf(e: any) → number
| arg | type | description |
|---|---|---|
| e | any |
new(name: string, root: any, fx: any) → any
A bot body bound to its root entity; builds its look at once.
| arg | type | description |
|---|---|---|
| name | string | |
| root | any | |
| fx | any |
foe(self: any) → any
The bot this one fights (the other corner, or a sim bot's paired `rival`).
| arg | type | description |
|---|---|---|
| self | any |
isLive(self: any) → boolean
True while this bot may drive and fight (the match is live, or it is a sim bot).
| arg | type | description |
|---|---|---|
| self | any |
newSim(name: string, root: any, design: any, x: number, z: number, yaw: number) → any
A headless sim body for `design` on `root` (a scratch entity): no game.rules, no damage shell, no fx. Pair two with `a.rival = b; b.rival = a`, then step update/tryHit yourself. `bot.sim` holds health, damageDealt, destroyed, koCause, counts (events fired, by name) and an optional log.
| arg | type | description |
|---|---|---|
| name | string | |
| root | any | |
| design | any | |
| x | number | |
| z | number | |
| yaw | number |
partBox(p: any, info: any) → any
Cached oriented boxes of every part (bot space) for fast distance tests.
| arg | type | description |
|---|---|---|
| p | any | |
| info | any |
boxDist(b: any, x: number, y: number, z: number) → void
Distance from bot-space point (x, y, z) to a cached box, and the closest point on it.
| arg | type | description |
|---|---|---|
| b | any | |
| x | number | |
| y | number | |
| z | number |
ensureBody(self: any) → void
Make sure the root carries a kinematic Physics body and a box collider (child "HullCollider") sized to the footprint.
| arg | type | description |
|---|---|---|
| self | any |
computeFootprint(self: any) → void
The bot's footprint rectangle (bot space x/z) over its surviving non-spinner parts.
| arg | type | description |
|---|---|---|
| self | any |
recomputeSystems(self: any) → void
Drive grip per side, power scale, self-righting — after losses.
| arg | type | description |
|---|---|---|
| self | any |
rebuild(self: any) → void
Rebuild the look from the corner's current design (detaching and re-attaching the damage shell), restoring every part.
| arg | type | description |
|---|---|---|
| self | any |
forward(self: any) → void
| arg | type | description |
|---|---|---|
| self | any |
toLocal(self: any, wx: number, wz: number) → void
World point → this bot's local (x, z) frame (nose at -Z).
| arg | type | description |
|---|---|---|
| self | any | |
| wx | number | |
| wz | number |
toWorld(self: any, lx: number, lz: number) → void
This bot's local (x, z) → world.
| arg | type | description |
|---|---|---|
| self | any | |
| lx | number | |
| lz | number |
visualY(self: any) → number
| arg | type | description |
|---|---|---|
| self | any |
toBot(self: any, wx: number, wy: number, wz: number) → void
World point → bot space (the design's frame, through yaw, height, roll).
| arg | type | description |
|---|---|---|
| self | any | |
| wx | number | |
| wy | number | |
| wz | number |
fromBot(self: any, x: number, y: number, z: number) → void
Bot-space point → world.
| arg | type | description |
|---|---|---|
| self | any | |
| x | number | |
| y | number | |
| z | number |
dirToWorld(self: any, d: { number }) → void
A bot-space direction → world (no translation).
| arg | type | description |
|---|---|---|
| self | any | |
| d | { number } |
dirToBot(self: any, wx: number, wy: number, wz: number) → void
| arg | type | description |
|---|---|---|
| self | any | |
| wx | number | |
| wy | number | |
| wz | number |
shoveRadius(self: any) → number
Radius of the bot's footprint circle (for AI spacing; contact uses the oriented footprint).
| arg | type | description |
|---|---|---|
| self | any |
primary(self: any) → any
| arg | type | description |
|---|---|---|
| self | any |
isSpinner(self: any) → boolean
| arg | type | description |
|---|---|---|
| self | any |
weaponFraction(self: any) → number
0..1 of the primary weapon: spinner rpm / maxRpm, or a cycle weapon's charge (0 when lost / none).
| arg | type | description |
|---|---|---|
| self | any |
armed(self: any) → boolean
True while at least one weapon still works.
| arg | type | description |
|---|---|---|
| self | any |
cycleReady(self: any, s: any) → boolean
| arg | type | description |
|---|---|---|
| self | any | |
| s | any |
canFire(self: any) → boolean
Cycle weapons: true when one is charged, idle and able to fire.
| arg | type | description |
|---|---|---|
| self | any |
fire(self: any) → boolean
Fire every charged cycle weapon at once. Returns true if any fired. Upside-down, a flipper throws the bot back over.
| arg | type | description |
|---|---|---|
| self | any |
weaponWorld(self: any, w: any) → void
World position of a weapon's strike point (its tip) and hub.
| arg | type | description |
|---|---|---|
| self | any | |
| w | any |
nearestPart(victim: any, x: number, y: number, z: number) → void
Nearest surviving victim part to a victim-space point.
| arg | type | description |
|---|---|---|
| victim | any | |
| x | number | |
| y | number | |
| z | number |
firstStruck(victim: any, px: number, py: number, pz: number, dx: number, dy: number, dz: number, back: number) → void
The first surviving victim part met travelling from `p - dir * back` along dir up to p (victim space).
| arg | type | description |
|---|---|---|
| victim | any | |
| px | number | |
| py | number | |
| pz | number | |
| dx | number | |
| dy | number | |
| dz | number | |
| back | number |
contact(self: any, s: any, victim: any) → void
Does weapon state `s` touch `victim` now? Returns the struck part box, the victim-space contact point, and the world push direction (dx, dz), or nil.
| arg | type | description |
|---|---|---|
| self | any | |
| s | any | |
| victim | any |
inStrikeZone(self: any, victim: any) → boolean
True when one of this bot's charged cycle weapons would land on `victim` right now (the AI's trigger).
| arg | type | description |
|---|---|---|
| self | any | |
| victim | any |
weaponContact(self: any, victim: any) → boolean
True when this bot's spinner `id` (or any weapon) touches `victim` now, ignoring charge/rpm.
| arg | type | description |
|---|---|---|
| self | any | |
| victim | any |
losePart(self: any, id: string, cause: string?, point: any?) → void
Shoot a part off: it stops working and its loss takes effect (see header). Fires "partLost". "reset" restores it.
| arg | type | description |
|---|---|---|
| self | any | |
| id | string | |
| cause | string? | |
| point | any? |
damagePart(self: any, id: string, dmg: number, point: any, cause: string?) → void
Take `dmg` off part `id`'s hit points; fires "partDamaged" and, at 0, loses the part. Armour and structure parts absorb ARMOR_PART_SHARE of a hit (a panel spreads it), every other part all of it.
| arg | type | description |
|---|---|---|
| self | any | |
| id | string | |
| dmg | number | |
| point | any | |
| cause | string? |
resetToStart(self: any) → void
Put the bot back on its start square, upright, still, weapons at 0, every part back.
| arg | type | description |
|---|---|---|
| self | any |
stage(self: any, x: number, z: number, yaw: number) → void
Pose the bot still at (x, z) facing `yaw` (a showroom pose, e.g. the title faceoff or the garage turntable).
| arg | type | description |
|---|---|---|
| self | any | |
| x | number | |
| z | number | |
| yaw | number |
knockUp(self: any, up: number, flipChance: number) → void
Throw the bot upward (m/s); `flipChance` 0..1 that it lands upside-down.
| arg | type | description |
|---|---|---|
| self | any | |
| up | number | |
| flipChance | number |
canSelfRight(self: any) → boolean
True when this design can get itself back over now (a surviving srimech or dome, or a working flipper).
| arg | type | description |
|---|---|---|
| self | any |
selfRight(self: any, force: boolean?) → void
Self-right: hop and roll back onto the wheels (only designs that can).
| arg | type | description |
|---|---|---|
| self | any | |
| force | boolean? |
destroyed(self: any) → void
| arg | type | description |
|---|---|---|
| self | any |
worldRect(b: any) → void
Footprint of a bot in world space: centre, the two half-axis vectors.
| arg | type | description |
|---|---|---|
| b | any |
overlap(a: any, b: any) → void
SAT overlap of two footprints: penetration depth and unit normal pointing from b to a, or nil.
| arg | type | description |
|---|---|---|
| a | any | |
| b | any |
hazardKind(x: number, z: number) → string
| arg | type | description |
|---|---|---|
| x | number | |
| z | number |
update(self: any, dt: number, throttle: number, turn: number) → void
One frame: weapons, drive, knockback, gravity/flip, walls, shoving, rules writes, visuals.
| arg | type | description |
|---|---|---|
| self | any | |
| dt | number | |
| throttle | number | |
| turn | number |
writeRules(self: any, _dt: number) → void
| arg | type | description |
|---|---|---|
| self | any | |
| _dt | number |
cyclePose(kind: string, t: number) → number
0..1 pose of a cycle weapon (0 rest, 1 fully fired) from its fire clock.
| arg | type | description |
|---|---|---|
| kind | string | |
| t | number |
apply(self: any, _dt: number) → void
Write the root transform and the animated parts.
| arg | type | description |
|---|---|---|
| self | any | |
| _dt | number |
landHit(self: any, s: any, victim: any, b: any, cx: number, cy: number, cz: number, dx: number, dz: number, frac: number, closing: number?) → void
Land weapon `s`'s hit on `victim`'s part `b` at victim-space point (cx, cy, cz), pushing along (dx, dz).
| arg | type | description |
|---|---|---|
| self | any | |
| s | any | |
| victim | any | |
| b | any | |
| cx | number | |
| cy | number | |
| cz | number | |
| dx | number | |
| dz | number | |
| frac | number | |
| closing | number? |
tryHit(self: any) → boolean
Test every weapon against the opponent and land the hits that bite (spinners on contact above the minimum rpm fraction; cycle weapons once per firing in their strike window; spikes when closing fast). Returns true if any landed.
| arg | type | description |
|---|---|---|
| self | any |
release(self: any) → void
Unregister on destroy (and detach the damage shell).
| arg | type | description |
|---|---|---|
| self | any |
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.