Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"RegalError: The properties of an inactive agent cannot be accessed within a game cycle." on active Agent's getter #82

Closed
jcowman2 opened this issue Dec 4, 2018 · 1 comment
Labels
bug Something isn't working root cause identified The root cause of this bug has been determined and an issue created for it
Milestone

Comments

@jcowman2
Copy link
Contributor

jcowman2 commented Dec 4, 2018

Overview

I'm getting an error when I try and access an active agent's getter property, which returns an array.

Description

Here is the agent in question:

export class Abilities extends Agent {
    public vision = new Ability("vision", 3, 4);
    public hearing = new Ability("hearing", 2, 3);
    public smell = new Ability("smell", 1, 2);
    public taste = new Ability("taste", 1, 2);
    public touch = new Ability("touch", 2, 3);
    public mobility = new Ability("mobility", 3, 4);
    public cognition = new Ability("cognition", 3, 4);

    public getList = () => {
        return [
            this.vision,
            this.hearing,
            this.smell,
            this.taste,
            this.touch,
            this.mobility,
            this.cognition
        ];
    };
}

The error occurs on this line:

for (const ab of game.state.abilities.getList()) {

Here is the game response:

{ output:
   { error: Error: RegalError: The properties of an inactive agent cannot be accessed within a game cycle.
    at Object.get (C:\Users\Joe\Desktop\Projects\regal\ludum-dare-43\node_modules\regal\dist\regal.cjs.js:1602:19)
    at Proxy.Abilities.getList (C:\Users\Joe\Desktop\Projects\regal\ludum-dare-43\src\agents.ts:25:18)
    at Function.common_1.on.game [as target] (C:\Users\Joe\Desktop\Projects\regal\ludum-dare-43\src\actions.ts:92:51)
    at InstanceEventsImpl._executeCurrent (C:\Users\Joe\Desktop\Projects\regal\ludum-dare-43\node_modules\regal\dist\regal.cjs.js:696:40)
    at InstanceEventsImpl._executeCurrent (C:\Users\Joe\Desktop\Projects\regal\ludum-dare-43\node_modules\regal\dist\regal.cjs.js:704:18)
    at InstanceEventsImpl._executeCurrent (C:\Users\Joe\Desktop\Projects\regal\ludum-dare-43\node_modules\regal\dist\regal.cjs.js:704:18)
    at InstanceEventsImpl.invoke (C:\Users\Joe\Desktop\Projects\regal\ludum-dare-43\node_modules\regal\dist\regal.cjs.js:648:14)
    at Function.postPlayerCommand (C:\Users\Joe\Desktop\Projects\regal\ludum-dare-43\node_modules\regal\dist\regal.cjs.js:1944:32)
    at Object.<anonymous> (C:\Users\Joe\Desktop\Projects\regal\ludum-dare-43\src\index.ts:61:14)
    at Module._compile (module.js:652:30),
     wasSuccessful: false } }

Steps to Reproduce

  1. Clone https://github.com/jcowman2/Now-Hiring
  2. Checkout the bug1 branch
  3. Run npm test
@jcowman2 jcowman2 added this to the Future milestone Dec 4, 2018
@jcowman2 jcowman2 added bug Something isn't working investigation needed The root cause of this bug needs investigation labels Dec 4, 2018
@jcowman2 jcowman2 modified the milestones: Future, Iteration 1 Mar 10, 2019
@jcowman2
Copy link
Contributor Author

Investigated; solution proposed in #104

@jcowman2 jcowman2 removed the investigation needed The root cause of this bug needs investigation label Jun 21, 2019
@jcowman2 jcowman2 added root cause identified The root cause of this bug has been determined and an issue created for it staged Will be resolved once the stage branch is released labels Oct 4, 2019
@jcowman2 jcowman2 mentioned this issue Nov 11, 2019
13 tasks
@jcowman2 jcowman2 removed the staged Will be resolved once the stage branch is released label Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working root cause identified The root cause of this bug has been determined and an issue created for it
Projects
None yet
Development

No branches or pull requests

1 participant