com.threerings.tudey.server
Class TudeySceneRegistry

java.lang.Object
  extended by com.threerings.whirled.server.SceneRegistry
      extended by com.threerings.tudey.server.TudeySceneRegistry
All Implemented Interfaces:
LocationCodes, InvocationCodes, InvocationProvider, TudeyCodes, SceneCodes, SceneProvider

public class TudeySceneRegistry
extends SceneRegistry
implements TudeyCodes

Provides special handling for moving between Tudey scenes.


Nested Class Summary
protected static class TudeySceneRegistry.PortalMapping
          Contains stored destination portal information.
 
Nested classes/interfaces inherited from class com.threerings.whirled.server.SceneRegistry
SceneRegistry.ConfigFactory, SceneRegistry.ResolutionListener
 
Field Summary
protected  ConfigManager _cfgmgr
          The config manager.
protected  SceneTicker _defaultTicker
          The default scene ticker.
protected  PresentsDObjectMgr _omgr
          The server object manager.
protected  HashIntMap<TudeySceneRegistry.PortalMapping> _portals
          Maps body oids to the keys of their destination portals.
protected static long PORTAL_MAPPING_LIFESPAN
          The interval after which portal mappings expire.
protected static long PORTAL_PRUNE_INTERVAL
          The interval at which we prune expired portal mappings.
 
Fields inherited from class com.threerings.whirled.server.SceneRegistry
_confact, _invoker, _locator, _locman, _penders, _plreg, _scenemgrs, _scfact, _screp
 
Fields inherited from interface com.threerings.tudey.data.TudeyCodes
DEFAULT_BUFFER_DELAY, DEFAULT_TICK_INTERVAL
 
Fields inherited from interface com.threerings.presents.data.InvocationCodes
ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR
 
Fields inherited from interface com.threerings.whirled.data.SceneCodes
SCENE_UPDATE, WHIRLED_GROUP
 
Fields inherited from interface com.threerings.crowd.data.LocationCodes
ALREADY_THERE, MOVE_IN_PROGRESS, NO_SUCH_PLACE
 
Constructor Summary
TudeySceneRegistry(PresentsDObjectMgr omgr, InvocationManager invmgr)
          Constructs a Tudey scene registry.
 
Method Summary
protected  void addPortalMapping(BodyObject source, int sceneId, Object portalKey)
          Adds a portal mapping.
protected  SceneTicker createDefaultTicker()
          Creates the default scene ticker.
 SceneTicker getDefaultTicker()
          Returns a reference to the default scene ticker.
 void moveBody(BodyObject source, int sceneId, Object portalKey)
          Forcibly moves a player to a new scene.
 void moveTo(ClientObject caller, int sceneId, int sceneVer, SceneService.SceneMoveListener listener)
           
protected  void processSuccessfulResolution(SceneModel model, UpdateList updates, Object extras)
           
protected  void prunePortalMappings()
          Removes all expired portal mappings.
protected  Object removePortalMapping(BodyObject source, int sceneId)
          Removes and returns the portal mapping for the specified body and scene, or returns null if there is none or it has expired.
 void resolveScene(ClientObject caller, int sceneId, SceneRegistry.ResolutionListener listener)
          Resolves a scene for the specified caller.
 
Methods inherited from class com.threerings.whirled.server.SceneRegistry
addResolutionListener, getSceneManager, getSceneRepository, leaveOccupiedScene, moveBody, processFailedResolution, resolveScene, sceneManagerDidStart, unmapSceneManager, where
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_omgr

protected PresentsDObjectMgr _omgr
The server object manager.


_cfgmgr

@Inject
protected ConfigManager _cfgmgr
The config manager.


_portals

protected HashIntMap<TudeySceneRegistry.PortalMapping> _portals
Maps body oids to the keys of their destination portals.


_defaultTicker

protected SceneTicker _defaultTicker
The default scene ticker.


PORTAL_MAPPING_LIFESPAN

protected static final long PORTAL_MAPPING_LIFESPAN
The interval after which portal mappings expire.

See Also:
Constant Field Values

PORTAL_PRUNE_INTERVAL

protected static final long PORTAL_PRUNE_INTERVAL
The interval at which we prune expired portal mappings.

See Also:
Constant Field Values
Constructor Detail

TudeySceneRegistry

@Inject
public TudeySceneRegistry(PresentsDObjectMgr omgr,
                                 InvocationManager invmgr)
Constructs a Tudey scene registry.

Method Detail

moveBody

public void moveBody(BodyObject source,
                     int sceneId,
                     Object portalKey)
Forcibly moves a player to a new scene.

Parameters:
portalKey - the key of the destination portal.

resolveScene

public void resolveScene(ClientObject caller,
                         int sceneId,
                         SceneRegistry.ResolutionListener listener)
Resolves a scene for the specified caller.


getDefaultTicker

public SceneTicker getDefaultTicker()
Returns a reference to the default scene ticker.


moveTo

public void moveTo(ClientObject caller,
                   int sceneId,
                   int sceneVer,
                   SceneService.SceneMoveListener listener)
Specified by:
moveTo in interface SceneProvider
Overrides:
moveTo in class SceneRegistry

processSuccessfulResolution

protected void processSuccessfulResolution(SceneModel model,
                                           UpdateList updates,
                                           Object extras)
Overrides:
processSuccessfulResolution in class SceneRegistry

createDefaultTicker

protected SceneTicker createDefaultTicker()
Creates the default scene ticker.


addPortalMapping

protected void addPortalMapping(BodyObject source,
                                int sceneId,
                                Object portalKey)
Adds a portal mapping.


removePortalMapping

protected Object removePortalMapping(BodyObject source,
                                     int sceneId)
Removes and returns the portal mapping for the specified body and scene, or returns null if there is none or it has expired.


prunePortalMappings

protected void prunePortalMappings()
Removes all expired portal mappings.