Search in sources :

Example 1 with InputDeviceConfigurationImpl

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

the class ConfigurationSubsystem method preInitialise.

@Override
public void preInitialise(Context rootContext) {
    config = new Config(rootContext);
    config.load();
    String serverPortProperty = System.getProperty(SERVER_PORT_PROPERTY);
    if (serverPortProperty != null) {
        try {
            config.getNetwork().setServerPort(Integer.parseInt(serverPortProperty));
        } catch (NumberFormatException e) {
            logger.error("Failed to set server port to invalid value: {}", serverPortProperty);
        }
    }
    if (Iterables.isEmpty(config.getDefaultModSelection().listModules())) {
        config.getDefaultModSelection().addModule(TerasologyConstants.CORE_GAMEPLAY_MODULE);
    }
    checkServerIdentity();
    // TODO: Move to display subsystem
    logger.info("Video Settings: {}", config.renderConfigAsJson(config.getRendering()));
    rootContext.put(Config.class, config);
    // add facades
    rootContext.put(InputDeviceConfiguration.class, new InputDeviceConfigurationImpl(config));
    rootContext.put(BindsConfiguration.class, new BindsConfigurationImpl(config));
}
Also used : BindsConfigurationImpl(org.terasology.engine.config.facade.BindsConfigurationImpl) Config(org.terasology.engine.config.Config) InputDeviceConfigurationImpl(org.terasology.engine.config.facade.InputDeviceConfigurationImpl)

Aggregations

Config (org.terasology.engine.config.Config)1 BindsConfigurationImpl (org.terasology.engine.config.facade.BindsConfigurationImpl)1 InputDeviceConfigurationImpl (org.terasology.engine.config.facade.InputDeviceConfigurationImpl)1