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

Spawn.spawning.setDirections() unable to change number of directions #108

Closed
laverdet opened this issue Jan 28, 2019 · 6 comments
Closed
Assignees

Comments

@laverdet
Copy link
Contributor

I'm having an issue with the setDirections API call. It won't let me decrease the number of directions supplied. For instance if I create a creep via: spawn.spawnCreep(body, name, { directions: [ TOP, BOTTOM ] }); and then later I perform spawn.spawning.setDirections([ LEFT ]); then the directions that actually get set are: [ LEFT, BOTTOM ]. It seems like it's merging the old directions and the new ones instead of just overwriting as I would expect.

This is happening on a local server, I'm not sure if it happens on MMO as well.

cc: @sparr because you worked on this in #61

@sparr
Copy link
Contributor

sparr commented Jan 28, 2019

If there's a bug here then I think it must be in bulk.update.

https://github.com/screeps/engine/pull/61/files#diff-eb4af864dfdce840b68c56247e6cabbfR15

@AlinaNova21
Copy link
Contributor

AlinaNova21 commented Jan 28, 2019 via email

@sparr
Copy link
Contributor

sparr commented Jan 28, 2019

That seems like it. lodash merge won't delete keys that already exist but aren't in the replacement object. I've been away too long and forgotten the architecture here so I'm not sure of an appropriate fix.

@o4kapuk
Copy link
Contributor

o4kapuk commented Jan 28, 2019

Thanks, I'll take a look

@sparr
Copy link
Contributor

sparr commented Jan 28, 2019

One fix at the outer level would be to change the spawn directions from a list of 0-8 numbers to an array of 8 true/false values.

@o4kapuk
Copy link
Contributor

o4kapuk commented Mar 19, 2019

Should be fixed currently.

@o4kapuk o4kapuk self-assigned this Mar 19, 2019
@o4kapuk o4kapuk closed this as completed Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants