Created
July 30, 2012 02:17
-
-
Save pxpc2/3203442 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param trap the trap SceneObject | |
*/ | |
public static void activateTrap(SceneObject trap) | |
{ | |
if ((trap != null) && (trap.isOnScreen()) && (Players.getLocal().getAnimation() == -1)) | |
{ | |
Tile tile = trap.getLocation(); | |
System.out.println(tile.getX() + " : " + tile.getY()); | |
trap.interact("Set-trap"); | |
Time.sleep(1000); | |
SFields.inactivity = new Timer(0); | |
while ((SceneEntities.getAt(tile.getX(), | |
tile.getY()).getId() == SConstants.SWAMP_LIZARD_TRAP_OPEN) && | |
Players.getLocal().getAnimation() != -1) | |
{ | |
Context.get().getActiveScript().log.severe("inactive"); | |
Time.sleep(400); | |
if (SFields.inactivity.getElapsed() > 5000) | |
{ | |
return; | |
} | |
} | |
System.out.println(SceneEntities.getAt(tile.getX(), tile.getY()).getId() == SConstants.SWAMP_LIZARD_TRAP_WAITING); | |
if (SceneEntities.getAt(tile.getX(), tile.getY()).getId() == SConstants.SWAMP_LIZARD_TRAP_WAITING) | |
{ | |
Context.get().getActiveScript().log.severe("We got in"); | |
SFields.trapTiles.add(tile); | |
} | |
} | |
else if (trap != null && !trap.isOnScreen()) | |
{ | |
Walking.walk(trap); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment