Skip to content

Instantly share code, notes, and snippets.

@pxpc2
Created July 30, 2012 02:17
Show Gist options
  • Save pxpc2/3203442 to your computer and use it in GitHub Desktop.
Save pxpc2/3203442 to your computer and use it in GitHub Desktop.
/**
* @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