organized logic to be more clean

This commit is contained in:
lion 2025-11-19 16:15:49 -08:00
parent 77765d4037
commit b52bb0f890
2 changed files with 15 additions and 12 deletions

View file

@ -363,6 +363,19 @@ public class Logic implements ApplicationListener{
}
}
void updateFogFromWeather(){
float fogMultiplier = 1f;
for(WeatherState entry : Groups.weather){
float mult = entry.weather.attrs.get(Attribute.fogVisibilityMultiplier);
if(mult != 0f){
fogMultiplier *= mult;
}
}
Events.fire(new FogWeatherEvent(fogMultiplier));
}
@Remote(called = Loc.server)
public static void sectorCapture(){
//the sector has been conquered - waves get disabled
@ -539,16 +552,7 @@ public class Logic implements ApplicationListener{
Groups.weather.each(w -> state.envAttrs.add(w.weather.attrs, w.opacity));
//apply fog effects
float fogMultiplier = 1f;
for(WeatherState entry : Groups.weather){
// get the fog multiplier from the weathers attributes
float mult = entry.weather.attrs.get(Attribute.fogVisibilityMultiplier);
if(mult != 0f)
{
fogMultiplier *= mult;
}
}
Events.fire(new FogWeatherEvent(fogMultiplier));
updateFogFromWeather();
PerfCounter.entityUpdate.begin();

View file

@ -642,8 +642,7 @@ public class UnitType extends UnlockableContent implements Senseable{
}
public void updateFogRadius(float multiplier)
{
public void updateFogRadius(float multiplier){
fogRadius = baseFogRadius * multiplier;
}