StendhalAPI: Difference between revisions

Content deleted Content added
imported>AntumDeluge
Entity: add more public methods
imported>AntumDeluge
ActiveEntity: add public methods
Line 210:
* Class: {{StendhalFile|master|src/games/stendhal/server/entity/ActiveEntity.java|games.stendhal.server.entity.ActiveEntity}}
* Inherits: [[StendhalAPI#Entity|Entity]]
 
'''Public methods:'''
 
; ''<span style="color:green;">ActiveEntity</span>()''
: Default constructor.
 
; ''<span style="color:green;">ActiveEntity</span>(object)''
: Copy constructor.
: '''''object:''''' (<code>RPObject</code>) Object to be copied.
 
; ''<span style="color:green;">setSpeed</span>(speed)''
: Sets the entity's current movement speed.
: '''''speed:''''' (<code>double</code>)
 
; ''<span style="color:green;">setDirection</span>(dir)''
: Sets the entity's facing direction.
: '''''dir:''''' (<code>Direction</code>) Direction to face.
 
; ''<span style="color:green;">setIgnoresCollision</span>(ignore)''
: Sets whether or not the entity should be able to traverse collision tiles.
: '''''ignore:''''' (<code>boolean</code>) If <code>true</code> sets the "ignore_collision" attribute, otherwise removes it.
 
; ''<span style="color:green;">applyMovement</span>()''
:
 
; ''<span style="color:green;">getDirection</span>()''
: Retrieves the entities current facing direction.
: ''returns:'' (<code>Direction</code>)
 
; ''<span style="color:green;">getSpeed</span>()''
: Retrieves the speed at which the entity is currently moving.
: ''returns:'' (<code>double</code>)
 
; ''<span style="color:green;">getStepsTaken</span>()''
: Retrieves the number of steps the entity has taken during the current session.
: ''returns:'' (<code>int</code>)
 
; ''<span style="color:green;">getDirectionToward</span>(entity)''
: Retrieves the direction from this entity to another.
: '''''entity:''''' (<code>Entity</code>) Entity from which to gauge direction.
: ''returns:'' (<code>Direction</code>)
 
; ''<span style="color:green;">getDirectionToward</span>(area)''
:
: '''''area:''''' (<code>Rectangle2D</code>)
: ''returns:'' (<code>Direction</code>)
 
; ''<span style="color:green;">isGhost</span>()''
: Checks whether an entity is a ghost (not physically interactive).
: ''returns:'' (<code>boolean</code>) <code>true</code> if "ghostmode" attribute is set (players only).
 
; ''<span style="color:green;">stop</span>()''
: Stops the entity's movement.
 
; ''<span style="color:green;">isFacingToward</span>(entity)''
: Determines if this entity is facing toward another entity.
: '''''entity:''''' (<code>Entity</code>) Target entity.
: ''returns:'' (<code>boolean</code>) <code>true</code> if facing other entity.
 
; ''<span style="color:green;">faceto</span>(x, y)''
: Face toward a specific point on the map.
: '''''x:''''' (<code>int</code>) Horizontal position of point to face.
: '''''y:''''' (<code>int</code>) Vertical position of point to face.
 
; ''<span style="color:green;">faceToward</span>(entity)''
: Face toward a specific entity.
: '''''entity:''''' (<code>Entity</code>) Entity to face toward.
 
; ''<span style="color:green;">canMoveTo</span>(x, y)''
: Predicts if entity can move to a position.
: '''''x:''''' (<code>int</code>) Horizontal position of the target point.
: '''''y:''''' (<code>int</code>) Vertical position of the target point.
: ''returns:'' (<code>boolean</code>) <code>true</code> if nothing is preventing entity from moving to target point.
 
; ''<span style="color:green;">canMoveTo</span>(pos)''
: Predicts if entity can move to a position.
: '''''pos:''''' (<code>Point</code>) Target point.
: ''returns:'' (<code>boolean</code>) <code>true</code> if nothing is preventing entity from moving to target point.
 
; ''<span style="color:green;">ignoresCollision</span>()''
: Checks if the entity can pass through collision tiles.
: ''returns:'' (<code>boolean</code>) <code>true</code> if the "ignore_collision" attribute is set.
 
'''Public static methods:'''
 
; ''<span style="color:green;">generateRPClass</span>()''
:
 
=== GuidedEntity ===