utils module

Utils package.

A bunch of useful (or completely useless) methods.

utils.exceptions

Module name: exceptions

Defines certain specific exceptions that may be raised during or before the game. This module may disappear in the future.

exception game.utils.exceptions.InvalidGamePropertyValue(message)

Bases: Exception

Class for creating the exception caused by an invalid game property value.

add_note(object, /)

Exception.add_note(note) – add a note to the exception

args
with_traceback(object, /)

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception game.utils.exceptions.InvalidMapData(message='Invalid map data, have you initialise the map with initialise()?')

Bases: Exception

Class for creating the exception caused by invalid map data.

add_note(object, /)

Exception.add_note(note) – add a note to the exception

args
with_traceback(object, /)

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception game.utils.exceptions.InvalidTextureAtlas(message='Invalid texture atlas, have you loaded one with set_atlas()?')

Bases: Exception

Class for creating the exception caused by loading an invalid texture atlas.

add_note(object, /)

Exception.add_note(note) – add a note to the exception

args
with_traceback(object, /)

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception game.utils.exceptions.MaxPlayersReached(message='The player number limit has been reached, please come back later.')

Bases: Exception

Class for creating the exception caused by reaching the maximum player count of a server.

add_note(object, /)

Exception.add_note(note) – add a note to the exception

args
with_traceback(object, /)

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception game.utils.exceptions.OutOfMapBounds(message='Out of map boundaries, make sure to stay within them!')

Bases: Exception

Class for creating the exception caused by overflowing the map data array.

add_note(object, /)

Exception.add_note(note) – add a note to the exception

args
with_traceback(object, /)

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception game.utils.exceptions.PlayerNameAlreadyExists(message='Your current player name is already taken, please change it.')

Bases: Exception

Class for creating the exception caused by joining a server with an in-game name that is already taken.

add_note(object, /)

Exception.add_note(note) – add a note to the exception

args
with_traceback(object, /)

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception game.utils.exceptions.ZeroOrLessSpawnPlayerAttempts(message='Number of attempts to choose player spawn point must be at least 1.')

Bases: Exception

Class for creating the exception caused by setting the number of attempts to zero or less when finding an ideal spawn point for the player.

add_note(object, /)

Exception.add_note(note) – add a note to the exception

args
with_traceback(object, /)

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

utils.logger

Module name: logger

This module defines the logger.

utils.tools

Module name: logger

This module defines the logger.

game.utils.tools.c_log2(x: SupportsFloat | SupportsIndex, /) int

Return cast int ceiling log2 of the given value.

game.utils.tools.resource_dir(directory: str)

Return the correct resource path of a resource directory.

utils.translator

Module name: translator

This module configures the translator.

game.utils.translator.get_locale_from_language(language: str) str

Return the locale (e.g.: ‘en’) of its associated language (i.e.: ‘English’).