Package gwlpr.mapshard.models

Examples of gwlpr.mapshard.models.WorldPosition


        Position pos = et.get(Position.class);
        Direction dir = et.get(Direction.class);
        Movement move = et.get(Movement.class);

        // extract info
        WorldPosition position = new WorldPosition(
                action.getPositionVector(),
                (int) action.getPositionPlane());

        Vector2 direction = action.getMoveDirection();
View Full Code Here


        Entity et = client.getEntity();
        Position pos = et.get(Position.class);
        Movement move = et.get(Movement.class);

        // extract info
        WorldPosition position = new WorldPosition(
                action.getPositionVector(),
                (int) action.getPositionPlane());
       
        // this should not be done directly:
        pos.position = position;
View Full Code Here

            ClientBean client = event.getHandle().get();
           
            // create a new entity of the character of this client
            // NOTE THAT FOR IDENTIFICATION PURPOSES, WE USE THE CLIENTS UID FOR
            // ITS CHARACTER ENTITY AS WELL!
            WorldPosition pos = getRandomSpawn();
            Entity player = CharacterFactory.createCharacter(event.getHandle().getUid(), client.getCharacter(), pos, entityManager);

            client.setEntity(player);
            client.setAgentIDs(player.get(AgentIdentifiers.class));
View Full Code Here

        ClientBean client = ClientBean.get(action.getChannel());

        // fetch the players postion (this was already initialized by the handshake controller,
        // when it instructed some other class to create the entity
        Entity et = client.getEntity();
        WorldPosition pos = et.get(Position.class).position;

        InstanceLoadView.sendSpawnPoint(client.getChannel(), pos, world.getMap().getHash());
    }
View Full Code Here

        int radius = spawn.getRadius();
       
        // pick a random position in a certain radius
        float t = (float)(2 * Math.PI * Math.random());
        float r = (float)(radius * -1 + (Math.random() * radius));
        WorldPosition pos = new WorldPosition(
                (float)(spawn.getX() + (r * Math.cos(t))),
                (float)(spawn.getY() + (r * Math.sin(t))),
                spawn.getPlane());
       
        return pos;
View Full Code Here

            if (!thisEntity.has(View.class)) { continue; }

            View thisView = thisEntity.get(View.class);

            // get the position for distance calcs later on
            WorldPosition thisPostion = thisEntity.get(Position.class).position;

            for (Entity otherEntity : entities)
            {
                if (thisEntity == otherEntity) { continue; }

                // get the position for distance calcs later on
                WorldPosition otherPostion = otherEntity.get(Position.class).position;

                boolean canSee = false;

                // we need to be able to see the other entity, and it needs to be visible in general
                // then we can check if it is also in view-distance
View Full Code Here

     */
    public static void spawnAgent(Channel channel,  Entity entity)
    {
        // retrieve entity-info
        AgentIdentifiers agentIDs = entity.get(AgentIdentifiers.class);
        WorldPosition pos = entity.get(Position.class).position;
        Direction direction = entity.get(Direction.class);
        Vector2 dir = direction.direction;
        float rotation = direction.rotation;
        Movement move = entity.get(Movement.class);
        SpawnData faction = entity.get(SpawnData.class);
       
        if (faction.spawnType == SpawnType.Player)
        {
           sendPlayerAppearance(channel, entity);
        }
        else if (faction.spawnType == SpawnType.NPC || faction.spawnType == SpawnType.Ally)
        {
            sendNPCGeneralPackets(channel, entity);
        }
        else
        {
            // NOTE THIS BUG: hardcoded: we currently only spawn npcs and players automatically.
            return;
        }

        // send spawn agent packet
        P021_SpawnAgent spawnAgent = new P021_SpawnAgent();
        spawnAgent.init(channel);
        spawnAgent.setAgentID(agentIDs.agentID);
        spawnAgent.setFacColorLocalID((faction.factionColor << 24) | agentIDs.localID); // is this the localid?
        spawnAgent.setUnknown1((byte) 1);
        spawnAgent.setUnknown2((byte) 9);//5);
        spawnAgent.setPositionVector(pos);
        spawnAgent.setPositionPlane(pos.getZPlane());
        spawnAgent.setDirectionRotation(new Vector2(Float.POSITIVE_INFINITY, rotation));
        spawnAgent.setUnknown3((short)1);
        spawnAgent.setMoveSpeed(move.speed);
        spawnAgent.setUnknown4(1F);//Float.POSITIVE_INFINITY);
        spawnAgent.setUnknown5(0x41400000);
View Full Code Here

    public static void sendUpdateMovement(Channel channel, Entity entity)
    {
        // retrieve the entity related data we need...
        int agentID = entity.get(AgentIdentifiers.class).agentID;
        Movement move = entity.get(Movement.class);
        WorldPosition curPos = entity.get(Position.class).position;
        WorldPosition moveTo = move.moveAim;
        MovementType movT = move.moveType;
       
        // send the messages
        P032_SpeedModifier speedMod = new P032_SpeedModifier();
        speedMod.init(channel);
        speedMod.setAgentID(agentID);
        speedMod.setModifier(movT.getSpeedModifier());
        speedMod.setMovementType(movT.getVal());

        channel.writeAndFlush(speedMod);

        // TODO check me: this is probably the place that the player would reach within
        // the next time step.
        P030_AgentMoveToPoint moveToPoint = new P030_AgentMoveToPoint();
        moveToPoint.init(channel);
        moveToPoint.setAgentID(agentID);
        moveToPoint.setMoveAim(moveTo);
        moveToPoint.setCurrentPlane(curPos.getZPlane());
        moveToPoint.setNextPlane(moveTo.getZPlane());

        channel.writeAndFlush(moveToPoint);
    }
View Full Code Here

TOP

Related Classes of gwlpr.mapshard.models.WorldPosition

Copyright © 2018 www.massapicom. 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.