var nightmode_value = 0.1;
var nightmode_modelBrightness = 1.5;
function worldColor(){
var props = 0;
if(!Entity.GetLocalPlayer()) return;
if(checkbox_states["world_color"]){
var worldColor = UI.GetColor("Script items", "World color");
Convar.SetFloat('mat_ambient_light_r', worldColor[0] / 100);
Convar.SetFloat('mat_ambient_light_g', worldColor[1] / 100);
Convar.SetFloat('mat_ambient_light_b', worldColor[2] / 100);
}
else{
Convar.SetFloat('mat_ambient_light_r', 0);
Convar.SetFloat('mat_ambient_light_g', 0);
Convar.SetFloat('mat_ambient_light_b', 0);
}
var worldBrightness = slider_values["world_brightness"];
if(worldBrightness < 0){
worldBrightness = 1 / Math.abs(worldBrightness / 2);
}
if(Convar.GetString("mat_force_tonemap_scale") != worldBrightness){
Convar.SetString("mat_force_tonemap_scale", worldBrightness + "");
}
}
function worldColor2(entity){
var custom_bloom = /*(slider_values["bloom_scale"] !== 0)*/true;
var props = 0;
if(props == 0){
Entity.SetProp(entity, 'CEnvTonemapController', 'm_bUseCustomAutoExposureMin', custom_bloom);
Entity.SetProp(entity, 'CEnvTonemapController', 'm_bUseCustomAutoExposureMax', custom_bloom);
Entity.SetProp(entity, 'CEnvTonemapController', 'm_bUseCustomBloomScale', custom_bloom);
props = 1;
}
if(props == 1){
//Entity.SetProp(entity, 'CEnvTonemapController', 'm_flCustomAutoExposureMin', slider_values["world_brightness"]);
//Entity.SetProp(entity, 'CEnvTonemapController', 'm_flCustomAutoExposureMax', slider_values["world_brightness"]);
if(custom_bloom){
Entity.SetProp(entity, 'CEnvTonemapController', 'm_flCustomBloomScale', slider_values["bloom_scale"] / 10);
}
}
var nightmodeAddition = (checkbox_states["darker_nightmode"]) ? nightmode_modelBrightness : 0;
Convar.SetFloat("r_modelAmbientMin", slider_values["model_brightness"] / 10 + nightmodeAddition);
}