Mod Support

Mod Info

class CommonModInfo(*args, **kwargs)

Bases: CommonService

Provide information about your mod.

For information on what each of the properties represents, see CommonModIdentity

Example usage:

from sims4communitylib.mod_support.common_mod_info import CommonModInfo

# This is how the sims4communitylib.modinfo.ModInfo implementation works.
class ModInfo(CommonModInfo):
    _FILE_PATH: str = str(__file__)

    @property
    def _name(self) -> str:
        return 'Sims4CommunityLib'

    @property
    def _author(self) -> str:
        return 'DeviantGameMods'

    @property
    def _base_namespace(self) -> str:
        return 'sims4communitylib'

    @property
    def _file_path(self) -> str:
        return ModInfo._FILE_PATH

    @property
    def _version(self) -> str:
        return '3.5.6'
classmethod get_identity()

The identity of a mod

Note

It contains information about a mod such as Mod Name, Mod Author, the script base namespace, and the file path to your mod.

Returns:

The identity of a mod.

Return type:

CommonModIdentity

Has Mod Identity

class HasModIdentity

Bases: object

An inheritable class that provides Mod Info for a class.

property mod_identity

The identity of a mod.

Note

It contains information about a mod such as Mod Name, Mod Author, the script base namespace, and the file path to your mod.

Returns:

The identity of a mod.

Return type:

CommonModIdentity

Raises:

NotImplementedError – Thrown when the property is not implemented.

Has Class Mod Identity

class HasClassModIdentity

Bases: HasModIdentity

An inheritable class that provides Mod Info for a class.

Note

This class inherits from HasModIdentity and may be used as an alternative to it.

classmethod get_mod_identity()

The identity of a mod.

Note

It contains information about a mod such as Mod Name, Mod Author, the script base namespace, and the file path to your mod.

Returns:

The identity of a mod.

Return type:

CommonModIdentity

property mod_identity

The identity of a mod.

Note

It contains information about a mod such as Mod Name, Mod Author, the script base namespace, and the file path to your mod.

Returns:

The identity of a mod.

Return type:

CommonModIdentity

Raises:

NotImplementedError – Thrown when the property is not implemented.

Mod Identity

class CommonModIdentity(name, author, base_namespace, file_path, version)

Bases: object

The identity of a mod

Note

It contains information about a mod such as Mod Name, Mod Author, the script base namespace, and the file path to your mod.

Parameters:
  • name (str) – The name of a mod.

  • author (str) – The author of a mod.

  • base_namespace (str) – The base namespace of the .ts4script file of a mod.

  • file_path (str) – The path to the ts4script file of a mod.

property author

The author of a mod.

Returns:

The name of the author of a mod.

Return type:

str

property base_namespace

The base namespace of the .ts4script file of a mod.

Note

S4CL has the base namespace of sims4communitylib.

Returns:

The base script namespace of a mod.

Return type:

str

property file_path

The path to the ts4script file of a mod.

Note

A good override value can be __file__, it will retrieve the file path automatically, assuming the inheriting class is at the root of the mod.

Returns:

The file path to a mod.

Return type:

str

property name

The name of a mod.

Note

The name should not contain spaces.

Returns:

The name of a mod.

Return type:

str

property version

The version a mod is currently at.

Returns:

The version of a mod. The Default value is ‘1.0’.

Return type:

str