From ab2597b22ccdb71116992aec78080d9858358d04 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 7 Jul 2026 16:24:27 -0400 Subject: rename flags to global_flags (differentiate from player_flags) --- internal/game/cmd_setglobalflag.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 internal/game/cmd_setglobalflag.go (limited to 'internal/game/cmd_setglobalflag.go') diff --git a/internal/game/cmd_setglobalflag.go b/internal/game/cmd_setglobalflag.go new file mode 100644 index 0000000..1ac5080 --- /dev/null +++ b/internal/game/cmd_setglobalflag.go @@ -0,0 +1,38 @@ +package game + +import ( + "fmt" + "strconv" + + "thehouseoficarus/internal/net" +) + +func (g *Game) executeSetGlobalFlag(sess *net.Session, args []string, rawInput string) { + if !g.checkAdmin(sess) { + sess.WriteLine("Unknown command.") + return + } + if len(args) == 0 { + sess.WriteLine("Usage: setglobalflag [value]") + return + } + name := args[0] + var value any = true + if len(args) > 1 { + valStr := args[1] + switch valStr { + case "true": + value = true + case "false": + value = false + default: + if n, err := strconv.Atoi(valStr); err == nil { + value = n + } else { + value = valStr + } + } + } + g.GlobalFlags.Set(name, value) + sess.WriteLine(fmt.Sprintf("Global flag '%s' set to %v.", name, value)) +} -- cgit v1.2.3