Enable rejoining in other games

This commit is contained in:
Sam 2018-07-23 13:34:04 +01:00 committed by Alexander Meech
parent 137c0f4b65
commit ec1038bce6
7 changed files with 46 additions and 12 deletions

View File

@ -90,6 +90,7 @@ import nautilus.game.arcade.game.games.bridge.kits.KitDestructor;
import nautilus.game.arcade.game.games.bridge.kits.KitMiner; import nautilus.game.arcade.game.games.bridge.kits.KitMiner;
import nautilus.game.arcade.game.games.bridge.mission.KillLastTracker; import nautilus.game.arcade.game.games.bridge.mission.KillLastTracker;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.game.modules.rejoin.RejoinModule;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.perks.PerkBomber; import nautilus.game.arcade.kit.perks.PerkBomber;
import nautilus.game.arcade.ore.OreHider; import nautilus.game.arcade.ore.OreHider;
@ -125,6 +126,7 @@ public class Bridge extends TeamGame implements OreObsfucation
private boolean _bridgesDown = false; private boolean _bridgesDown = false;
private BridgeAnimation _animation; private BridgeAnimation _animation;
private CustomBridgeAnimation[] _customAnimations; private CustomBridgeAnimation[] _customAnimations;
private final RejoinModule _rejoinModule;
private HashSet<BridgePart> _bridgeParts = new HashSet<BridgePart>(); private HashSet<BridgePart> _bridgeParts = new HashSet<BridgePart>();
@ -270,6 +272,9 @@ public class Bridge extends TeamGame implements OreObsfucation
.setGiveCompassToAlive(true) .setGiveCompassToAlive(true)
.register(this); .register(this);
_rejoinModule = new RejoinModule(manager);
_rejoinModule.register(this);
// So that we can be 110% sure // So that we can be 110% sure
for (Kit kit : GetKits()) for (Kit kit : GetKits())
{ {
@ -877,6 +882,7 @@ public class Bridge extends TeamGame implements OreObsfucation
{ {
_bridgesDown = true; _bridgesDown = true;
Manager.GetExplosion().SetLiquidDamage(true); Manager.GetExplosion().SetLiquidDamage(true);
_rejoinModule.disableRejoining();
Announce(C.cRedB + "ALERT: " + C.Reset + C.Bold + "THE BRIDGES ARE SPAWNING!"); Announce(C.cRedB + "ALERT: " + C.Reset + C.Bold + "THE BRIDGES ARE SPAWNING!");
UtilTextMiddle.display(C.cRedB + "ALERT", "The BRIDGES ARE SPAWNING!"); UtilTextMiddle.display(C.cRedB + "ALERT", "The BRIDGES ARE SPAWNING!");
@ -903,17 +909,7 @@ public class Bridge extends TeamGame implements OreObsfucation
return; return;
} }
Iterator<BridgePart> partIterator = _bridgeParts.iterator(); _bridgeParts.removeIf(BridgePart::Update);
while (partIterator.hasNext())
{
BridgePart part = partIterator.next();
if (part.Update())
{
partIterator.remove();
}
}
} }
@EventHandler @EventHandler

View File

@ -56,6 +56,7 @@ import nautilus.game.arcade.game.games.common.dominate_data.PlayerData;
import nautilus.game.arcade.game.games.common.dominate_data.Resupply; import nautilus.game.arcade.game.games.common.dominate_data.Resupply;
import nautilus.game.arcade.game.modules.SpawnRegenerationModule; import nautilus.game.arcade.game.modules.SpawnRegenerationModule;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.game.modules.rejoin.RejoinModule;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
public class CaptureTheFlag extends TeamGame public class CaptureTheFlag extends TeamGame
@ -106,6 +107,9 @@ public class CaptureTheFlag extends TeamGame
this.HungerSet = 20; this.HungerSet = 20;
this.WorldTimeSet = 2000; this.WorldTimeSet = 2000;
new RejoinModule(manager)
.register(this);
new CompassModule() new CompassModule()
.setGiveCompass(true) .setGiveCompass(true)
.setGiveCompassToSpecs(true) .setGiveCompassToSpecs(true)

View File

@ -45,6 +45,7 @@ import nautilus.game.arcade.game.games.common.dominate_data.PlayerData;
import nautilus.game.arcade.game.games.common.dominate_data.Resupply; import nautilus.game.arcade.game.games.common.dominate_data.Resupply;
import nautilus.game.arcade.game.modules.SpawnRegenerationModule; import nautilus.game.arcade.game.modules.SpawnRegenerationModule;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.game.modules.rejoin.RejoinModule;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
public class Domination extends TeamGame public class Domination extends TeamGame
@ -85,6 +86,9 @@ public class Domination extends TeamGame
this.DeathSpectateSecs = 10; this.DeathSpectateSecs = 10;
new RejoinModule(manager)
.register(this);
new CompassModule() new CompassModule()
.setGiveCompass(true) .setGiveCompass(true)
.setGiveCompassToSpecs(true) .setGiveCompassToSpecs(true)

