| 94 | } |
| 95 | |
| 96 | void Invoke(std::string_view args, std::string& out) |
| 97 | { |
| 98 | // Accept "1"/"0"/"on"/"off"/"true"/"false"/"" (the bare command toggles). |
| 99 | bool target = !s_active; |
| 100 | if (args == "1" || args == "on" || args == "true") |
| 101 | target = true; |
| 102 | else if (args == "0" || args == "off" || args == "false") |
| 103 | target = false; |
| 104 | else if (!args.empty()) |
| 105 | { |
| 106 | out = "god: expected 1|0|on|off (or empty to toggle), got: " + std::string(args); |
| 107 | return; |
| 108 | } |
| 109 | SetActive(target); |
| 110 | out = std::string("god: ") + (s_active ? "ON" : "OFF"); |
| 111 | } |
| 112 | } // namespace Cmd_God |
| 113 | |
| 114 | // Cmd_InfiniteAmmo — sticky toggle. Same shape as Cmd_God; refunds |