Log inGet started
Package

core.module

This package holds more than this page lists. See all of its files in its world.

README.md

core

The shared state and helpers every part of concealKit runs on. Games use concealKit.api; this module is what the components and the guard brain share (and what a game script may reach for when it needs this peer's player).

  • Registries of the hiding spots, bodies, evidence, carts and disposal zones this peer knows (register, unregister, list(kind), get(kind, x)); each component registers itself on every peer.
  • Lookups: spotOf(avatarId), carriedBy(avatarId), cartOf(avatarId).
  • Players: players(), localAvatar(), avatarOf(peer), isPlayer(id), myPeer(), connected().
  • Authority: isAuthority(e): the entity's owner may change it; while nobody owns it, the room host; offline, this peer (the same rule interactKit uses).
  • Synced lists stored in comma-separated string fields: split, join, has, add, remove.
  • Vectors: vec, dist, flatDist, yawOf, toWorld, toLocal, idOf, now.
  • Sound and feel: sound(name, at?, opts?) plays one of concealKit's sounds through a soundstage bank (opts.everyone sends it to every player); juice(preset, target?, opts?) and flash() reach juiceKit.
  • Events: on(name, fn), emit(name, ev) (here and on every other peer over the concealKit:evt channel), listen().
  • ensurePlayer() adds this peer's StealthPlayer in play.