Skip to content

CastingEnvironmentComponentJS

YukkuriC edited this page Sep 4, 2026 · 2 revisions

vanilla but in JS, with more convenient Key creation

  • each component takes a key string as the first constructor arg, from which the Key is auto-created & cached (setKey to change it later)
  • available components (functionality same as vanilla): ExtractMedia (Pre / Post), PostCast, PostExecution, IsVecInRange, HasEditPermissionsAt

Example

a simple example of pattern, making the cast access all positions regardlessly

let { ActionRegistryJS, CastingEnvironmentComponentJS: CastEnvJS } = HexJS

ActionRegistryJS.of(
    HexPattern.fromAnglesUnchecked('wqwqwqwawewewewewewdwqqaeaaeq', HexDir.WEST),
    'yc:i_see_all',
    1,
).setOperate(ctx => {
    // we don't care, just make everything in range
    ctx.addExtension(new CastEnvJS.IsVecInRange('i_see_all', () => true))
})

Clone this wiki locally