*/
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);