Synced weather

This commit is contained in:
Anuken
2020-05-08 21:55:40 -04:00
parent 95a1d84eb9
commit bc658f9f45
16 changed files with 25 additions and 3 deletions

View File

@@ -179,7 +179,7 @@ public class Logic implements ApplicationListener{
if(entry.cooldown < 0 && !entry.weather.isActive()){
float duration = Mathf.random(entry.minDuration, entry.maxDuration);
entry.cooldown = duration + Mathf.random(entry.minFrequency, entry.maxFrequency);
entry.weather.create(entry.intensity, duration);
Call.createWeather(entry.weather, entry.intensity, duration);
}
}
}
@@ -237,7 +237,11 @@ public class Logic implements ApplicationListener{
universe.update();
}
Time.update();
updateWeather();
//weather is serverside
if(!net.client()){
updateWeather();
}
if(state.rules.waves && state.rules.waveTimer && !state.gameOver){
if(!state.rules.waitForWaveToEnd || state.enemies == 0){

View File

@@ -67,6 +67,11 @@ public abstract class Weather extends MappableContent{
return ContentType.weather;
}
@Remote
public static void createWeather(Weather weather, float intensity, float duration){
weather.create(intensity, duration);
}
public static class WeatherEntry{
/** The type of weather used. */
public Weather weather;