Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

conflicts

Binding-conflict detection — reverse index over the Zin.actions / Zin.axes registries. Two bindings "conflict" when they map to the same canonical leaf key (e.g. both bind Space, or an action binds Space and an axis's plus side is Space). Backs Zin.conflicts.

Rows carry a kind = "real" | "intentional" classification: two or more action owners in the same context are real; action + axis overlaps, cross-context actions, and explicitly marked pairs are intentional. realOnly() is the noise-filtered view the Input tab uses; forActiveProfile() is the full audit list.

Exports

Marking:

  • M.markIntentional(actionA: string, actionB: string) -> (boolean, string?)
  • M.unmarkIntentional(actionA: string, actionB: string) -> boolean
  • M.isIntentional(actionA: string, actionB: string) -> boolean
  • M.listIntentional() -> { { string } }

Probing:

  • M.bindingKey(b: any) -> string? — "key:Space", "modKey:Ctrl+KeyS", "mouse:left", or nil.
  • M.find(binding: any) -> { Owner } — owners that share any leaf key with the probe.
  • M.forActiveProfile() -> { ConflictRow } — every shared-key row.
  • M.realOnly() -> { ConflictRow } — subset where kind == "real".

Internal (wired by zinput/init.luau):

  • M._setPersistFn(fn) — registers the save-back closure.
  • M._loadIntentionalPairs(pairs_) — seed on profile activate.
  • M._serializeIntentional() -> { { string } } — for profile save.
  • M._resetIntentional() — test isolation.

Types:

  • Owner = { target: string, name: string, slot: any } — target is "action" or "axis".
  • ConflictRow = { key: string, owners: { Owner }, kind: string } — kind is "real" or "intentional".

Usage

local Zin = require("@builtin::modules.zinput")

-- Audit view (e.g. inside the Input tab):
for _, row in ipairs(Zin.conflicts.forActiveProfile()) do
    print(row.key, row.kind, #row.owners)
end

-- Suppress an intentional same-context overlap:
Zin.conflicts.markIntentional("crouch", "slide")

Notes

  • modKey leaf keys list modifiers alphabetically (Alt+Ctrl+Shift), so Shift+Ctrl+KeyS and Ctrl+Shift+KeyS compare equal.
  • Continuous-source bindings (mouseDelta, scroll, pointerLocked) never appear in conflict reports — two axes reading mouseDelta is by-design.
  • Persistence: _setPersistFn is wired by zinput/init.luau so marks flow into the active profile JSON without conflicts needing a hard dep on profile.
  • The classifier counts every same-context action pair. If even one pair is unmarked, the row is "real"; otherwise "intentional".