listeners Tick

Please post any questions about developing your plugin here. Please use the search function before posting!
Tuck
Global Moderator
Posts: 205
Joined: Sat Jul 14, 2012 9:35 pm
Location: Copenhagen

listeners Tick

Postby Tuck » Thu May 08, 2014 4:44 am

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
-Tuck
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Thu May 08, 2014 4:59 am

Syntax: Select all

from listeners.tick import Tick
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Thu May 08, 2014 6:24 pm

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.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Thu May 08, 2014 6:58 pm

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Thu May 08, 2014 7:48 pm

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.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 24 guests