SessionEvents beta
Interface of @v12-engine/engine
export interface SessionEventsWhat the players are told happened during a tick, which cannot be read from the state afterwards: each kind by its type (design review E7). The engine's are told by its replications (replicateEvent(key, type, tell), typed by this entry); a pack's or a game's own added by declaration merging, as OrderStates is. A screen's handlers are keyed by the same names (SessionEventOf)
Members
attack
attack: {
type: 'attack';
id: number;
target?: number;
weapon?: number;
};weapon: which of its attacks swings, by place (UnitTypeDef.attacks); the first when left out
attackCancelled
attackCancelled: {
type: 'attackCancelled';
id: number;
};An attack called off before its blow, of a unit the player sees (swingCancelled): the screen cuts it to the walk
bounty
bounty: {
type: 'bounty';
x: number;
z: number;
amount: number;
};Gold for a kill
buff
buff: {
type: 'buff';
id: number;
buff: string;
on: boolean;
level?: number;
renewed?: boolean;
source?: number;
};A buff put on an entity the player sees (on), put on again at another level (renewed), or taken off or run out. Once as it begins and once as it ends: a renewal at the same level is not told
built
built: {
type: 'built';
id: number;
};A structure was finished (or put down whole, UnitTypeDef.construction: 'instant')
camera
camera: {
type: 'camera';
} & Pick<CameraOrder, 'pan' | 'shake'>;The rules pan or shake this player's camera (see cameraFor)
cast
cast: {
type: 'cast';
id?: number;
ability: string;
level: number;
x: number;
z: number;
target?: number;
radius?: number;
charged?: boolean;
};id: the caster, where the player sees it (not where only the spot is seen). charged: it went off charged, see charge on the ability
castCancelled
castCancelled: {
type: 'castCancelled';
id: number;
ability?: string;
};A wind-up called off before it went off (stunned, killed, ordered elsewhere): what it showed goes. ability where known
cells
cells: {
type: 'cells';
layer: string;
at: number[];
value: number;
over?: number;
seen?: true;
};Cells of one of the game's layers (Terrain.cells) were set to value (world.setCells): the session's ground has it already, for the screen to draw again. Told where the player's team sees the cells, and as they come into its sight where it does not (TeamMemory.cells): an observer is told of all. over: the seconds it eases into the value over, where the rules said (grass growing back); not said as cells come into sight. seen: they came into sight as they are, changed out of it before (a fire that burnt there a while): not as they change now
channel
channel: {
type: 'channel';
id: number;
ability: string;
on: boolean;
duration?: number;
interrupted?: boolean;
};A channelled ability started to be kept up (on, for duration seconds), or ended: done, or interrupted
chat
chat: {
type: 'chat';
player: PlayerId;
text: string;
to: ChatAudience;
by?: string;
};by: the name of who watches, for a line of theirs (to: 'observers')
chop
chop: {
type: 'chop';
id: number;
target: number;
};A worker struck what it is gathering from
cinematic
cinematic: {
type: 'cinematic';
cinematic: string;
hold: boolean;
skippable: boolean;
params?: Record<string, unknown>;
};One of the view's cinematics plays (see playCinematic)
cinematicCue
cinematicCue: {
type: 'cinematicCue';
cue: string;
params?: Record<string, unknown>;
};The rules cue the cinematic playing (see cueCinematic)
command
command: {
type: 'command';
seq: number;
refusal?: Message;
};A command the player sent (seq, what send gave) was carried out: refused, with why, or not
constructionCancelled
constructionCancelled: {
type: 'constructionCancelled';
id: number;
};A construction was called off by its owner: it dies next, its death's reason cancelled
constructionStarted
constructionStarted: {
type: 'constructionStarted';
id: number;
buildTime: number;
};A structure was put down to be built, to go up over buildTime seconds as builders work (EntityState.construction)
crit
crit: {
type: 'crit';
id: number;
amount: number;
};A critical strike landed on the entity
damage
damage: {
type: 'damage';
id: number;
amount: number;
damageType: DamageType;
source?: number;
sourceType?: string;
attack: boolean;
crit: boolean;
ability?: string;
tags?: string[];
};Damage dealt to an entity the player sees: by whom when the player sees that too, with what, how much
death
death: {
type: 'death';
id: number;
from?: Vec2;
killer?: number;
killerType?: string;
attack: boolean;
damageType?: DamageType;
ability?: string;
overkill?: number;
crit?: boolean;
how?: string;
reason?: string;
tags?: string[];
};Something died. What killed it (killer, killerType, from, where it stood) when the player sees it; how: an attack of the killer's, the blow's damage type, the ability, how much too much, a critical strike, and what the rules made of it (how, set in the death hook: 'exploded'). For the screen to show it its way
environment
environment: {
type: 'environment';
environment: MapEnvironment;
over?: number;
};What the map looks like beyond its ground, as it is now (world.setEnvironment), and the seconds to ease into it over
fx
fx: {
type: 'fx';
id: number;
fx: string;
x?: number;
y?: number;
z?: number;
on?: number;
point?: string;
params?: Record<string, unknown>;
seed: number;
overFog?: boolean;
toward?: number;
tx?: number;
tz?: number;
};One of the view's effects plays, as the rules said (world.fx): id is the rules' handle on it, fx its name, at a place (x, y, z) or on an entity (on, at a point), its knobs, the seed of its random parts
fxStop
fxStop: {
type: 'fxStop';
id: number;
fade?: number;
};An effect the rules played stops (world.stopFx)
game
game: {
type: 'game';
event: string;
payload: unknown;
};An event of the game's own that goes to the screen (see defineEvent): its id, and what it says
ground
ground: {
type: 'ground';
patch: TerrainPatch;
};A part of the ground was reshaped (world.reshapeGround, the editor's Play here): the session's ground has it already, for the screen to draw again. Told to everyone
gust
gust: {
type: 'gust';
x: number;
z: number;
radius: number;
strength: number;
around?: number;
lasts?: number;
};A gust of wind the rules blew at a place the player sees (gust, WindGust): where, how far around, how hard, which way (outwards from its middle when left out) and for how long. For the screen to bend the grass and bushes there (client.gust)
heal
heal: {
type: 'heal';
id: number;
amount: number;
source?: number;
};Health given back to an entity the player sees
impact
impact: {
type: 'impact';
x: number;
z: number;
radius: number;
};A shot that hits an area came down
levelUp
levelUp: {
type: 'levelUp';
id: number;
level: number;
};An ability went off. radius is there for the ones that hit an area
line
line: {
type: 'line';
line: SaidLine;
};Someone says a line to the player: who, what, and for how long (see world.dialog)
lineEnded
lineEnded: {
type: 'lineEnded';
id: number;
};The line was skipped: it ends now
mana
mana: {
type: 'mana';
id: number;
amount: number;
ability?: string;
};Mana of a unit of the player's or an ally's spent on a cast (amount below 0, ability the one cast) or given by an effect (above 0). Not regeneration
message
message: {
type: 'message';
message: Message;
kind: MessageKind;
seconds?: number;
};Something to tell the player. The client finds the words for it, see Message
miss
miss: {
type: 'miss';
x: number;
z: number;
};An attack up a cliff went wide, at this spot
missileHit
missileHit: {
type: 'missileHit';
missile: number;
target: number;
};What an ability sent on its way struck an entity
morphed
morphed: {
type: 'morphed';
id: number;
from: string;
};An entity became another type (from: what it was): an upgrade done, a morph
objective
objective: {
type: 'objective';
objective: ObjectiveState;
was?: ObjectiveStatus;
};An objective of the player was given (was undefined), got further along, or was done or failed
picked
picked: {
type: 'picked';
id: number;
item: string;
};An entity picked an item up
ping
ping: {
type: 'ping';
player: PlayerId;
x: number;
z: number;
kind: PingId;
to: ChatAudience;
by?: string;
};by: the name of who watches, for one of theirs (to: 'observers')
redefined
redefined: {
type: 'redefined';
kind: DataKind;
definition: string;
values: DataValues;
};A definition changed while the game runs (world.redefine), a copy made with copyOf: a screen with a registry of its own puts it in. Told to everyone
researched
researched: {
type: 'researched';
upgrade: string;
level: number;
building: number;
};Research of the player or an ally finished
resource
resource: {
type: 'resource';
id: number;
kind: string;
amount: number;
reason?: string;
};A pool of the game's own on a unit of the player's or an ally's changed (resourceChanged)
revived
revived: {
type: 'revived';
id: number;
};A hero was brought back
rustle
rustle: {
type: 'rustle';
layer: string;
x: number;
z: number;
entered?: boolean;
};Something the player does not see moved in a layer of cells where the player sees the ground (ConcealmentOptions.rustle): where, and whether it stepped in. Not who: for the screen to shake the bushes there
shot
shot: {
type: 'shot';
id: number;
x: number;
z: number;
target?: number;
miss: boolean;
crit: boolean;
};A shot arrived: at its target when it had one, missing (miss), or struck critically
strike
strike: {
type: 'strike';
id?: number;
ability: string;
level: number;
x: number;
z: number;
target?: number;
radius?: number;
impact?: string;
from?: {
x: number;
z: number;
};
effect?: number;
};What an ability set off arrived somewhere: a missile hit, a rush ended, the time was up. id: the caster, where the player sees it. from: where it went off from, when not the caster (a ball, a shadow: EffectContext.origin)
trained
trained: {
type: 'trained';
id: number;
building?: number;
};A unit came out of building, where the player sees that too
upgradeCancelled
upgradeCancelled: {
type: 'upgradeCancelled';
id: number;
to: string;
};That was called off
upgradeStarted
upgradeStarted: {
type: 'upgradeStarted';
id: number;
to: string;
time: number;
};A building started to turn into another type (to) over time seconds (EntityState.upgrade)
windup
windup: {
type: 'windup';
id: number;
ability: string;
level: number;
x: number;
z: number;
duration: number;
};Someone started to cast. duration is how long until it goes off
work
work: {
type: 'work';
id: number;
};A worker struck what it is mending
xp
xp: {
type: 'xp';
id: number;
amount: number;
level: number;
};Experience a hero of the player's or an ally's earned, and the level it is at after it