Axel Meyer 7a5bc36daa feat(P.3.7): lib-core.command v0.1.0 — initial release
Handle-Registry (get_pos + set_pos + speed callbacks) + lib-driven
auto-wire (bind_move_action + bind_target_provider) + per-frame
movement with arrive-snap. Move-only execution; context-dispatch
deferred to P.4.

See: meta/docs/superpowers/specs/2026-05-14-p3-7-lib-command-design.md
2026-05-14 17:00:59 +02:00

lib-core.command — v0.1.0

Move-Commands für registrierte Units. RTS-Style Click-to-Move (RMB → bewegt selected Units).

Quick Setup

local command   = require("lib-core.command")
local input     = require("lib-core.input")
local selection = require("lib-core.selection")   -- target-provider source

input.bind("rmb", { "mouse_right" })

command.bind_move_action("rmb")
command.bind_target_provider(function() return selection.list() end)

-- Register each movable unit (read+write callbacks + speed):
local handle = command.register(
    function() return { x = unit.x, y = unit.y } end,
    function(nx, ny) unit.x = nx; unit.y = ny end,
    100   -- px/s
)

-- per-frame:
function update(ctx, dt)
    command.update(dt)
end

API

  • Registry: register(get_pos_fn, set_pos_fn, speed) → handle, unregister(h), count_registered()
  • Speed: set_speed(h, n) / speed(h) → n
  • Issue (programmatic): move_to(handles, x, y), cancel(h), cancel_all()
  • State-Query: current(h) → {type, target_x, target_y}|nil, is_moving(h) → bool
  • Bindings: bind_move_action(name), bind_target_provider(fn)
  • Settings: set_arrive_threshold(n) / arrive_threshold(), set_enabled(b) / enabled()
  • Per-Frame: update(dt)

See meta/docs/superpowers/specs/2026-05-14-p3-7-lib-command-design.md for full design.

Description
P.3.7 lib-core.command v0.1.0 � Move-Commands + Per-Frame-Execution
Readme 33 KiB
Languages
Lua 94.2%
Shell 5.8%