Search in sources :

Example 1 with PlayerConfig

use of org.terasology.engine.config.PlayerConfig in project Terasology by MovingBlocks.

the class ClientConnectionHandler method sendJoin.

/**
 * Sends a join request from the client upstream to the server.
 * @param channelHandlerContext
 */
private void sendJoin(ChannelHandlerContext channelHandlerContext) {
    Config config = CoreRegistry.get(Config.class);
    PlayerConfig playerConfig = CoreRegistry.get(PlayerConfig.class);
    NetData.JoinMessage.Builder bldr = NetData.JoinMessage.newBuilder();
    NetData.Color.Builder clrbldr = NetData.Color.newBuilder();
    bldr.setName(playerConfig.playerName.get());
    bldr.setViewDistanceLevel(config.getRendering().getViewDistance().getIndex());
    bldr.setColor(clrbldr.setRgba(playerConfig.color.get().rgba()).build());
    channelHandlerContext.channel().writeAndFlush(NetData.NetMessage.newBuilder().setJoin(bldr).build());
}
Also used : Config(org.terasology.engine.config.Config) PlayerConfig(org.terasology.engine.config.PlayerConfig) PlayerConfig(org.terasology.engine.config.PlayerConfig)

Example 2 with PlayerConfig

use of org.terasology.engine.config.PlayerConfig in project Terasology by MovingBlocks.

the class GameConfigurationMetric method fetchConfig.

private void fetchConfig() {
    Config config = context.get(Config.class);
    SystemConfig systemConfig = context.get(SystemConfig.class);
    language = systemConfig.locale.get().toString();
    PlayerConfig playerConfig = context.get(PlayerConfig.class);
    playerHeight = playerConfig.height.get();
    playerEyeHeight = playerConfig.eyeHeight.get();
}
Also used : SystemConfig(org.terasology.engine.config.SystemConfig) Config(org.terasology.engine.config.Config) SystemConfig(org.terasology.engine.config.SystemConfig) PlayerConfig(org.terasology.engine.config.PlayerConfig) PlayerConfig(org.terasology.engine.config.PlayerConfig)

Example 3 with PlayerConfig

use of org.terasology.engine.config.PlayerConfig in project Terasology by MovingBlocks.

the class SetupLocalPlayer method step.

@Override
public boolean step() {
    PlayerConfig playerConfig = context.get(PlayerConfig.class);
    Client localClient = context.get(NetworkSystem.class).joinLocal(playerConfig.playerName.get(), playerConfig.color.get());
    context.get(LocalPlayer.class).setClientEntity(localClient.getEntity());
    return true;
}
Also used : LocalPlayer(org.terasology.engine.logic.players.LocalPlayer) NetworkSystem(org.terasology.engine.network.NetworkSystem) Client(org.terasology.engine.network.Client) PlayerConfig(org.terasology.engine.config.PlayerConfig)

Aggregations

PlayerConfig (org.terasology.engine.config.PlayerConfig)3 Config (org.terasology.engine.config.Config)2 SystemConfig (org.terasology.engine.config.SystemConfig)1 LocalPlayer (org.terasology.engine.logic.players.LocalPlayer)1 Client (org.terasology.engine.network.Client)1 NetworkSystem (org.terasology.engine.network.NetworkSystem)1