Package games.stendhal.server.entity.mapstuff.area

Source Code of games.stendhal.server.entity.mapstuff.area.WalkBlocker

/*
* @(#) src/games/stendhal/server/entity/WalkBlocker.java
*
* $Id: WalkBlocker.java,v 1.6 2010/06/28 15:46:57 kiheru Exp $
*/

package games.stendhal.server.entity.mapstuff.area;

//
//

import games.stendhal.server.entity.Entity;
import games.stendhal.server.entity.RPEntity;
import marauroa.common.game.RPClass;
import marauroa.common.game.Definition.Type;

/**
* An entity that just acts as an obstacle. This is a temporary workaround to
* allow items to be placed, but not players/entities, until multi-level
* collisions can be added.
*/
public class WalkBlocker extends AreaEntity {
  /**
   * Create a walk blocker.
   */
  public WalkBlocker() {
    super(1, 1);

    setRPClass("walkblocker");
    put("type", "walkblocker");
    // Count as collision for the client and pathfinder
    setResistance(100);
  }


  public static void generateRPClass() {
    final RPClass blocker = new RPClass("walkblocker");
    blocker.isA("area");
    blocker.addAttribute("class", Type.STRING);
  }

  /**
   * Determine if this is an obstacle for another entity.
   *
   * @param entity
   *            The entity to check against.
   *
   * @return <code>true</code> if the other entity is an RPEntity, otherwise
   *         the default.
   */
  @Override
  public boolean isObstacle(final Entity entity) {
    if (entity instanceof RPEntity) {
      return true;
    }

    return super.isObstacle(entity);
  }
}
TOP

Related Classes of games.stendhal.server.entity.mapstuff.area.WalkBlocker

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.