aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_registry.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-09 22:15:54 -0400
committerhistoria <[not public]>2026-07-09 22:15:54 -0400
commitecba7f726f70b37126d852c38c7e3eec7b04d730 (patch)
tree9129215c6e5015336fde1116395336d82bb952d1 /internal/game/cmd_registry.go
parentb3d4c616f59ad2519f3a0b77e3b47d6571cd2486 (diff)
downloadthehouseoficarus-ecba7f726f70b37126d852c38c7e3eec7b04d730.tar.gz
feat: old standalone trigger systems completely unified into trigger->condition->action system
Diffstat (limited to 'internal/game/cmd_registry.go')
-rw-r--r--internal/game/cmd_registry.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/internal/game/cmd_registry.go b/internal/game/cmd_registry.go
index e2c34aa..d03993a 100644
--- a/internal/game/cmd_registry.go
+++ b/internal/game/cmd_registry.go
@@ -150,7 +150,7 @@ var commandRegistry = map[string]commandDef{
"goto": {(*Game).executeGoto, ClassInstant},
"summon": {(*Game).executeSummon, ClassInstant},
"dig": {(*Game).executeDig, ClassInstant},
- "setglobalflag": {(*Game).executeSetGlobalFlag, ClassInstant},
+ "setglobalflag": {(*Game).executeSetGlobalFlag, ClassInstant},
"setplayerflag": {(*Game).executeSetPlayerFlag, ClassInstant},
"reload": {(*Game).executeReload, ClassInstant},
"shutdown": {(*Game).executeShutdown, ClassInstant},
@@ -177,6 +177,24 @@ func classifyCommand(cmd string) CommandClass {
}
func (g *Game) executeCommand(sess *net.Session, cmd string, args []string, rawInput string) {
+ p := sess.Player
+
+ // Locked-sequence busy gate: a locked in-flight trigger sequence blocks every
+ // verb except quit/logout (and god-mode admins) until it completes.
+ if p != nil && !p.GodMode && g.playerLocked(p.Name) && cmd != "quit" && cmd != "logout" {
+ sess.WriteLine("You're busy — wait for the current action to finish.")
+ return
+ }
+
+ // Unlocked sequences are interruptable: any active/free verb cancels them
+ // before running. (Instant info commands like look/inventory/help do not.)
+ if p != nil {
+ switch classifyCommand(cmd) {
+ case ClassActive, ClassFree:
+ g.cancelUnlockedSequences(p.Name)
+ }
+ }
+
if def, ok := commandRegistry[cmd]; ok {
def.handler(g, sess, args, rawInput)
return
@@ -187,7 +205,6 @@ func (g *Game) executeCommand(sess *net.Session, cmd string, args []string, rawI
return
}
- p := sess.Player
if a, ok := verbAliases[cmd]; ok {
g.cancelAction(p)
switch a {