Don't set lighting if the preset has noLighting = true (#8519)

* Don't set lighting if the preset has noLighting = true

Allows lighting in the preset or world processors to take over instead of being forced to disable lighting.

* Less confusing style
This commit is contained in:
MEEPofFaith
2023-04-21 18:56:16 -07:00
committed by GitHub
parent abc80b9aab
commit 1314dfe53e

View File

@@ -82,12 +82,11 @@ public class Universe{
}
}
if(state.hasSector() && state.getSector().planet.updateLighting){
boolean disable = state.getSector().preset != null && state.getSector().preset.noLighting;
if(state.hasSector() && state.getSector().planet.updateLighting && !(state.getSector().preset != null && state.getSector().preset.noLighting)){
var planet = state.getSector().planet;
//update sector light
float light = state.getSector().getLight();
float alpha = disable ? 1f : Mathf.clamp(Mathf.map(light, planet.lightSrcFrom, planet.lightSrcTo, planet.lightDstFrom, planet.lightDstTo));
float alpha = Mathf.clamp(Mathf.map(light, planet.lightSrcFrom, planet.lightSrcTo, planet.lightDstFrom, planet.lightDstTo));
//assign and map so darkness is not 100% dark
state.rules.ambientLight.a = 1f - alpha;