Better sector null checks

This commit is contained in:
Anuken
2020-03-01 12:15:38 -05:00
parent 51cec64118
commit 3ed5282e14
7 changed files with 14 additions and 12 deletions

View File

@@ -44,12 +44,14 @@ public class Universe{
}
}
//update sector light
float light = state.getSector().getLight();
float alpha = Mathf.clamp(Mathf.map(light, 0f, 0.8f, 0.1f, 1f));
//assign and map so darkness is not 100% dark
state.rules.ambientLight.a = 1f - alpha;
state.rules.lighting = !Mathf.equal(alpha, 1f);
if(state.hasSector()){
//update sector light
float light = state.getSector().getLight();
float alpha = Mathf.clamp(Mathf.map(light, 0f, 0.8f, 0.1f, 1f));
//assign and map so darkness is not 100% dark
state.rules.ambientLight.a = 1f - alpha;
state.rules.lighting = !Mathf.equal(alpha, 1f);
}
}
public float secondsMod(float mod, float scale){