Add a custom data point that allows maps to have custom time values

This commit is contained in:
Sam 2017-12-30 20:58:19 +00:00 committed by Alexander Meech
parent 738479b4ea
commit b69ec7c87f

View File

@ -81,6 +81,7 @@ import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.kit.perks.event.PerkDestructorBlockEvent;
import nautilus.game.arcade.world.WorldData;
public class GameFlagManager implements Listener
{
@ -1076,6 +1077,39 @@ public class GameFlagManager implements Listener
}
}
}
@EventHandler
public void customWorldTime(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
{
return;
}
WorldData worldData = event.GetGame().WorldData;
worldData.GetAllCustomLocs().forEach((key, value) ->
{
if (key.startsWith("TIME_SET"))
{
String[] split = key.split(" ");
if (split.length < 2)
{
return;
}
try
{
event.GetGame().WorldTimeSet = Integer.parseInt(split[1]);
}
catch (NumberFormatException e)
{
event.GetGame().Announce(F.main("Game", "Warning! Invalid TIME_SET data point."));
}
}
});
}
@EventHandler
public void WorldWeather(UpdateEvent event)