Search in sources :

Example 1 with BindsConfigurationImpl

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

the class ConfigurationSubsystem method preInitialise.

@Override
public void preInitialise(Context rootContext) {
    config = new Config(rootContext);
    config.load();
    FlexibleConfigManager flexibleConfigManager = new FlexibleConfigManagerImpl();
    rootContext.put(FlexibleConfigManager.class, flexibleConfigManager);
    // TODO: Update rendering config description
    FlexibleConfig renderingFlexibleConfig = new FlexibleConfigImpl("Rendering Config");
    flexibleConfigManager.addConfig(new SimpleUri("engine:rendering"), renderingFlexibleConfig);
    flexibleConfigManager.loadAllConfigs();
    // Add settings to RenderingFC
    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 : FlexibleConfigImpl(org.terasology.config.flexible.FlexibleConfigImpl) BindsConfigurationImpl(org.terasology.config.facade.BindsConfigurationImpl) FlexibleConfig(org.terasology.config.flexible.FlexibleConfig) Config(org.terasology.config.Config) SimpleUri(org.terasology.engine.SimpleUri) FlexibleConfigManagerImpl(org.terasology.config.flexible.FlexibleConfigManagerImpl) FlexibleConfig(org.terasology.config.flexible.FlexibleConfig) InputDeviceConfigurationImpl(org.terasology.config.facade.InputDeviceConfigurationImpl) FlexibleConfigManager(org.terasology.config.flexible.FlexibleConfigManager)

Aggregations

Config (org.terasology.config.Config)1 BindsConfigurationImpl (org.terasology.config.facade.BindsConfigurationImpl)1 InputDeviceConfigurationImpl (org.terasology.config.facade.InputDeviceConfigurationImpl)1 FlexibleConfig (org.terasology.config.flexible.FlexibleConfig)1 FlexibleConfigImpl (org.terasology.config.flexible.FlexibleConfigImpl)1 FlexibleConfigManager (org.terasology.config.flexible.FlexibleConfigManager)1 FlexibleConfigManagerImpl (org.terasology.config.flexible.FlexibleConfigManagerImpl)1 SimpleUri (org.terasology.engine.SimpleUri)1