diff options
| author | historia <[not public]> | 2026-07-06 23:05:04 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-06 23:05:04 -0400 |
| commit | 9292634f2f8d71a53879ff07e1330c671b207d51 (patch) | |
| tree | dcffadf7f697e8ad0705d787d8f599bdeeedb812 /internal/game/cmd_hideallexits.go | |
| parent | 911aae15f4e869c93239ef7c630c61e1d9d4ef3f (diff) | |
| download | thehouseoficarus-9292634f2f8d71a53879ff07e1330c671b207d51.tar.gz | |
feat: split the concept of hidden and impassable exits. add player_flag for discovered hidden exits.
Diffstat (limited to 'internal/game/cmd_hideallexits.go')
| -rw-r--r-- | internal/game/cmd_hideallexits.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/internal/game/cmd_hideallexits.go b/internal/game/cmd_hideallexits.go new file mode 100644 index 0000000..559da8b --- /dev/null +++ b/internal/game/cmd_hideallexits.go @@ -0,0 +1,38 @@ +package game + +import ( + "fmt" + "strings" + + "thehouseoficarus/internal/net" +) + +func (g *Game) executeHideAllExits(sess *net.Session, args []string, rawInput string) { + if !g.checkAdmin(sess) { + sess.WriteLine("Unknown command.") + return + } + p := sess.Player + if p == nil { + return + } + if p.Flags == nil { + sess.WriteLine("No discovered exits to clear.") + return + } + var cleared []string + for k := range p.Flags { + if strings.HasPrefix(k, "hidden_exit_") { + cleared = append(cleared, k) + } + } + if len(cleared) == 0 { + sess.WriteLine("No discovered exits to clear.") + return + } + for _, k := range cleared { + delete(p.Flags, k) + } + g.AccountStore.SaveCharacter(p) + sess.WriteLine(fmt.Sprintf("Cleared %d discovered exit(s).", len(cleared))) +} |
