Beispiel #1
0
 def _create_public_convar(self):
     """Create a public convar if :attr:`public_convar` is set to True."""
     name = '{}_version'.format(self.name)
     description = '{} version.'.format(self.verbose_name)
     if self.public_convar is True:
         self.public_convar = PublicConVar(name, self.version, description)
     elif isinstance(self.public_convar, dict):
         self.public_convar = PublicConVar(
             self.public_convar.pop('name', name),
             self.public_convar.pop('value', self.version),
             self.public_convar.pop('description', description),
             **self.public_convar)
from translations.strings import LangStrings

# =============================================================================
# >> PLUGIN INFO
# =============================================================================
info = PluginInfo("simple_teleport")
info.basename = "simple_teleport"
info.name = "Simple Teleport"
info.description = "Easily teleport players"
info.author = "Kill, iPlayer"
info.version = "1.0"
info.url = "https://steamcommunity.com/id/killtmwc | " \
           "https://steamcommunity.com/id/its_iPlayer"

PublicConVar(name=info.basename + "_version",
             value=info.version,
             description=info.description)

# =============================================================================
# >> CONSTANTS
# =============================================================================
STUCK_RELEASE_TIMEOUT = 4.0
VEC_P2P_OFFSET = Vector(0, 0, 80)

# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
saved_locs = PlayerDictionary(lambda index: None)
selected_p2p_first = PlayerDictionary(lambda index: None)

# =============================================================================
Beispiel #3
0
# =============================================================================
# >> CONSTANTS
# =============================================================================
#: Version of the Source.Python intallation.
VERSION = None

#: The Github commit this Source.Python version was built with.
GIT_COMMIT = None

LAST_SUCCESSFUL_BUILD_NUMBER_URL = (
    'http://downloads.sourcepython.com/version.txt')

# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
_sp_version = PublicConVar('sp_version', str(VERSION), 'Source.Python version')


# =============================================================================
# >> FUNCTIONS
# =============================================================================
def get_last_successful_build_number(timeout=3):
    """Return the latest successful build number as an integer.

    :param float timeout:
        Number of seconds that need to pass until a timeout occurs.
    :rtype: int
    """
    with urlopen(LAST_SUCCESSFUL_BUILD_NUMBER_URL, timeout=timeout) as url:
        return int(url.read().decode('utf-8'))
Beispiel #4
0
from cvars.public import PublicConVar
from plugins.info import PluginInfo


info = PluginInfo()
info.name = "LimitZones (Editor)"
info.basename = 'limit_zones_editor'
info.author = 'Kirill "iPlayer" Mysnik'
info.version = '1.0'
info.variable = '{}_version'.format(info.basename)
info.convar = PublicConVar(
    info.variable, info.version, "{} version".format(info.name))

info.url = "https://github.com/KirillMysnik/SP-LimitZones"
Beispiel #5
0
# ../cut_wire/info.py
"""Provides/stores information about the plugin."""

# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python Imports
#   Cvars
from cvars.public import PublicConVar
#   Plugins
from plugins.info import PluginInfo

# =============================================================================
# >> PLUGIN INFO
# =============================================================================
info = PluginInfo()
info.name = 'Cut Wire'
info.author = 'Satoon101'
info.version = '1.1'
info.basename = 'cut_wire'
info.variable = info.basename + '_version'
info.url = 'http://forums.sourcepython.com/showthread.php?779'
info.convar = PublicConVar(info.variable, info.version, 0,
                           info.name + ' Version')
import os

from glob import glob

from cvars.public import PublicConVar
from plugins.info import PluginInfo

from . import bans, commands
from .utils import utils

info = PluginInfo()
info.name = "Admin Commands"
info.author = "necavi"
info.version = "0.1"
info.basename = "admin_commands"
info.variable = info.basename + "_version"
info.convar = PublicConVar(info.variable, info.version, info.name + " Version")

cwd = os.getcwd()
os.chdir(os.path.dirname(os.path.abspath(__file__)))
for module in glob("commands/*.py"):
    name = "admin_commands.commands." + os.path.splitext(
        os.path.basename(module))[0]
    loader = importlib.machinery.SourceFileLoader(name, module)
    loader.load_module(name)
os.chdir(cwd)


def unload():
    utils.unload()