From 4c4b9974530d508ff20b2db53c37a59d6f8b446f Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 5 Dec 2015 19:00:44 +0100 Subject: [PATCH] fixing giant facing. --- .../arcade/game/games/typewars/TypeWars.java | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index d88cc777c..709bc68a7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -87,6 +87,7 @@ public class TypeWars extends TeamGame private HashMap> _giantAttackZones; private HashMap _giants; + private HashMap _giantLocs; private HashMap _minionsSpawned; private HashMap _giantsAttacked; @@ -146,6 +147,7 @@ public class TypeWars extends TeamGame _minionsSpawned = new HashMap<>(); _giantsAttacked = new HashMap<>(); _playerTitles = new HashSet<>(); + _giantLocs = new HashMap<>(); _animationTicks = 0; _nukeFrame = 0; @@ -194,17 +196,17 @@ public class TypeWars extends TeamGame public void prepareGiants() { - Location red = WorldData.GetDataLocs("PURPLE").get(0); - Location blue = WorldData.GetDataLocs("LIME").get(0); + Location red = WorldData.GetDataLocs("PURPLE").get(0).clone(); + Location blue = WorldData.GetDataLocs("LIME").get(0).clone(); - red.setPitch(UtilAlg.GetPitch(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))); - red.add(0, 1, 0); - blue.add(0, 1, 0); + red.getBlock().setType(Material.STONE); + blue.getBlock().setType(Material.STONE); + + red.add(0, 2, 0); + blue.add(0, 2, 0); int i = 0; for(GameTeam team : GetTeamList()) @@ -215,6 +217,7 @@ public class TypeWars extends TeamGame this.CreatureAllowOverride = true; Giant giant = loc.getWorld().spawn(loc, Giant.class); + _giantLocs.put(giant, loc.clone()); this.CreatureAllowOverride = false; giant.setRemoveWhenFarAway(false); 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 public void Players(UpdateEvent event) {