mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-12-15 15:20:57 -08:00
organized logic to be more clean
This commit is contained in:
parent
77765d4037
commit
b52bb0f890
2 changed files with 15 additions and 12 deletions
|
|
@ -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 weather’s attributes
|
||||
float mult = entry.weather.attrs.get(Attribute.fogVisibilityMultiplier);
|
||||
if(mult != 0f)
|
||||
{
|
||||
fogMultiplier *= mult;
|
||||
}
|
||||
}
|
||||
Events.fire(new FogWeatherEvent(fogMultiplier));
|
||||
updateFogFromWeather();
|
||||
|
||||
|
||||
PerfCounter.entityUpdate.begin();
|
||||
|
|
|
|||
|
|
@ -642,8 +642,7 @@ public class UnitType extends UnlockableContent implements Senseable{
|
|||
|
||||
}
|
||||
|
||||
public void updateFogRadius(float multiplier)
|
||||
{
|
||||
public void updateFogRadius(float multiplier){
|
||||
fogRadius = baseFogRadius * multiplier;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue