From d4899d800235e38aa24576526f064d2189a9fd5e Mon Sep 17 00:00:00 2001 From: Johnny Date: Thu, 15 Oct 2020 00:56:54 +0000 Subject: [PATCH] Adds client_height() method to Command. --- evennia/commands/command.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/evennia/commands/command.py b/evennia/commands/command.py index 188f930cf0..79bc5915c8 100644 --- a/evennia/commands/command.py +++ b/evennia/commands/command.py @@ -509,6 +509,20 @@ Command {self} has no defined `func()` - showing on-command variables: "SCREENWIDTH", {0: settings.CLIENT_DEFAULT_WIDTH} )[0] return settings.CLIENT_DEFAULT_WIDTH + + def client_height(self): + """ + Get the client screenheight for the session using this command. + + Returns: + client height (int): The height (in characters) of the client window. + + """ + if self.session: + return self.session.protocol_flags.get( + "SCREENHEIGHT", {0: settings.CLIENT_DEFAULT_HEIGHT} + )[0] + return settings.CLIENT_DEFAULT_HEIGHT def styled_table(self, *args, **kwargs): """