HookEvents beta
Interface of @v12-engine/engine
export interface HookEventsThe map of hooks the engine runs, by name, to the event each one hands its handlers
Members
afterCast
afterCast: AfterCast;Its handlers get a AfterCast: an ability that went off
afterDamage
afterDamage: AfterDamage;Its handlers get a AfterDamage: damage that was dealt. The target may have died of it
afterDeath
afterDeath: Death;Its handlers get a Death: something dies. In death it still stands where it was; in afterDeath it is gone from the world
approach
approach: Approach;Its handlers get a Approach: where an attacker goes to fight a target from: its spot around it (see engagement.ts), or the target itself, in point, to change. A flank for cavalry, behind for assassins. Asked...
available
available: Available;Its handlers get a Available: whether a player may make a unit type or research an upgrade at all, before what it requires (see isAvailable): by default (available), what is of no race or of theirs (race)....
beforeAttack
beforeAttack: BeforeAttack;Its handlers get a BeforeAttack: an attack going off, as the engine has it: change what it does, or call it off. target is left out for an attack at the ground. splash is the radius of an attack that hits an area;...
beforeBuff
beforeBuff: BeforeBuff;Its handlers get a BeforeBuff: a buff about to be put on, or put on again. Change how long it lasts or how strong it is, or call it off (immunity)
beforeBuy
beforeBuy: BeforeBuy;Its handlers get a BeforeBuy: an item about to be bought at a shop: change what it costs, or call it off with a reason
beforeCast
beforeCast: BeforeCast;Its handlers get a BeforeCast: an ability about to go off, before it is paid for. Change what it costs, or call it off with a reason. Whether the caster has the mana was already checked against the ability's own...
beforeDamage
beforeDamage: BeforeDamage;Its handlers get a BeforeDamage: damage about to be dealt, before armor and shields. Change amount or type, or cancel()
beforeDeath
beforeDeath: BeforeDeath;Its handlers get a BeforeDeath: something is about to die. cancel() keeps it alive: it is then up to the handler what health it has
beforeDeposit
beforeDeposit: BeforeDeposit;Its handlers get a BeforeDeposit: resources a worker hands in: change amount (more from mines near the keep), or call it off
beforeDrop
beforeDrop: BeforeDrop;Its handlers get a BeforeDrop: an item about to be put down: call it off with a reason (a cursed blade)
beforeEffect
beforeEffect: BeforeEffect;An effect about to reach one target: cancel it for that one (BeforeEffect).
beforeHeal
beforeHeal: BeforeHeal;Its handlers get a BeforeHeal: health about to be given back. Change amount, or cancel()
beforeOrder
beforeOrder: BeforeOrder;Its handlers get a BeforeOrder: an order about to be given to a unit. Set rejected to refuse it
beforePause
beforePause: BeforePause;Its handlers get a BeforePause: a player asks for a pause (see askPause): how many they have left before this one (left), and how long it lasts at most (seconds, which can be changed); call it off with a reason
beforePickUp
beforePickUp: BeforePickUp;Its handlers get a BeforePickUp: an item about to be picked up off the ground (ground its id there): call it off with a reason
beforeProduce
beforeProduce: BeforeProduce;Its handlers get a BeforeProduce: something about to be made: a unit trained, an upgrade researched, a building upgraded, a hero brought back, a structure put down by a worker. Change what it costs and how long it takes,...
beforeSurrender
beforeSurrender: BeforeSurrender;Its handlers get a BeforeSurrender: a player is about to give up (see surrender): call it off with a reason, as a game that does not let them before a time
beforeTalk
beforeTalk: BeforeTalk;Its handlers get a BeforeTalk: a player about to ping the map or say a line (see ping, chat): change the words (text) or who hears them (to), or call it off: a muted player, a word filter, no talking in a...
beforeTrade
beforeTrade: BeforeTrade;Its handlers get a BeforeTrade: resources about to be given to an ally (see give): change how much arrives (received), or call it off with a reason: no trading in the first minutes, a cap on what goes to one player
beforeXp
beforeXp: BeforeXp;Its handlers get a BeforeXp: experience about to go to a hero: change amount (the killer gets more), or make it 0. from is what was killed, when that is where it comes from
buffEnd
buffEnd: BuffEnd;Its handlers get a BuffEnd: a buff that came off: it ran out (expired), or was taken off. Not called for the buffs of something that dies
canAttack
canAttack: CanAttack;Its handlers get a CanAttack: whether an attacker may attack a target: what the engine makes of it (its attack's targets, whether they are enemies) is in cancelled, to change. A buff that lets a unit hit what...
canCast
canCast: CanCast;Its handlers get a CanCast: whether an ability can be used now: what the engine makes of it (level, cooldown, mana, silence) is cancelled with its reason: cancelled = false clears it ("free while Clearcasting"),...
canHarvest
canHarvest: CanHarvest;Its handlers get a CanHarvest: whether a worker may gather from a resource: by default, a resource of a kind it gathers (harvester.ids). Refuse it for a game's own rule: a mine only its owner's cursed mine stands...
canLearn
canLearn: CanLearn;Its handlers get a CanLearn: whether a hero may put a point into an ability: what the engine makes of it in cancelled, to change. The screen hears of it with what the hero can learn
canPlace
canPlace: CanPlace;Its handlers get a CanPlace: whether a structure may be placed. cancel(reason) refuses it, with what the player is told
canTarget
canTarget: CanTarget;Its handlers get a CanTarget: whether an ability may be used on a target: what the engine makes of it (the ability's targets) is cancelled, with its reason: cancelled = false to clear ("can target allied...
death
death: Death;Its handlers get a Death: something dies. In death it still stands where it was; in afterDeath it is gone from the world
detour
detour: Detour;Its handlers get a Detour: a unit is about to go round units standing in its way (around), by point, which is longer ground units more than the straight way to the next corner of its path (see RuleSettings.movement.goesAround):...
effectLanded
effectLanded: EffectLanded;An effect reached one target, its handler done (EffectLanded).
fallenHero
fallenHero: FallenHero;Whether what died stays in the world's entities, out of the world, to be brought back (FallenHero).
formation
formation: Formation;Its handlers get a Formation: units ordered to a point together have their places in a formation worked out (FormationDef, formationPoints): change any in points, by the unit's id, or add or remove some. units...
idle
idle: Idle;Its handlers get a Idle: a unit with nothing to do, this tick: no orders. Set handled and do what it does instead of what idle units do (fight back, go for enemies that come close, which is only for those...
made
made: Entity;Something just made, its type's parts set (abilities, an inventory, an attack), not in the world yet: what a pack gives it of its own, as the heroes pack makes a hero of a hero's type (makeHero) and stocks a shop.
makeWay
makeWay: MakeWay;Its handlers get a MakeWay: an ally standing in a unit's way is asked to step aside, to point (see RuleSettings.movement.makesWay, lookAhead): change where it goes, or make it null to leave it standing....
mapCamp
mapCamp: FromMapCamp;A camp placed on a map is in the world, see mapObject
mapObject
mapObject: FromMapObject;Something placed on a map has become an entity, as the world is made from the map: what the game does with its own fields
mapRegion
mapRegion: FromMapRegion;A region of a map is an area of the world, see mapObject
mapStart
mapStart: FromMap;The world made from a map is all there, about to start (FromMap): what a pack starts from the map's own data.
morphed
morphed: Morphed;Something became another type where it stands (morph): what a pack gives it of its own for the new type (Morphed).
produced
produced: Produced;Its handlers get a Produced: something was made: a unit trained (unit), research done (level), a building upgraded, a hero brought back
remove
remove: Entity;Something left the world for good, at the end of the tick it died in
requirement
requirement: Requirement;Its handlers get a Requirement: whether a player may make something, as far as what it requires goes: a unit, a level of research (level), what a building upgrades to, a structure. What the engine makes of it (the...
spawn
spawn: Entity;Something came into the world, and is in it now
stats
stats: StatsHook;Its handlers get a StatsHook: the stats of an entity being added up, once what the engine knows of (its type, levels, research, items, buffs) is in: add more, as a stat change ({ stats: { armor: 2 } }, percent:...
supplyCap
supplyCap: SupplyCap;Its handlers get a SupplyCap: a player's cap of a pool of supply, once what their buildings provide is added up (see the supply system): change cap (a starting amount, an upgrade, a rule of the game's own). The...
targetScore
targetScore: TargetScore;Its handlers get a TargetScore: how much a unit wants to attack something, as it looks for a target by itself. Higher is picked first: raise or lower score, or make it -Infinity to pass the target over. Towers...
visible
visible: Visible;Its handlers get a Visible: whether a team sees an entity of someone else's: what the fog and invisibility make of it in visible, to change. Units in brush seen only from up close; a watchtower. Asked very often: keep it cheap