Update commands doc with combat, content, and editor sections

Documents how combat moves are registered from TOML, how content-defined commands
work, and how editor mode captures input.
This commit is contained in:
Jared Miller 2026-02-07 23:50:55 -05:00
parent ef658fd987
commit 83455c525f
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -58,6 +58,58 @@ adding commands
4. call register(CommandDefinition(...)) 4. call register(CommandDefinition(...))
5. import the module in server.py so registration runs at startup 5. import the module in server.py so registration runs at startup
combat commands
---------------
combat moves are defined in TOML files in content/combat/. each file describes
a move (attack, defend, counter) with metadata:
name
type (attack/defend)
stamina_cost
telegraph (what the opponent sees)
timing_window_ms (how long to react)
damage_pct (base damage as % of attacker PL)
counters (list of valid defensive moves)
the combat system loads these at startup and registers them as commands via
combat/commands.py. when combat mode is active, these commands become available.
players use the move name to execute it during their turn.
content-defined commands
------------------------
commands can be defined in TOML files in content/commands/. these are loaded
at startup by content.py and registered alongside python-defined commands.
format:
name = "example"
aliases = ["ex"]
help = "example command help text"
mode = "normal"
content commands currently require a python handler (body field pointing to a
callable). when the DSL arrives, this will be replaced with inline scripting.
editor mode
-----------
the edit command pushes editor mode onto the mode stack. while editor mode is
active, all input bypasses the command dispatcher and goes to the editor buffer
instead.
the editor provides:
line editing with insert/append/delete/replace
search and replace (regex supported)
syntax highlighting for TOML/Python
save/discard changes
dirty flag tracking
quit (:q) pops editor mode and returns to normal. the editor is implemented in
editor.py and uses the mode stack to capture input.
code code
---- ----
@ -66,4 +118,7 @@ src/mudlib/commands/movement.py direction commands
src/mudlib/commands/look.py look/l src/mudlib/commands/look.py look/l
src/mudlib/commands/fly.py fly src/mudlib/commands/fly.py fly
src/mudlib/commands/quit.py quit/q (mode="*") src/mudlib/commands/quit.py quit/q (mode="*")
src/mudlib/combat/commands.py combat move commands (loaded from TOML)
src/mudlib/content.py content loading (commands and combat moves)
src/mudlib/editor.py editor mode and buffer management
src/mudlib/player.py Player dataclass + registry src/mudlib/player.py Player dataclass + registry