Examples of BodyObject


Examples of com.threerings.crowd.data.BodyObject

                                ", cluster=" + cl + ", occ=" + bodyOid + "].");
                    continue;
                }

                // make sure the subsumee exists
                final BodyObject bobj = (BodyObject)_omgr.getObject(bodyOid);
                if (bobj == null) {
                    log.warning("Can't subsume disappeared body " +
                                "[where=" + where() + ", cluster=" + cl +
                                ", boid=" + bodyOid + "].");
                    continue;
                }

                // we subsume nearby pirates by queueing up their addition
                // to our cluster to be processed after we finish adding
                // ourselves to this cluster
                final ClusterRecord fclrec = clrec;
                _omgr.postRunnable(new Runnable() {
                    public void run () {
                        try {
                            log.info("Subsuming " + bobj.who() +
                                     " into " + fclrec.getCluster() + ".");
                            fclrec.addBody(bobj);

                        } catch (InvocationException ie) {
                            log.info("Unable to subsume neighbor " +
                                     "[cluster=" + fclrec.getCluster() +
                                     ", neighbor=" + bobj.who() +
                                     ", cause=" + ie.getMessage() + "].");
                        }
                    }
                });
            }
View Full Code Here

Examples of com.threerings.crowd.data.BodyObject

    /** Helper function for {@link #bodyAdded}. */
    protected void positionBody (Cluster cl, int bodyOid, List<SceneLocation> locs)
    {
        SceneLocation sloc = _ssobj.occupantLocs.get(Integer.valueOf(bodyOid));
        if (sloc == null) {
            BodyObject user = (BodyObject)_omgr.getObject(bodyOid);
            String who = (user == null) ? ("" + bodyOid) : user.who();
            log.warning("Can't position locationless user " +
                        "[where=" + where() + ", cluster=" + cl +
                        ", boid=" + who + "].");
            return;
        }
View Full Code Here

Examples of com.threerings.crowd.data.BodyObject

    public void traversePortal (ClientObject caller, int sceneId, int portalId,
                                int destSceneVer, SpotService.SpotSceneMoveListener listener)
        throws InvocationException
    {
        // le sanity check
        BodyObject body = _locator.forClient(caller);
        int cSceneId = ScenePlace.getSceneId(body);
        if (cSceneId != sceneId) {
            log.info("Ignoring stale traverse portal request",
                "caller", caller.who(), "oSceneId", sceneId, "portalId", portalId,
                "cSceneId", cSceneId);
            listener.requestCancelled();
            return;
        }

        // obtain the source scene
        SpotSceneManager srcmgr = (SpotSceneManager)getSceneManager(sceneId);
        if (srcmgr == null) {
            log.warning("Traverse portal missing source scene",
                "user", body.who(), "sceneId", sceneId, "portalId", portalId);
            throw new InvocationException(SpotCodes.INTERNAL_ERROR);
        }

        // obtain the destination scene and location id
        SpotScene rss = (SpotScene)srcmgr.getScene();
        Portal dest = rss.getPortal(portalId);

        // give the source scene manager a chance to do access control
        String errmsg = srcmgr.mayTraversePortal(body, dest);
        if (errmsg != null) {
            throw new InvocationException(errmsg);
        }

        // make sure this portal has valid info
        if (dest == null || !dest.isValid()) {
            log.warning("Traverse portal with invalid portal",
                "user", body.who(), "scene", srcmgr.where(), "pid", portalId, "portal", dest,
                "portals", rss.getPortals());
            throw new InvocationException(SpotCodes.NO_SUCH_PORTAL);
        }

        // resolve their destination scene
View Full Code Here

Examples of com.threerings.crowd.data.BodyObject

    // from interface SpotProvider
    public void changeLocation (ClientObject caller, int sceneId, Location loc,
                                SpotService.ConfirmListener listener)
        throws InvocationException
    {
        BodyObject source = _locator.forClient(caller);
        int cSceneId = ScenePlace.getSceneId(source);
        if (cSceneId != sceneId) {
            log.info("Rejecting changeLocation for invalid scene",
                "user", source.who(), "insid", cSceneId, "wantsid", sceneId, "loc", loc);
            throw new InvocationException(SpotCodes.INVALID_LOCATION);
        }

        // look up the scene manager for the specified scene
        SpotSceneManager smgr = (SpotSceneManager)getSceneManager(sceneId);
        if (smgr == null) {
            log.warning("User requested to change location from non-existent scene",
                "user", source.who(), "sceneId", sceneId, "loc", loc);
            throw new InvocationException(SpotCodes.INTERNAL_ERROR);
        }

        // pass the buck to yon scene manager
        smgr.handleChangeLoc(source, loc);
View Full Code Here

Examples of com.threerings.crowd.data.BodyObject

    // from interface SpotProvider
    public void joinCluster (ClientObject caller, int friendOid,
                             SpotService.ConfirmListener listener)
        throws InvocationException
    {
        BodyObject source = _locator.forClient(caller);
        int sceneId = ScenePlace.getSceneId(source);

        // look up the scene manager for the specified scene
        SpotSceneManager smgr = (SpotSceneManager)getSceneManager(sceneId);
        if (smgr == null) {
            log.warning("User requested to join cluster from non-existent scene",
                "user", source.who(), "sceneId", sceneId, "foid", friendOid);
            throw new InvocationException(SpotCodes.INTERNAL_ERROR);
        }

        // pass the buck to yon scene manager
        smgr.handleJoinCluster(source, friendOid);
View Full Code Here

Examples of com.threerings.crowd.data.BodyObject

    // from interface SpotProvider
    public void clusterSpeak (ClientObject caller, String message, byte mode)
    {
        // ensure the caller has normal chat access
        BodyObject source = _locator.forClient(caller);
        String errmsg = source.checkAccess(ChatCodes.CHAT_ACCESS, null);
        if (errmsg != null) {
            SpeakUtil.sendFeedback(source, MessageManager.GLOBAL_BUNDLE, errmsg);
        } else {
            sendClusterChatMessage(ScenePlace.getSceneId(source), source.getOid(),
                                   source.getVisibleName(), null, message, mode);
        }
    }
View Full Code Here

Examples of com.threerings.crowd.data.BodyObject

    // from interface SceneService
    public void moveTo (ClientObject caller, int sceneId, int sceneVer,
                        SceneService.SceneMoveListener listener)
    {
        BodyObject body = _locator.forClient(caller);
        resolveScene(sceneId, new SceneMoveHandler(_locman, body, sceneVer, listener));
    }
View Full Code Here

Examples of com.threerings.crowd.data.BodyObject

     * Returns true if the game is in progress and it is our turn; false
     * otherwise.
     */
    public boolean isOurTurn ()
    {
        BodyObject self = (BodyObject)_ctx.getClient().getClientObject();
        return (_gameObj.isInPlay() &&
                self.getVisibleName().equals(_turnGame.getTurnHolder()));
    }
View Full Code Here

Examples of com.threerings.crowd.data.BodyObject

                "creator", joiner.who(), "targetOid", targetOid);
            throw new InvocationException(NO_SUCH_CLUSTER);
        }

        // make sure we're in the same scene as said user
        BodyObject friend = (BodyObject)tobj;
        if (friend.getPlaceOid() != joiner.getPlaceOid()) {
            log.info("Refusing cluster join from non-proximate user",
                "joiner", joiner.who(), "jloc", joiner.location, "target", friend.who(),
                "tloc", friend.location);
            throw new InvocationException(NO_SUCH_CLUSTER);
        }

        // see if the friend is already in a cluster
        clrec = getCluster(friend.getOid());
        if (clrec != null) {
            clrec.addBody(joiner);
            return;
        }
View Full Code Here

Examples of com.threerings.crowd.data.BodyObject

    /**
     * Fetches the cluster record for the specified body.
     */
    protected ClusterRecord getCluster (int bodyOid)
    {
        BodyObject bobj = (BodyObject)_omgr.getObject(bodyOid);
        if (bobj instanceof ClusteredBodyObject) {
            return _clusters.get(((ClusteredBodyObject)bobj).getClusterOid());
        } else {
            return null;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.