Add a custom data point that allows maps to have custom time values
This commit is contained in:
parent
738479b4ea
commit
b69ec7c87f
@ -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
|
||||
{
|
||||
@ -1077,6 +1078,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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user