<commit_before>
const RG = require('./rg.js');
RG.System = require('./system.js');
RG.Map = require('./map.js');
RG.Time = require('./time.js');

/* Game engine which handles turn scheduling, systems updates and in-game
 * messaging between objects. */
const Engine = function(eventPool) {

    // Ignore GUI commands by default
    this.isGUICommand = () => false;
    this.doGUICommand = null;

    this.nextActor = null;
    this.animation = null;
    this.animationCallback = null;

    this._levelMap = {}; // All levels, ID -> level
    this._activeLevels = []; // Only these levels are simulated
    this._scheduler = new RG.Time.Scheduler();
    this._msg = new RG.MessageHandler();
    this._eventPool = eventPool;

    this.visibleCells = [];

    this._cache = {};

    this.getMessages = () => this._msg.getMessages();
    this.hasNewMessages = () => this._msg.hasNew();
    this.clearMessages = () => { this._msg.clear();};

    //--------------------------------------------------------------
    // ECS SYSTEMS
    //--------------------------------------------------------------

    // These systems updated after each action. Order is important, for example,
    // animations should be seen before actors are killed
    this.systemOrder = ['AreaEffects', 'Disability', 'SpiritBind', 'BaseAction',
        'Attack', 'Chat',
        'Shop', 'SpellCast',
        'SpellEffect', 'Missile', 'Movement', 'Animation', 'Damage',
        'Battle', 'Skills', 'ExpPoints', 'Communication',
        'Events'];

    this.systems = {};
    this.systems.Disability = new RG.System.Disability(
        ['Stun', 'Paralysis']);
    this.systems.SpiritBind = new RG.System.SpiritBind(['SpiritBind']);
    this.systems.BaseAction = new RG.System.BaseAction(['Pickup',
        'UseStairs', 'OpenDoor']);<commit_msg>Added UseItem component.<commit_after>
const RG = require('./rg.js');
RG.System = require('./system.js');
RG.Map = require('./map.js');
RG.Time = require('./time.js');

/* Game engine which handles turn scheduling, systems updates and in-game
 * messaging between objects. */
const Engine = function(eventPool) {

    // Ignore GUI commands by default
    this.isGUICommand = () => false;
    this.doGUICommand = null;

    this.nextActor = null;
    this.animation = null;
    this.animationCallback = null;

    this._levelMap = {}; // All levels, ID -> level
    this._activeLevels = []; // Only these levels are simulated
    this._scheduler = new RG.Time.Scheduler();
    this._msg = new RG.MessageHandler();
    this._eventPool = eventPool;

    this.visibleCells = [];

    this._cache = {};

    this.getMessages = () => this._msg.getMessages();
    this.hasNewMessages = () => this._msg.hasNew();
    this.clearMessages = () => { this._msg.clear();};

    //--------------------------------------------------------------
    // ECS SYSTEMS
    //--------------------------------------------------------------

    // These systems updated after each action. Order is important, for example,
    // animations should be seen before actors are killed
    this.systemOrder = ['AreaEffects', 'Disability', 'SpiritBind', 'BaseAction',
        'Attack', 'Chat',
        'Shop', 'SpellCast',
        'SpellEffect', 'Missile', 'Movement', 'Animation', 'Damage',
        'Battle', 'Skills', 'ExpPoints', 'Communication',
        'Events'];

    this.systems = {};
    this.systems.Disability = new RG.System.Disability(
        ['Stun', 'Paralysis']);
    this.systems.SpiritBind = new RG.System.SpiritBind(['SpiritBind']);
    this.systems.BaseAction = new RG.System.BaseAction(['Pickup',
        'UseStairs', 'OpenDoor', 'UseItem']);
{'fraction_non_alphanumeric': 0.21984649122807018, 'fraction_numerical': 0.0, 'mean_word_length': 2.3446379468377634, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '469939', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1001, 'n_words': 246}