Exemplo n.º 1
0
  public void requestInventoryOpen(Location loc, Locomotion move) {
    // System.out.println("Opening chest");
    move.lookAt(loc);
    try {
      out.write(8);
      out.writeInt((int) (loc.getX()));
      out.write((int) (loc.getY()));
      out.writeInt((int) (loc.getZ()));

      out.write(1);

      out.write(255);
      out.write(255);

      out.write(1);
      out.write(1);
      out.write(1);
      out.closePacket();
      // System.out.println("OPEN CHEST REQUEST SENT");

    } catch (Exception e) {
      System.err.println("Error while using entity.");
    }
    // System.out.println("CHEST opened");
  }
Exemplo n.º 2
0
  @Override
  public void logic() throws PogamutException {
    super.logic();
    myInitialize();
    double levelTime = this.game.getTime();
    double speed = this.bot.getVelocity().size();
    double skipTime = 0;
    if (lastTime > 0) {
      skipTime = levelTime - lastTime;
    }
    double distance_estimate = skipTime * speed;
    if (sequence != null && sequence.hasNext()) {
      Point pose;
      if (distance_estimate > 0) {
        pose = sequence.nextByDistance(distance_estimate);
      } else {
        pose = sequence.nextByTime(skipTime);
      }

      Location current = this.getAgentMemory().getAgentLocation().getLocation();
      Location next = pose.getLocation();
      if (next.getDistance(current) > SPACE_DISCONTINUITY) {
        System.out.println("RESPAWN: space discontinuity");
        this.body.getAction().respawn(pose.getLocation(), pose.getRotation());
      } else {
        this.move.moveTo(pose.getLocation());
      }
      System.out.println("current: " + current + " next: " + next);
      System.out.println("level: " + levelTime + " data: " + pose.getT() + " skip: " + skipTime);
    } else {
      if (sequenceIter == null) {
        sequenceIter = sequences.iterator();
      }
      if (sequenceIter.hasNext()) {
        sequence = sequenceIter.next();
        if (sequence.hasNext()) {
          Point pose = sequence.nextByTime(skipTime);
          this.body.getAction().respawn(pose.getLocation(), pose.getRotation());
        }
      }
    }
    lastTime = levelTime;
  }
  private void sendRays2(long gameTime, Location from) {
    final int rayLength = 400; // (int) (UnrealUtils.CHARACTER_COLLISION_RADIUS * 1000);
    boolean traceActor = false;

    Trace trace = new Trace();
    trace.setFrom(from);
    trace.setTraceActors(traceActor);

    for (int angle = 0; angle < 360; angle += 10) {

      double cos = Math.cos(Math.toRadians(angle));
      double sin = Math.sin(Math.toRadians(angle));
      Location to = from.add(new Location(rayLength * cos, rayLength * sin));
      trace.setId("" + gameTime + "_" + angle);
      trace.setTo(to);
      getAct().act(trace);
    }
  }
Exemplo n.º 4
0
 public boolean isInRange(Location location) {
   return Location.getDistance(move.getLocation(), location) < 5.5;
 }
Exemplo n.º 5
0
 final void applyVelocity(Velocity velocity) {
   location = location.add(velocity);
 }