Corpse.java :  » Game » Arianne-RPG-0.83 » games » stendhal » client » entity » Java Open Source

Java Open Source » Game » Arianne RPG 0.83 
Arianne RPG 0.83 » games » stendhal » client » entity » Corpse.java
/* $Id: Corpse.java,v 1.72 2010/03/29 21:21:22 nhnb Exp $ */
/***************************************************************************
 *                      (C) Copyright 2003 - Marauroa                      *
 ***************************************************************************
 ***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
package games.stendhal.client.entity;

//
//

import marauroa.common.game.RPObject;
import marauroa.common.game.RPSlot;

/**
 * A corpse entity.
 */
public class Corpse extends Entity {
  /**
   * Content property.
   */
  public static final Property PROP_CONTENT = new Property();

  /**
   * The current content slot.
   */
  private RPSlot content;

  //
  // Corpse
  //

  /**
   * Get the corpse contents.
   * 
   * @return The contents slot.
   */
  public RPSlot getContent() {
    return content;
  }

  //
  // Entity
  //

  /**
   * Initialize this entity for an object.
   * 
   * @param object
   *            The object.
   * 
   * @see #release()
   */
  @Override
  public void initialize(final RPObject object) {
    super.initialize(object);

    if (object.hasSlot("content")) {
      content = object.getSlot("content");
    } else {
      content = null;
    }
  }

  //
  // RPObjectChangeListener
  //

  /**
   * The object added/changed attribute(s).
   * 
   * @param object
   *            The base object.
   * @param changes
   *            The changes.
   */
  @Override
  public void onChangedAdded(final RPObject object, final RPObject changes) {
    super.onChangedAdded(object, changes);
    if (changes.hasSlot("content")) {
      fireChange(PROP_CONTENT);
    }
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.