Search in sources :

Example 1 with FirstPlayerEventWaveServerSystem

use of de.gg.game.systems.server.FirstPlayerEventWaveServerSystem in project ProjektGG by eskalon.

the class AuthoritativeSession method init.

/**
 * {@inheritDoc}
 */
@Override
public void init(HashMap<Short, LobbyPlayer> players, @Nullable SavedGame savedGame) {
    for (LobbyPlayer player : players.values()) {
        player.setReady(false);
    }
    super.init(players, savedGame);
    // FIXME wenn man ein zweites mal ein spiel hostet, kann es passieren,
    // dass während dem obigen init() der GameLoadingScreen fertig wird.
    // Während dann die Modelle gesetzt werden, werden im init nochmals die
    // Buildings verändert. -> zusammenlegen
    // Setup the server processing systems
    ServerProcessingSystem<Character> s;
    s = new FirstCharacterEventWaveServerSystem(clientResultListeners);
    s.init(world, sessionSetup.getSeed());
    this.characterSystems.add(s);
    s = new NpcActionSystem(clientResultListeners);
    s.init(world, sessionSetup.getSeed());
    this.characterSystems.add(s);
    s = new NpcActionSystem2(clientResultListeners);
    s.init(world, sessionSetup.getSeed());
    this.characterSystems.add(s);
    ServerProcessingSystem<Player> s2;
    s2 = new FirstPlayerEventWaveServerSystem(clientResultListeners);
    s2.init(world, sessionSetup.getSeed());
    this.playerSystems.add(s2);
    s2 = new IllnessDamageSystem(clientResultListeners);
    s2.init(world, sessionSetup.getSeed());
    this.playerSystems.add(s2);
    // Load the systems states
    if (savedGame != null) {
        for (ProcessingSystem<Character> c : characterSystems) {
            ((ServerProcessingSystem<Character>) c).loadSavedState(savedGame.processingSystemStates.get(c.getClass().getSimpleName()));
        }
        for (ProcessingSystem<Player> p : playerSystems) {
            ((ServerProcessingSystem<Player>) p).loadSavedState(savedGame.processingSystemStates.get(p.getClass().getSimpleName()));
        }
    }
}
Also used : NpcActionSystem(de.gg.game.systems.server.NpcActionSystem) LobbyPlayer(de.gg.game.network.LobbyPlayer) Player(de.gg.game.model.entities.Player) Character(de.gg.game.model.entities.Character) NpcActionSystem2(de.gg.game.systems.server.NpcActionSystem2) FirstPlayerEventWaveServerSystem(de.gg.game.systems.server.FirstPlayerEventWaveServerSystem) ServerProcessingSystem(de.gg.game.systems.server.ServerProcessingSystem) LobbyPlayer(de.gg.game.network.LobbyPlayer) FirstCharacterEventWaveServerSystem(de.gg.game.systems.server.FirstCharacterEventWaveServerSystem) IllnessDamageSystem(de.gg.game.systems.server.IllnessDamageSystem)

Aggregations

Character (de.gg.game.model.entities.Character)1 Player (de.gg.game.model.entities.Player)1 LobbyPlayer (de.gg.game.network.LobbyPlayer)1 FirstCharacterEventWaveServerSystem (de.gg.game.systems.server.FirstCharacterEventWaveServerSystem)1 FirstPlayerEventWaveServerSystem (de.gg.game.systems.server.FirstPlayerEventWaveServerSystem)1 IllnessDamageSystem (de.gg.game.systems.server.IllnessDamageSystem)1 NpcActionSystem (de.gg.game.systems.server.NpcActionSystem)1 NpcActionSystem2 (de.gg.game.systems.server.NpcActionSystem2)1 ServerProcessingSystem (de.gg.game.systems.server.ServerProcessingSystem)1