mdh.hephaestus2
Class Thing

java.lang.Object
  |
  +--mdh.hephaestus2.Stuff
        |
        +--mdh.hephaestus2.Thing
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Block, Statted

public abstract class Thing
extends Stuff

Anything that can appear on a Map.

Author:
Copyright © 2001 by Mark Hughes <kamikaze@kuoi.asui.uidaho.edu>
See Also:
Serialized Form

Method Summary
 Grid findGrid()
          Returns the Grid this Thing is in, or null if not found.
 Map findMap()
          Returns the Map this Thing is on, or null if not found.
 String getIconFilename()
          Returns the current pose's iconFilename.
 int getNPoses()
          Returns the number of poses defined.
 int getOpacity()
          Returns the opacity level of this Thing, one of Global.OPA_*.
 int getPose()
          Returns the current pose of this Thing.
 Props getProps()
          Returns the properties of this Thing, which may be null.
 Tile getTile()
          Returns the Tile for the current pose, or null if no poses have been defined.
 Props initProps()
          Returns the properties of this Thing, creating a new properties set if needed.
 boolean isType(int type)
          Returns true if this class or any of its superclasses is of 'type', one of Global.TYPE_*.
 LocationReadOnly loc()
          Returns the current Location of the Thing.
 boolean moveto(int mapid, int x, int y, int facing, boolean teleport)
          Moves this Thing to a given coordinate.
 boolean moveto(LocationReadOnly loc, boolean teleport)
          Moves this Thing to a given location.
 void setFacing(int facing)
          Changes the facing of this Thing.
 void setOpacity(int o)
          Sets the opacity of this Thing, to one of Global.OPA_*.
 void setPose(int p)
          Sets the current pose of this Thing.
 void setTile(int pose, Tile t)
          Sets the tile for pose 'pose'.
 
Methods inherited from class mdh.hephaestus2.Stuff
destroy, getBlocking, getName, getTriggerCallback, getType, id, setBlocking, setName, setTriggerCallback, toString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

findMap

public Map findMap()
            throws HephaestusException
Returns the Map this Thing is on, or null if not found.

HephaestusException

findGrid

public Grid findGrid()
              throws HephaestusException
Returns the Grid this Thing is in, or null if not found.

HephaestusException

getNPoses

public int getNPoses()
              throws HephaestusException
Returns the number of poses defined.

HephaestusException

getOpacity

public int getOpacity()
               throws HephaestusException
Returns the opacity level of this Thing, one of Global.OPA_*.

HephaestusException

getPose

public int getPose()
            throws HephaestusException
Returns the current pose of this Thing.

HephaestusException

getProps

public Props getProps()
Returns the properties of this Thing, which may be null. Use initProps() to create a new properties set on the Thing.


initProps

public Props initProps()
Returns the properties of this Thing, creating a new properties set if needed.


getTile

public Tile getTile()
             throws HephaestusException
Returns the Tile for the current pose, or null if no poses have been defined.

HephaestusException

getIconFilename

public String getIconFilename()
                       throws HephaestusException
Returns the current pose's iconFilename.

HephaestusException
See Also:
Tile.getIconFilename()

isType

public boolean isType(int type)
Description copied from class: Stuff
Returns true if this class or any of its superclasses is of 'type', one of Global.TYPE_*.

Overrides:
isType in class Stuff

loc

public LocationReadOnly loc()
Returns the current Location of the Thing.

See Also:
moveto(mdh.hephaestus2.LocationReadOnly, boolean)

moveto

public boolean moveto(LocationReadOnly loc,
                      boolean teleport)
               throws HephaestusException
Moves this Thing to a given location.

Parameters:
teleport - If true, do not evaluate the trigger at the target grid.
HephaestusException

moveto

public boolean moveto(int mapid,
                      int x,
                      int y,
                      int facing,
                      boolean teleport)
               throws HephaestusException
Moves this Thing to a given coordinate.

Parameters:
mapid - destination mapid. If the mapid is 0, this Thing is moved to "nowhere", though it still exists in the system.
x - destination x-coord
y - destination y-coord
facing - new facing
teleport - If true, do not evaluate the trigger at the target grid.
HephaestusException

setFacing

public void setFacing(int facing)
               throws HephaestusException
Changes the facing of this Thing.

HephaestusException

setOpacity

public void setOpacity(int o)
                throws HephaestusException
Sets the opacity of this Thing, to one of Global.OPA_*.

HephaestusException

setPose

public void setPose(int p)
             throws HephaestusException
Sets the current pose of this Thing.

Throws:
HephaestusException - if you try to set a higher pose than exists.

setTile

public void setTile(int pose,
                    Tile t)
             throws HephaestusException
Sets the tile for pose 'pose'. If the pose has not been defined, it is added, but you must define them in order - 0, 1, etc.

Throws:
HephaestusException - if you try to set a tile for an out-of-order pose.