Page 1 of 1

listeners Tick

Posted: Thu May 08, 2014 4:44 am
by Tuck

Syntax: Select all

from listeners import Tick


i used this back in the day however i cannot seem to find a replacement, mostly because i do not have the old source python files so i don't know how the code looked like for this import (as in what it did)

what i would like was:

Syntax: Select all

@Tick
def tick_listener():
return

Posted: Thu May 08, 2014 4:59 am
by L'In20Cible

Syntax: Select all

from listeners.tick import Tick

Posted: Thu May 08, 2014 6:24 pm
by satoon101
Yes, this used to be in "listeners", but then we moved it to "tick". We have decided to make all of the boost modules private and create modules/packages for each of them to forward them to. Due to this, we ended up moving tick back to listeners, where the rest of the listeners are forwarded to.

We also moved downloads into the "stringtables" package. So, now it is:

Syntax: Select all

from stringtables.downloads import Downloadables

Here is a list of where to find the boost modules:

  • _basetypes
    • basetypes
  • _bots
    • players.bots
  • _commands
    • commands
    • commands.client
    • commands.say
    • commands.server
  • _constants
    • constants (I think)
  • _conversions
    • entities.helpers
    • players.helpers
  • _cvars
    • cvars
    • cvars.flags
  • _datamaps
    • entities.datamaps
  • _dump
    • exposed via "sp dump" command
  • _effects
    • effects
  • _engines
    • engines.server
    • engines.sound
    • engines.trace
  • _entities
    • entities
  • _events
    • events
    • events.listener
    • events.manager
  • _globals
    • I think we decided on globalvars, since globals is a built-in function
  • _keyvalues
    • keyvalues
  • _listeners
    • listeners
  • _mathlib
    • mathlib
  • _memory
    • memory
  • _messages
    • messages - don't use directly, used wrapped functionality
  • _players
    • players
  • _recipients
    • filters.recipients
  • _stringtables
    • stringtables
  • _tools
    • tools (I think)

Every module in every package should have an __all__ defined to help show which objects you should be importing from them. The work on this change is not 100% complete, but it should be fairly soon.

Posted: Thu May 08, 2014 6:58 pm
by L'In20Cible
About _globals, I just ended up putting the GlobalVars singleton into core.py, unless you have a better place to put it, I don't see any benefit having a package for a single variable. As for _constants, most of them will be moved into players/entities.constants and the remaining will stay into constants, yes. As for the _tools module, I didn't move it yet cause I was still thinking about it. IServerTools is an "entity" based interface giving tools to server plugins so, the more I'm thinking about it, the more I think it should be moved to _entities. Also, all the Get/SetKeyValue methods are already exposed into the Edict class. This is how I would see them:

  • ServerTools.create/remove/spawn_entity -> entities.helpers.create/remove/spawn_entity as functions.
  • ServerTools.get_temp_entities -> effects.TempEntities as singleton.
  • ServerTools.get_entity_factory_dictionary -> entities.factories.EntityFactories as singleton.

Posted: Thu May 08, 2014 7:48 pm
by satoon101
Ok, thank you. Could not remember our conversation when it comes to the globals and constants, but I do remember it now after reading this. As for the tools, sounds good to me. They do all have to do with entities, so no better place than that package.