Class GlobalKeyCommands
A fixture command that sets or removes a global key on the server. ValheimCLI's default ValheimCLI plugin owns the
read-only key list. In Valheim 1.0.16 a change goes to the server, which applies it and sends
its whole list to every client; each client replaces its own list with it. Keys are stored lower case, as
name or name value. The runner's GlobalKeyFixture in Valheim.Testing.Game issues a change once
and waits until a joined client lists the server's set.
The game's own setkey console command is not used: in 1.0.16 it refuses a key that is not a world-modifier
setting (a boss key, for example) unless the game already counts as cheated, and that check reads the world
modifiers menu. A world-modifier key (one the world-modifiers menu sets, such as nomap) set or removed
here is also written into, or removed from, the world's saved settings (its starting global keys), as the game
does for any change of such a key; other keys (boss keys, for example) are saved only in the world's own key
list. Written against the Valheim 1.0.16 decompile and run on a 1.0.16 server and client.
public static class GlobalKeyCommands
- Inheritance
-
objectGlobalKeyCommands
Fields
ChangeSource
public const string ChangeSource = "global-key-change"
Field Value
- string
Methods
Change(string, string, string)
A mutating fixture command name for the server: set <name> [value] or
remove <name>. It refuses unless FixtureGate allows fixture commands in this process.
It replies {source: "global-key-change", complete: true, action, name, value, keys} with the server's
keys after the change; the clients get the new list with the server's next message to them.
public static ExtensionCommand Change(string enableVariable, string tokenVariable, string name = "globalkey")
Parameters
enableVariablestringtokenVariablestringnamestring
Returns
- ExtensionCommand