fixing giant facing.

This commit is contained in:
Sarah 2015-12-05 19:00:44 +01:00
parent a3d6af884d
commit 4c4b997453

View File

@ -87,6 +87,7 @@ public class TypeWars extends TeamGame
private HashMap<GameTeam, ArrayList<Location>> _giantAttackZones; private HashMap<GameTeam, ArrayList<Location>> _giantAttackZones;
private HashMap<GameTeam, Giant> _giants; private HashMap<GameTeam, Giant> _giants;
private HashMap<Giant, Location> _giantLocs;
private HashMap<GameTeam, Integer> _minionsSpawned; private HashMap<GameTeam, Integer> _minionsSpawned;
private HashMap<GameTeam, Long> _giantsAttacked; private HashMap<GameTeam, Long> _giantsAttacked;
@ -146,6 +147,7 @@ public class TypeWars extends TeamGame
_minionsSpawned = new HashMap<>(); _minionsSpawned = new HashMap<>();
_giantsAttacked = new HashMap<>(); _giantsAttacked = new HashMap<>();
_playerTitles = new HashSet<>(); _playerTitles = new HashSet<>();
_giantLocs = new HashMap<>();
_animationTicks = 0; _animationTicks = 0;
_nukeFrame = 0; _nukeFrame = 0;
@ -194,17 +196,17 @@ public class TypeWars extends TeamGame
public void prepareGiants() public void prepareGiants()
{ {
Location red = WorldData.GetDataLocs("PURPLE").get(0); Location red = WorldData.GetDataLocs("PURPLE").get(0).clone();
Location blue = WorldData.GetDataLocs("LIME").get(0); Location blue = WorldData.GetDataLocs("LIME").get(0).clone();
red.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(red, blue)));
red.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(red, blue))); red.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(red, blue)));
blue.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(blue, red)));
blue.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(blue, red))); blue.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(blue, red)));
red.add(0, 1, 0); red.getBlock().setType(Material.STONE);
blue.add(0, 1, 0); blue.getBlock().setType(Material.STONE);
red.add(0, 2, 0);
blue.add(0, 2, 0);
int i = 0; int i = 0;
for(GameTeam team : GetTeamList()) for(GameTeam team : GetTeamList())
@ -215,6 +217,7 @@ public class TypeWars extends TeamGame
this.CreatureAllowOverride = true; this.CreatureAllowOverride = true;
Giant giant = loc.getWorld().spawn(loc, Giant.class); Giant giant = loc.getWorld().spawn(loc, Giant.class);
_giantLocs.put(giant, loc.clone());
this.CreatureAllowOverride = false; this.CreatureAllowOverride = false;
giant.setRemoveWhenFarAway(false); giant.setRemoveWhenFarAway(false);
UtilEnt.Vegetate(giant, true); UtilEnt.Vegetate(giant, true);
@ -266,6 +269,18 @@ public class TypeWars extends TeamGame
} }
} }
@EventHandler
public void fixGiants(UpdateEvent event)
{
if(event.getType() != UpdateType.TICK)
return;
for(Giant giant : _giantLocs.keySet())
{
giant.teleport(_giantLocs.get(giant));
}
}
@EventHandler @EventHandler
public void Players(UpdateEvent event) public void Players(UpdateEvent event)
{ {