View File

@ -59,6 +59,7 @@ import nautilus.game.arcade.game.games.draw.tools.ToolCircle;
import nautilus.game.arcade.game.games.draw.tools.ToolLine; import nautilus.game.arcade.game.games.draw.tools.ToolLine;
import nautilus.game.arcade.game.games.draw.tools.ToolSquare; import nautilus.game.arcade.game.games.draw.tools.ToolSquare;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.game.modules.rejoin.RejoinModule;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.DrawGuessStatTracker; import nautilus.game.arcade.stats.DrawGuessStatTracker;
@ -262,6 +263,9 @@ public class Draw extends SoloGame
new ChatStatData("PureLuck", "Lucky Guesses", true) new ChatStatData("PureLuck", "Lucky Guesses", true)
); );
new RejoinModule(manager)
.register(this);
new CompassModule() new CompassModule()
.setGiveCompass(true) .setGiveCompass(true)
.setGiveCompassToSpecs(true) .setGiveCompassToSpecs(true)

View File

@ -117,6 +117,8 @@ import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerLeaper;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerRadar; import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerRadar;
import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerTNT; import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerTNT;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.game.modules.rejoin.PlayerRejoinGameEvent;
import nautilus.game.arcade.game.modules.rejoin.RejoinModule;
import nautilus.game.arcade.game.team.selectors.RatioSelector; import nautilus.game.arcade.game.team.selectors.RatioSelector;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.kit.NullKit;
@ -358,6 +360,9 @@ public class HideSeek extends TeamGame
//Need ideas for this one //Need ideas for this one
registerChatStats(); registerChatStats();
new RejoinModule(manager)
.register(this);
new CompassModule() new CompassModule()
.setGiveCompass(true) .setGiveCompass(true)
.setGiveCompassToSpecs(true) .setGiveCompassToSpecs(true)
@ -1487,6 +1492,12 @@ public class HideSeek extends TeamGame
} }
} }
@EventHandler(ignoreCancelled = true)
public void playerRejoin(PlayerRejoinGameEvent event)
{
event.getPlayerGameInfo().setTeam(_seekers);
}
public GameTeam getHiders() public GameTeam getHiders()
{ {
return _hiders; return _hiders;

View File

@ -63,6 +63,7 @@ import nautilus.game.arcade.game.games.turfforts.kits.KitMarksman;
import nautilus.game.arcade.game.games.turfforts.kits.KitShredder; import nautilus.game.arcade.game.games.turfforts.kits.KitShredder;
import nautilus.game.arcade.game.games.turfforts.mission.KillMidAirMissionTracker; import nautilus.game.arcade.game.games.turfforts.mission.KillMidAirMissionTracker;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.game.modules.rejoin.RejoinModule;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.BehindEnemyLinesStatTracker; import nautilus.game.arcade.stats.BehindEnemyLinesStatTracker;
@ -177,6 +178,9 @@ public class TurfForts extends TeamGame
new ChatStatData("BlocksBroken", "Blocks Broken", true) new ChatStatData("BlocksBroken", "Blocks Broken", true)
); );
new RejoinModule(manager)
.register(this);
new CompassModule() new CompassModule()
.setGiveCompass(true) .setGiveCompass(true)
.setGiveCompassToSpecs(true) .setGiveCompassToSpecs(true)

View File

@ -47,6 +47,12 @@ public class RejoinModule extends Module
UtilServer.Unregister(_manager); UtilServer.Unregister(_manager);
} }
public void disableRejoining()
{
getGame().QuitOut = true;
_rejoinData.clear();
}
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void playerQuit(PlayerQuitEvent event) public void playerQuit(PlayerQuitEvent event)
{ {
@ -135,7 +141,7 @@ public class RejoinModule extends Module
{ {
private final double _health; private final double _health;
private final Kit _kit; private final Kit _kit;
private final GameTeam _team; private GameTeam _team;
private boolean _cancelled; private boolean _cancelled;
PlayerGameInfo(double health, Kit kit, GameTeam team) PlayerGameInfo(double health, Kit kit, GameTeam team)
@ -155,6 +161,11 @@ public class RejoinModule extends Module
return _kit; return _kit;
} }
public void setTeam(GameTeam team)
{
_team = team;
}
public GameTeam getTeam() public GameTeam getTeam()
{ {
return _team; return _team;