Source: Game_Actors.js

Game_Actors.js

//-----------------------------------------------------------------------------
// Game_Actors
//
// The wrapper class for an actor array.
/**
 * The wrapper class for an actor array.
 *
 * @class
 */
function Game_Actors() {
    this.initialize(...arguments);
}

/**
 * Initialize the array
 */
Game_Actors.prototype.initialize = function() {
    this._data = [];
};

/**
 * Get a Game Actor object from the actor's id. One will be created if it doesn't exist.
 *
 * @param {number} actorId - The actor's id
 * @return {Game_Actor|null} The game actor object, or null if the id is invalid
 */
Game_Actors.prototype.actor = function(actorId) {
    if ($dataActors[actorId]) {
        if (!this._data[actorId]) {
            this._data[actorId] = new Game_Actor(actorId);
        }
        return this._data[actorId];
    }
    return null;
};